From e1539a531da3192dac843520d77c8c76e407a402 Mon Sep 17 00:00:00 2001 From: lresende Date: Sat, 21 Nov 2009 07:55:07 +0000 Subject: Moving 1.x tags git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@882849 13f79535-47bb-0310-9956-ffa450edef68 --- sca-java-1.x/tags/java-M1-20060522/PROPOSAL.txt | 238 + sca-java-1.x/tags/java-M1-20060522/STATUS | 60 + .../tags/java-M1-20060522/java/BUILDING.txt | 23 + .../tags/java-M1-20060522/java/GettingStarted.htm | 192 + .../tags/java-M1-20060522/java/LICENSE.txt | 1277 ++++ sca-java-1.x/tags/java-M1-20060522/java/NOTICE | 18 + sca-java-1.x/tags/java-M1-20060522/java/README.txt | 27 + .../tags/java-M1-20060522/java/das/pom.xml | 34 + .../tags/java-M1-20060522/java/das/rdb/pom.xml | 103 + .../tuscany/das/rdb/ApplyChangesCommand.java | 101 + .../java/org/apache/tuscany/das/rdb/Command.java | 222 + .../org/apache/tuscany/das/rdb/CommandFactory.java | 93 + .../org/apache/tuscany/das/rdb/CommandGroup.java | 63 + .../tuscany/das/rdb/CommandGroupFactory.java | 37 + .../org/apache/tuscany/das/rdb/ConfigHelper.java | 67 + .../java/org/apache/tuscany/das/rdb/Converter.java | 52 + .../main/java/org/apache/tuscany/das/rdb/Key.java | 58 + .../java/org/apache/tuscany/das/rdb/Pager.java | 62 + .../java/org/apache/tuscany/das/rdb/Parameter.java | 128 + .../org/apache/tuscany/das/rdb/ResultSetShape.java | 96 + .../org/apache/tuscany/das/rdb/SDODataTypes.java | 64 + .../das/rdb/config/wrapper/MappingWrapper.java | 411 ++ .../das/rdb/config/wrapper/QualifiedColumn.java | 41 + .../rdb/config/wrapper/RelationshipWrapper.java | 44 + .../das/rdb/config/wrapper/TableWrapper.java | 124 + .../das/rdb/generator/impl/CudGenerator.java | 64 + .../das/rdb/generator/impl/DeleteGenerator.java | 98 + .../das/rdb/generator/impl/InsertGenerator.java | 179 + .../das/rdb/generator/impl/UpdateGenerator.java | 206 + .../das/rdb/graphbuilder/impl/DataObjectMaker.java | 120 + .../rdb/graphbuilder/impl/DefaultConverter.java | 91 + .../graphbuilder/impl/GraphBuilderMetadata.java | 98 + .../rdb/graphbuilder/impl/MultiTableRegistry.java | 105 + .../das/rdb/graphbuilder/impl/ResultMetadata.java | 293 + .../rdb/graphbuilder/impl/ResultSetProcessor.java | 137 + .../das/rdb/graphbuilder/impl/ResultSetRow.java | 169 + .../das/rdb/graphbuilder/impl/RowObjects.java | 140 + .../rdb/graphbuilder/impl/SingleTableRegistry.java | 52 + .../das/rdb/graphbuilder/impl/TableData.java | 75 + .../das/rdb/graphbuilder/impl/TableRegistry.java | 43 + .../das/rdb/graphbuilder/schema/ESchemaMaker.java | 171 + .../rdb/graphbuilder/schema/ResultSetTypeMap.java | 133 + .../das/rdb/impl/ApplyChangesCommandImpl.java | 111 + .../tuscany/das/rdb/impl/BaseCommandImpl.java | 68 + .../apache/tuscany/das/rdb/impl/ChangeFactory.java | 199 + .../tuscany/das/rdb/impl/ChangeOperation.java | 79 + .../tuscany/das/rdb/impl/ChangeSummarizer.java | 266 + .../org/apache/tuscany/das/rdb/impl/Changes.java | 80 + .../tuscany/das/rdb/impl/CommandFactoryImpl.java | 77 + .../das/rdb/impl/CommandGroupFactoryImpl.java | 31 + .../tuscany/das/rdb/impl/CommandGroupImpl.java | 207 + .../apache/tuscany/das/rdb/impl/CommandImpl.java | 145 + .../tuscany/das/rdb/impl/ConnectionImpl.java | 95 + .../tuscany/das/rdb/impl/CreateOperation.java | 29 + .../tuscany/das/rdb/impl/DatabaseObject.java | 148 + .../tuscany/das/rdb/impl/DeleteCommandImpl.java | 25 + .../apache/tuscany/das/rdb/impl/DeleteList.java | 72 + .../tuscany/das/rdb/impl/DeleteOperation.java | 38 + .../tuscany/das/rdb/impl/FactoryRegistry.java | 49 + .../tuscany/das/rdb/impl/InsertCommandImpl.java | 79 + .../apache/tuscany/das/rdb/impl/InsertList.java | 82 + .../das/rdb/impl/OptimisticWriteCommandImpl.java | 45 + .../org/apache/tuscany/das/rdb/impl/PagerImpl.java | 64 + .../apache/tuscany/das/rdb/impl/ParameterImpl.java | 107 + .../apache/tuscany/das/rdb/impl/Parameters.java | 150 + .../apache/tuscany/das/rdb/impl/QueryString.java | 87 + .../tuscany/das/rdb/impl/ReadCommandImpl.java | 168 + .../tuscany/das/rdb/impl/SDODataTypeHelper.java | 100 + .../apache/tuscany/das/rdb/impl/SPCommandImpl.java | 73 + .../org/apache/tuscany/das/rdb/impl/Statement.java | 206 + .../tuscany/das/rdb/impl/UpdateCommandImpl.java | 25 + .../apache/tuscany/das/rdb/impl/UpdateList.java | 42 + .../tuscany/das/rdb/impl/UpdateOperation.java | 30 + .../tuscany/das/rdb/impl/WriteCommandImpl.java | 97 + .../tuscany/das/rdb/merge/impl/GraphMerger.java | 166 + .../apache/tuscany/das/rdb/util/ConfigUtil.java | 51 + .../tuscany/das/rdb/util/DataObjectUtil.java | 73 + .../tuscany/das/rdb/util/DebugFormatter.java | 34 + .../org/apache/tuscany/das/rdb/util/DebugUtil.java | 66 + .../rdb/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../rdb/src/main/resources/META-INF/MANIFEST.MF | 13 + .../das/rdb/src/main/resources/META-INF/NOTICE | 18 + .../das/rdb/src/main/resources/META-INF/README.txt | 35 + .../java/das/rdb/src/main/resources/config.xsd | 103 + .../java/das/rdb/src/main/resources/dasmodel4.mdl | 4645 ++++++++++++ .../tuscany/das/rdb/test/BestPracticeTests.java | 150 + .../apache/tuscany/das/rdb/test/CUDGeneration.java | 124 + .../tuscany/das/rdb/test/CommandGroupTests.java | 165 + .../apache/tuscany/das/rdb/test/CompanyTests.java | 105 + .../tuscany/das/rdb/test/CompoundKeyTests.java | 100 + .../tuscany/das/rdb/test/ConverterTests.java | 114 + .../tuscany/das/rdb/test/CorrectedDefectTests.java | 244 + .../das/rdb/test/CrudWithChangeHistory.java | 377 + .../apache/tuscany/das/rdb/test/DefectTests.java | 303 + .../tuscany/das/rdb/test/ExceptionTests.java | 149 + .../das/rdb/test/GeneratedCommandTests.java | 93 + .../apache/tuscany/das/rdb/test/GeneratedId.java | 294 + .../tuscany/das/rdb/test/GraphMergeTests.java | 154 + .../tuscany/das/rdb/test/NameMappingTests.java | 64 + .../org/apache/tuscany/das/rdb/test/OCCTests.java | 64 + .../das/rdb/test/OneToOneRelationshipTests.java | 155 + .../das/rdb/test/OperationOrderingTests.java | 85 + .../org/apache/tuscany/das/rdb/test/Paging.java | 108 + .../tuscany/das/rdb/test/PartialUpdateTests.java | 103 + .../das/rdb/test/PassiveConnectionTests.java | 85 + .../das/rdb/test/ProgrammaticConfigTests.java | 157 + .../tuscany/das/rdb/test/ReadDBSchemaTests.java | 62 + .../tuscany/das/rdb/test/RecursiveTests.java | 81 + .../tuscany/das/rdb/test/RelationshipTests.java | 121 + .../tuscany/das/rdb/test/ResultSetShapeTests.java | 105 + .../tuscany/das/rdb/test/SerializationTests.java | 90 + .../apache/tuscany/das/rdb/test/SimplestCrud.java | 256 + .../apache/tuscany/das/rdb/test/StoredProcs.java | 194 + .../org/apache/tuscany/das/rdb/test/TopDown.java | 85 + .../org/apache/tuscany/das/rdb/test/TypeTests.java | 96 + .../commands/ReadCustomersByLastnameCommand.java | 54 + .../rdb/test/commands/ReadCustomersCommand.java | 55 + .../commands/ReadCustomersStaticTypesCommand.java | 62 + .../commands/ReadCustomersWithShapeCommand.java | 40 + .../SimpleReadCustomersWithShapeCommand.java | 66 + .../das/rdb/test/company/CompanyFactory.java | 73 + .../tuscany/das/rdb/test/company/CompanyType.java | 101 + .../das/rdb/test/company/DatagraphRoot.java | 81 + .../das/rdb/test/company/DepartmentType.java | 153 + .../tuscany/das/rdb/test/company/EmployeeType.java | 137 + .../rdb/test/company/impl/CompanyFactoryImpl.java | 174 + .../rdb/test/company/impl/CompanyPackageImpl.java | 1258 ++++ .../das/rdb/test/company/impl/CompanyTypeImpl.java | 303 + .../rdb/test/company/impl/DatagraphRootImpl.java | 252 + .../rdb/test/company/impl/DepartmentTypeImpl.java | 395 + .../rdb/test/company/impl/EmployeeTypeImpl.java | 333 + .../tuscany/das/rdb/test/customer/AnOrder.java | 216 + .../tuscany/das/rdb/test/customer/Customer.java | 153 + .../das/rdb/test/customer/CustomerFactory.java | 64 + .../das/rdb/test/customer/DataGraphRoot.java | 66 + .../das/rdb/test/customer/impl/AnOrderImpl.java | 461 ++ .../test/customer/impl/CustomerFactoryImpl.java | 150 + .../das/rdb/test/customer/impl/CustomerImpl.java | 395 + .../test/customer/impl/CustomerPackageImpl.java | 847 +++ .../rdb/test/customer/impl/DataGraphRootImpl.java | 213 + .../apache/tuscany/das/rdb/test/data/BookData.java | 45 + .../apache/tuscany/das/rdb/test/data/CityData.java | 54 + .../tuscany/das/rdb/test/data/CompanyData.java | 45 + .../tuscany/das/rdb/test/data/CompanyDeptData.java | 42 + .../tuscany/das/rdb/test/data/CompanyEmpData.java | 44 + .../tuscany/das/rdb/test/data/CustomerData.java | 45 + .../tuscany/das/rdb/test/data/DepEmpData.java | 45 + .../tuscany/das/rdb/test/data/DepartmentData.java | 41 + .../tuscany/das/rdb/test/data/EmployeeData.java | 45 + .../tuscany/das/rdb/test/data/OrderData.java | 42 + .../das/rdb/test/data/OrderDetailsData.java | 43 + .../apache/tuscany/das/rdb/test/data/PartData.java | 52 + .../tuscany/das/rdb/test/data/StateData.java | 51 + .../tuscany/das/rdb/test/data/TypesData.java | 64 + .../tuscany/das/rdb/test/framework/DB2Setup.java | 35 + .../tuscany/das/rdb/test/framework/DasTest.java | 155 + .../das/rdb/test/framework/DatabaseSetup.java | 238 + .../tuscany/das/rdb/test/framework/DerbySetup.java | 42 + .../das/rdb/test/framework/JavaStoredProcs.java | 79 + .../tuscany/das/rdb/test/framework/MySQLSetup.java | 96 + .../das/rdb/test/framework/RelationshipData.java | 81 + .../tuscany/das/rdb/test/framework/TestData.java | 87 + .../framework/TestDataWithExplicitColumns.java | 82 + .../test/mappings/IntegerToBooleanConverter.java | 40 + .../test/mappings/SillyDateStringConverter.java | 73 + .../test/mappings/StringToIntegerConverter.java | 37 + .../rdb/test/mappings/StringToLongConverter.java | 35 + .../das/rdb/test/suites/AllCommonTests.java | 98 + .../tuscany/das/rdb/test/suites/AllTestsDB2.java | 39 + .../tuscany/das/rdb/test/suites/AllTestsDerby.java | 34 + .../tuscany/das/rdb/test/suites/AllTestsMySQL.java | 34 + .../das/rdb/test/typed/SimplestStaticCrud.java | 58 + .../rdb/src/test/resources/1xM_mapping_no_cud.xml | 33 + .../das/rdb/src/test/resources/BooksConfig.xml | 24 + .../das/rdb/src/test/resources/CompanyConfig.xml | 48 + .../src/test/resources/CompanyEmployeeConfig.xml | 67 + .../test/resources/CustOrdersConnectionProps.xml | 61 + .../test/resources/CustomerConfigWithConverter.xml | 24 + .../resources/CustomerConfigWithIDConverter.xml | 23 + .../src/test/resources/CustomersOrdersConfig.xml | 45 + .../test/resources/OrdersOrderDetailsConfig.xml | 30 + .../das/rdb/src/test/resources/PartsConfig.xml | 27 + .../resources/basicCompanyDepartmentMapping.xml | 36 + .../rdb/src/test/resources/basicCompanyMapping.xml | 22 + .../src/test/resources/basicCustomerMapping.xml | 25 + .../test/resources/basicCustomerMappingWithCUD.xml | 28 + .../basicCustomerMappingWithInvalidCUD.xml | 28 + .../test/resources/basicCustomerOrderMapping.xml | 32 + .../rdb/src/test/resources/basicStaticCustomer.xml | 25 + .../java/das/rdb/src/test/resources/cityStates.xml | 37 + .../java/das/rdb/src/test/resources/company.ecore | 130 + .../das/rdb/src/test/resources/company.genmodel | 38 + .../java/das/rdb/src/test/resources/company.xsd | 53 + .../das/rdb/src/test/resources/companyMapping.xml | 39 + .../resources/companyMappingWithConverters.xml | 41 + .../java/das/rdb/src/test/resources/customer.ecore | 96 + .../das/rdb/src/test/resources/customer.genmodel | 32 + .../java/das/rdb/src/test/resources/customer.xsd | 47 + .../das/rdb/src/test/resources/customerMapping.xml | 25 + .../resources/customerOrderRelationshipMapping.xml | 31 + .../java/distribution/BUILDING.txt | 5 + .../java/distribution/axis2-overlay/pom.xml | 88 + .../axis2-overlay/src/main/assembly/bin.xml | 38 + .../java/distribution/build-dist.bat | 33 + .../java/distribution/build-dist.sh | 33 + .../java/distribution/buildDistribution.xml | 83 + .../java/distribution/celtix-overlay/pom.xml | 88 + .../celtix-overlay/src/main/assembly/bin.xml | 39 + .../java-M1-20060522/java/distribution/pom.xml | 39 + .../tomcat-overlay/configureTomcat.xml | 425 ++ .../java/distribution/tomcat-overlay/context.xsl | 96 + .../distribution/tomcat-overlay/datasource.xsl | 39 + .../java/distribution/tomcat-overlay/pom.xml | 121 + .../java/distribution/tomcat-overlay/server.xsl | 49 + .../java/distribution/tuscany-core-overlay/pom.xml | 113 + .../tuscany-core-overlay/src/main/assembly/bin.xml | 38 + .../java/distribution/tuscany-polish/fixupJars.xml | 112 + .../java/distribution/tuscany-polish/pom.xml | 110 + .../java/distribution/tuscany-samples/pom.xml | 56 + .../tuscany-samples/src/main/assembly/bin.xml | 88 + .../distribution/tuscany-tools-overlay/pom.xml | 104 + .../src/main/assembly/bin.xml | 38 + .../tags/java-M1-20060522/java/etc/svn-ignores | 13 + .../java/etc/tuscany-eclipse-codestyle.xml | 246 + .../java/etc/tuscany-idea-codestyle.xml | 19 + .../java/javadoc/css/maven-base.css | 147 + .../java/javadoc/css/maven-classic.css | 881 +++ .../java/javadoc/css/maven-theme.css | 125 + .../java-M1-20060522/java/javadoc/css/print.css | 7 + sca-java-1.x/tags/java-M1-20060522/java/pom.xml | 290 + .../java/sampleapps/bigbank/account/build.xml | 99 + .../java/sampleapps/bigbank/account/pom.xml | 125 + .../java/sampleapps/bigbank/account/readme.htm | 20 + .../services/account/AccountServiceImpl.java | 260 + .../services/accountdata/AccountDataService.java | 77 + .../accountdata/AccountDataServiceDASImpl.java | 397 + .../accountdata/AccountDataServiceImpl.java | 99 + .../account/services/accountdb/AccountDBInit.java | 452 ++ .../account/services/stockquote/StockQuote.java | 223 + .../services/stockquote/StockQuoteService.java | 29 + .../services/stockquote/StockQuoteServiceImpl.java | 66 + .../StockQuoteWebservicexServiceImpl.java | 150 + .../src/main/resources/DasAccountConfiguration.xml | 65 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../account/src/main/resources/META-INF/NOTICE | 18 + .../account/src/main/resources/META-INF/README.txt | 35 + .../WebservicexService_stockquote.fragment | 32 + .../src/main/resources/mock_stockquote.fragment | 27 + .../account/src/main/resources/sca.fragment | 27 + .../bigbank/account/src/main/resources/sca.module | 55 + .../account/src/main/resources/sca.subsystem | 22 + .../src/main/resources/wsdl/AccountService.wsdl | 392 + .../resources/wsdl/stockquotes.webservicex.wsdl | 133 + .../account/src/main/webapp/WEB-INF/web.xml | 28 + .../java/bigbank/account/client/AccountClient.java | 57 + .../java/sampleapps/bigbank/build.xml | 28 + .../java/sampleapps/bigbank/docs/Show.Image.html | 22 + .../java/sampleapps/bigbank/docs/accountfiles.png | Bin 0 -> 12297 bytes .../sampleapps/bigbank/docs/modualoverview.png | Bin 0 -> 6074 bytes .../sampleapps/bigbank/docs/webclientfiles.png | Bin 0 -> 16568 bytes .../java/sampleapps/bigbank/pom.xml | 34 + .../java/sampleapps/bigbank/readme.htm | 94 + .../java/sampleapps/bigbank/webclient/build.xml | 85 + .../java/sampleapps/bigbank/webclient/pom.xml | 95 + .../java/sampleapps/bigbank/webclient/readme.htm | 20 + .../account/AccountServiceComponentImpl.java | 106 + .../services/profile/AccountLoginServiceImpl.java | 50 + .../webclient/services/profile/LoginService.java | 30 + .../webclient/services/profile/ProfileService.java | 36 + .../services/profile/ProfileServiceImpl.java | 67 + .../services/profile/SimpleLoginServiceImpl.java | 49 + .../webclient/tags/account/AccountStatusTag.java | 125 + .../webclient/tags/account/StockStatusTag.java | 79 + .../webclient/tags/sca/LoginBarrierTag.java | 97 + .../bigbank/webclient/tags/sca/ServiceTag.java | 98 + .../java/bigbank/webclient/ui/FormServlet.java | 156 + .../java/bigbank/webclient/ui/LoginServlet.java | 91 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../webclient/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../webclient/src/main/resources/sca.module | 51 + .../webclient/src/main/resources/sca.subsystem | 27 + .../src/main/resources/wsdl/AccountService.wsdl | 392 + .../webclient/src/main/webapp/CustomerProfile.jsp | 97 + .../src/main/webapp/WEB-INF/bigbank-tags.tld | 91 + .../webclient/src/main/webapp/WEB-INF/web.xml | 44 + .../src/main/webapp/accountTransaction.jsp | 47 + .../bigbank/webclient/src/main/webapp/login.html | 42 + .../webclient/src/main/webapp/purchaseStock.jsp | 56 + .../webclient/src/main/webapp/stockSale.jsp | 53 + .../bigbank/webclient/src/main/webapp/summary.jsp | 136 + .../webclient/client/TestAccountService.java | 52 + .../bigbank/webclient/client/TestLoginService.java | 50 + .../java-M1-20060522/java/sampleapps/build.xml | 26 + .../tags/java-M1-20060522/java/sampleapps/pom.xml | 106 + .../java-M1-20060522/java/sampleapps/readme.htm | 20 + .../tags/java-M1-20060522/java/samples/build.xml | 28 + .../java-M1-20060522/java/samples/das/build.xml | 26 + .../java/samples/das/companyweb/build.xml | 52 + .../java/samples/das/companyweb/dastest/db.lck | Bin 0 -> 38 bytes .../samples/das/companyweb/dastest/log/log.ctrl | Bin 0 -> 48 bytes .../samples/das/companyweb/dastest/log/log1.dat | Bin 0 -> 1048576 bytes .../das/companyweb/dastest/log/logmirror.ctrl | Bin 0 -> 48 bytes .../samples/das/companyweb/dastest/seg0/c10.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c101.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c111.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c121.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c130.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c141.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c150.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c161.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c171.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c180.dat | Bin 0 -> 24576 bytes .../samples/das/companyweb/dastest/seg0/c191.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c1a1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c1b1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c1c0.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c1d1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c1e0.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c1f1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c20.dat | Bin 0 -> 24576 bytes .../samples/das/companyweb/dastest/seg0/c200.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c211.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c221.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c230.dat | Bin 0 -> 86016 bytes .../samples/das/companyweb/dastest/seg0/c241.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c251.dat | Bin 0 -> 12288 bytes .../samples/das/companyweb/dastest/seg0/c260.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c271.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c281.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c290.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c2a1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c2b1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c2c1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c2d0.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c2e1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c2f0.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c300.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c31.dat | Bin 0 -> 16384 bytes .../samples/das/companyweb/dastest/seg0/c311.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c320.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c331.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c340.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c351.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c360.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c371.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c380.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c391.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c3a0.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c3b1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c3c0.dat | Bin 0 -> 24576 bytes .../samples/das/companyweb/dastest/seg0/c3d1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c3e0.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c3f1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c400.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c41.dat | Bin 0 -> 16384 bytes .../samples/das/companyweb/dastest/seg0/c411.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c420.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c431.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c440.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c451.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c460.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c471.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c481.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c490.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c4a1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c51.dat | Bin 0 -> 16384 bytes .../samples/das/companyweb/dastest/seg0/c60.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c71.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c81.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/c90.dat | Bin 0 -> 20480 bytes .../samples/das/companyweb/dastest/seg0/ca1.dat | Bin 0 -> 24576 bytes .../samples/das/companyweb/dastest/seg0/cb1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/cc0.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/cd1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/ce1.dat | Bin 0 -> 8192 bytes .../samples/das/companyweb/dastest/seg0/cf0.dat | Bin 0 -> 8192 bytes .../das/companyweb/dastest/service.properties | 22 + .../java/samples/das/companyweb/pom.xml | 42 + .../java/samples/das/companyweb/readme.htm | 810 +++ .../samples/das/companyweb/CompanyClient.java | 154 + .../src/main/resources/CompanyConfig.xml | 48 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../companyweb/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../das/companyweb/src/main/webapp/Company.jsp | 157 + .../src/main/webapp/META-INF/context.xml | 22 + .../das/companyweb/src/main/webapp/WEB-INF/web.xml | 27 + .../tags/java-M1-20060522/java/samples/das/pom.xml | 34 + .../tags/java-M1-20060522/java/samples/pom.xml | 107 + .../java-M1-20060522/java/samples/sca/build.xml | 50 + .../java/samples/sca/calculator/build.xml | 52 + .../java/samples/sca/calculator/pom.xml | 51 + .../java/samples/sca/calculator/readme.htm | 53 + .../src/main/java/calculator/AddService.java | 23 + .../src/main/java/calculator/AddServiceImpl.java | 31 + .../src/main/java/calculator/CalculatorClient.java | 68 + .../main/java/calculator/CalculatorService.java | 33 + .../java/calculator/CalculatorServiceImpl.java | 70 + .../src/main/java/calculator/DivideService.java | 23 + .../main/java/calculator/DivideServiceImpl.java | 31 + .../src/main/java/calculator/MultiplyService.java | 23 + .../main/java/calculator/MultiplyServiceImpl.java | 31 + .../src/main/java/calculator/SubtractService.java | 23 + .../main/java/calculator/SubtractServiceImpl.java | 31 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../calculator/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/logging.properties | 27 + .../sca/calculator/src/main/resources/sca.module | 46 + .../test/java/calculator/CalculatorTestCase.java | 65 + .../java/samples/sca/customerinfo/build.xml | 58 + .../java/samples/sca/customerinfo/pom.xml | 52 + .../java/samples/sca/customerinfo/readme.htm | 61 + .../main/java/customerinfo/CustomerInfoClient.java | 72 + .../java/customerinfo/CustomerInfoServiceImpl.java | 41 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/logging.properties | 27 + .../sca/customerinfo/src/main/resources/sca.module | 27 + .../src/main/resources/wsdl/customer.xsd | 26 + .../src/main/resources/wsdl/customerinfo.wsdl | 76 + .../java/customerinfo/CustomerInfoTestCase.java | 74 + .../samples/sca/helloworld-jms/client/build.xml | 58 + .../java/samples/sca/helloworld-jms/client/pom.xml | 58 + .../samples/sca/helloworld-jms/client/readme.htm | 100 + .../src/main/java/helloworld/HelloWorldClient.java | 67 + .../main/java/helloworld/HelloWorldService.java | 26 + .../client/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../client/src/main/resources/META-INF/NOTICE | 18 + .../client/src/main/resources/META-INF/README.txt | 35 + .../client/src/main/resources/logging.properties | 27 + .../client/src/main/resources/sca.module | 28 + .../client/src/main/resources/wsdl/helloworld.wsdl | 83 + .../java/samples/sca/helloworld-jms/pom.xml | 35 + .../samples/sca/helloworld-jms/server/activemq.xml | 100 + .../samples/sca/helloworld-jms/server/build.xml | 58 + .../java/samples/sca/helloworld-jms/server/pom.xml | 52 + .../samples/sca/helloworld-jms/server/readme.htm | 108 + .../src/main/java/helloworld/HelloWorldImpl.java | 31 + .../src/main/java/helloworld/HelloWorldServer.java | 49 + .../main/java/helloworld/HelloWorldService.java | 26 + .../server/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../server/src/main/resources/META-INF/NOTICE | 18 + .../server/src/main/resources/META-INF/README.txt | 35 + .../server/src/main/resources/sca.module | 38 + .../server/src/main/resources/wsdl/helloworld.wsdl | 99 + .../java/samples/sca/helloworld/build.xml | 52 + .../java/samples/sca/helloworld/pom.xml | 51 + .../java/samples/sca/helloworld/readme.htm | 54 + .../src/main/java/helloworld/HelloWorldClient.java | 55 + .../src/main/java/helloworld/HelloWorldImpl.java | 31 + .../main/java/helloworld/HelloWorldService.java | 26 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../helloworld/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../sca/helloworld/src/main/resources/sca.module | 24 + .../test/java/helloworld/HelloWorldTestCase.java | 67 + .../java/samples/sca/helloworlde4xws/build.xml | 49 + .../java/samples/sca/helloworlde4xws/pom.xml | 49 + .../java/samples/sca/helloworlde4xws/readme.htm | 110 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../helloworld/HelloWorldImpl.componentType | 9 + .../main/resources/helloworld/HelloWorldImpl.js | 28 + .../helloworlde4xws/src/main/resources/sca.module | 34 + .../src/main/resources/wsdl/helloworld.wsdl | 75 + .../src/main/webapp/WEB-INF/web.xml | 24 + .../java/samples/sca/helloworldjsclient/build.xml | 49 + .../java/samples/sca/helloworldjsclient/pom.xml | 56 + .../java/samples/sca/helloworldjsclient/readme.htm | 110 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/sca.module | 49 + .../src/main/resources/wsdl/helloworld.wsdl | 75 + .../src/main/webapp/HelloWorldClient.html | 50 + .../src/main/webapp/WEB-INF/web.xml | 27 + .../java/samples/sca/helloworldjsonrpc/build.xml | 52 + .../java/samples/sca/helloworldjsonrpc/pom.xml | 57 + .../java/samples/sca/helloworldjsonrpc/readme.htm | 139 + .../helloworldjsonrpc/HelloWorldService.java | 26 + .../HelloWorldServiceComponentImpl.java | 34 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/sca.module | 32 + .../src/main/webapp/HelloWorldJSONRPC.html | 48 + .../src/main/webapp/WEB-INF/web.xml | 27 + .../java/samples/sca/helloworldweb/build.xml | 52 + .../java/samples/sca/helloworldweb/pom.xml | 51 + .../java/samples/sca/helloworldweb/readme.htm | 248 + .../src/main/java/helloworld/HelloWorldImpl.java | 31 + .../main/java/helloworld/HelloWorldService.java | 26 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../helloworldweb/src/main/resources/sca.module | 24 + .../src/main/webapp/HelloWorldWeb.jsp | 79 + .../helloworldweb/src/main/webapp/WEB-INF/web.xml | 27 + .../test/java/helloworld/HelloWorldTestCase.java | 64 + .../java/samples/sca/helloworldws-celtix/build.xml | 58 + .../java/samples/sca/helloworldws-celtix/pom.xml | 53 + .../samples/sca/helloworldws-celtix/readme.htm | 92 + .../src/main/java/helloworld/HelloWorldImpl.java | 31 + .../src/main/java/helloworld/HelloWorldServer.java | 49 + .../main/java/helloworld/HelloWorldService.java | 26 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/sca.module | 33 + .../src/main/resources/wsdl/helloworld.wsdl | 75 + .../java/samples/sca/helloworldws/build.xml | 52 + .../java/samples/sca/helloworldws/pom.xml | 57 + .../java/samples/sca/helloworldws/readme.htm | 48 + .../src/main/java/helloworld/HelloWorldImpl.java | 31 + .../main/java/helloworld/HelloWorldService.java | 26 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../sca/helloworldws/src/main/resources/sca.module | 33 + .../src/main/resources/wsdl/helloworld.wsdl | 75 + .../helloworldws/src/main/webapp/WEB-INF/web.xml | 23 + .../java/samples/sca/helloworldwsclient/build.xml | 58 + .../java/samples/sca/helloworldwsclient/pom.xml | 61 + .../java/samples/sca/helloworldwsclient/readme.htm | 64 + .../src/main/java/helloworld/HelloWorldClient.java | 67 + .../main/java/helloworld/HelloWorldService.java | 26 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/logging.properties | 27 + .../src/main/resources/sca.module | 28 + .../src/main/resources/wsdl/helloworld.wsdl | 75 + .../tags/java-M1-20060522/java/samples/sca/pom.xml | 45 + .../java-M1-20060522/java/samples/sca/readme.htm | 95 + .../java/samples/sca/supplychain/build.xml | 52 + .../java/samples/sca/supplychain/pom.xml | 52 + .../java/samples/sca/supplychain/readme.htm | 71 + .../src/main/java/supplychain/Customer.java | 31 + .../java/supplychain/CustomerComponentImpl.java | 44 + .../src/main/java/supplychain/Retailer.java | 26 + .../java/supplychain/RetailerComponentImpl.java | 39 + .../src/main/java/supplychain/Shipper.java | 26 + .../java/supplychain/ShipperComponentImpl.java | 39 + .../main/java/supplychain/SupplyChainClient.java | 57 + .../src/main/java/supplychain/Warehouse.java | 26 + .../java/supplychain/WarehouseComponentImpl.java | 39 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../supplychain/src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/logging.properties | 27 + .../sca/supplychain/src/main/resources/sca.module | 48 + .../supplychain/SupplyChainClientTestCase.java | 51 + .../java/sca/bindings/binding.axis2/pom.xml | 150 + .../axis2/assembly/WebServiceAssemblyFactory.java | 31 + .../binding/axis2/assembly/WebServiceBinding.java | 75 + .../impl/WebServiceAssemblyFactoryImpl.java | 42 + .../axis2/assembly/impl/WebServiceBindingImpl.java | 176 + .../axis2/builder/ExternalWebServiceBuilder.java | 146 + .../builder/ExternalWebServiceWireBuilder.java | 36 + .../axis2/builder/WebServiceEntryPointBuilder.java | 49 + .../axis2/config/WSEntryPointContextFactory.java | 276 + .../config/WSExternalServiceContextFactory.java | 34 + ...bServiceEntryPointInOutSyncMessageReceiver.java | 101 + .../entrypoint/WebServiceEntryPointServlet.java | 113 + .../externalservice/Axis2OperationInvoker.java | 114 + .../axis2/externalservice/Axis2ServiceInvoker.java | 60 + .../axis2/loader/WebServiceBindingLoader.java | 72 + .../tuscany/binding/axis2/util/SDODataBinding.java | 104 + .../axis2/util/TuscanyAxisConfigurator.java | 88 + .../axis2/util/WebServiceOperationMetaData.java | 499 ++ .../binding/axis2/util/WebServicePortMetaData.java | 400 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../tuscany/binding/axis2/engine/config/axis2.xml | 183 + .../src/main/resources/system.fragment | 37 + .../account/services/account/AccountReport.java | 32 + .../account/services/account/AccountService.java | 25 + .../services/account/AccountServiceImpl.java | 53 + .../account/services/account/AccountSummary.java | 46 + .../services/accountdata/AccountDataService.java | 26 + .../accountdata/AccountDataServiceImpl.java | 48 + .../services/accountdata/CheckingAccount.java | 39 + .../services/accountdata/SavingsAccount.java | 39 + .../account/services/accountdata/StockAccount.java | 48 + .../services/stockquote/StockQuoteService.java | 24 + .../builder/ExternalWebServiceBuilderTestCase.java | 379 + .../binding/axis2/handler/HelloWorldService.java | 26 + .../handler/HelloWorldServiceComponentImpl.java | 44 + .../binding/axis2/util/SDODataBindingTestCase.java | 123 + .../account/services/account/AccountService.wsdl | 78 + .../services/stockquote/StockQuoteWebService.wsdl | 98 + .../binding/axis2/assembly/tests/sca.module | 60 + .../tuscany/binding/axis2/builder/helloworld.wsdl | 103 + .../tuscany/binding/axis2/handler/helloworld.wsdl | 103 + .../tuscany/binding/axis2/handler/sca.module | 34 + .../binding/axis2/mediator/tests/DocLit.wsdl | 76 + .../axis2/mediator/tests/DocLitWrapped.wsdl | 83 + .../binding/axis2/mediator/tests/RpcLit.wsdl | 75 + .../binding/axis2/mediator/tests/sca.module | 20 + .../binding/axis2/util/CreditScoreDocLit.wsdl | 76 + .../axis2/util/CreditScoreDocLitWrapped.wsdl | 78 + .../tuscany/binding/axis2/util/helloworld.wsdl | 106 + .../java/sca/bindings/binding.celtix/.checkstyle | 6 + .../java/sca/bindings/binding.celtix/.pmd | 2 + .../java/sca/bindings/binding.celtix/.ruleset | 172 + .../sca/bindings/binding.celtix/checkstyle.xml | 279 + .../java/sca/bindings/binding.celtix/pom.xml | 165 + .../celtix/assembly/WebServiceAssemblyFactory.java | 32 + .../binding/celtix/assembly/WebServiceBinding.java | 80 + .../impl/WebServiceAssemblyFactoryImpl.java | 43 + .../assembly/impl/WebServiceBindingImpl.java | 184 + .../celtix/builder/ExternalWebServiceBuilder.java | 48 + .../builder/ExternalWebServiceWireBuilder.java | 35 + .../builder/WebServiceEntryPointBuilder.java | 47 + .../config/ExternalWebServiceContextFactory.java | 35 + .../config/WebServiceEntryPointContextFactory.java | 58 + .../handler/CeltixEntryPointContextImpl.java | 263 + .../celtix/handler/ExternalWebServiceClient.java | 199 + .../handler/ExternalWebServiceTargetInvoker.java | 115 + .../binding/celtix/handler/io/NodeDataReader.java | 170 + .../binding/celtix/handler/io/NodeDataWriter.java | 179 + .../handler/io/RawByteArrayOutputStream.java | 28 + .../celtix/handler/io/SCADataBindingCallback.java | 91 + .../handler/io/SCAServerDataBindingCallback.java | 61 + .../binding/celtix/loader/TuscanyWSDLManager.java | 88 + .../celtix/loader/WebServiceBindingLoader.java | 99 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/system.fragment | 41 + .../WebServiceAssemblyFactoryTestCase.java | 110 + .../celtix/handler/io/NodeDataWriterTestCase.java | 103 + .../loader/WebServiceBindingLoaderTestCase.java | 54 + .../src/test/resources/wsdl/hello_world.wsdl | 178 + .../java/sca/bindings/binding.jsonrpc/pom.xml | 79 + .../binding/jsonrpc/assembly/JSONRPCBinding.java | 39 + .../jsonrpc/builder/JSONRPCEntryPointBuilder.java | 41 + .../config/JSONEntryPointContextFactory.java | 60 + .../jsonrpc/handler/JSONRPCEntryPointServlet.java | 76 + .../jsonrpc/handler/ScriptGetterServlet.java | 51 + .../jsonrpc/loader/JSONRPCBindingLoader.java | 65 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../tuscany/binding/jsonrpc/handler/jsonrpc.js | 484 ++ .../src/main/resources/system.fragment | 28 + .../handler/JSONRPCEntryPointServletTestCase.java | 80 + .../binding/jsonrpc/mocks/MockConfigUtils.java | 88 + .../mocks/servlet/MockHttpServletRequest.java | 263 + .../mocks/servlet/MockHttpServletResponse.java | 180 + .../jsonrpc/mocks/servlet/MockHttpSession.java | 93 + .../jsonrpc/mocks/servlet/MockServletConfig.java | 44 + .../jsonrpc/mocks/servlet/MockServletContext.java | 148 + .../binding/jsonrpc/mocks/tuscany/MockBinding.java | 48 + .../mocks/tuscany/MockCompositeContextImpl.java | 28 + .../mocks/tuscany/MockEntryPointContext.java | 87 + .../jsonrpc/mocks/tuscany/MockScopeContext.java | 119 + .../binding/jsonrpc/assembly/tests/sca.module | 27 + .../java-M1-20060522/java/sca/bindings/pom.xml | 43 + .../java/sca/bindings/sunjars/build.xml | 53 + .../java/sca/bindings/sunjars/pom.xml | 105 + .../tags/java-M1-20060522/java/sca/common/pom.xml | 37 + .../apache/tuscany/common/TuscanyException.java | 133 + .../tuscany/common/TuscanyRuntimeException.java | 134 + .../apache/tuscany/common/monitor/LogLevel.java | 38 + .../tuscany/common/monitor/MonitorFactory.java | 35 + .../common/monitor/impl/InvalidLevelException.java | 60 + .../monitor/impl/JavaLoggingMonitorFactory.java | 186 + .../common/monitor/impl/NullMonitorFactory.java | 48 + .../tuscany/common/resource/ResourceLoader.java | 90 + .../common/resource/impl/GeneratedClassLoader.java | 45 + .../common/resource/impl/ResourceLoaderImpl.java | 137 + .../common/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../sca/common/src/main/resources/META-INF/NOTICE | 18 + .../common/src/main/resources/META-INF/README.txt | 35 + .../org.apache.tuscany.common.logging.LogProvider | 1 + ...y.common.resource.loader.ResourceLoaderProvider | 1 + .../common/monitor/impl/JavaLoggingTestCase.java | 163 + .../apache/tuscany/common/TestMessages.properties | 16 + .../impl/JavaLoggingTestCase$Monitor.properties | 1 + .../java/sca/containers/container.java/pom.xml | 52 + .../java/assembly/JavaAssemblyFactory.java | 30 + .../java/assembly/JavaImplementation.java | 39 + .../assembly/impl/JavaAssemblyFactoryImpl.java | 45 + .../java/assembly/impl/JavaImplementationImpl.java | 44 + .../java/builder/JavaContextFactoryBuilder.java | 113 + .../java/builder/JavaTargetWireBuilder.java | 38 + .../container/java/config/JavaContextFactory.java | 341 + .../container/java/context/JavaAtomicContext.java | 165 + .../invocation/AbstractJavaComponentInvoker.java | 93 + .../invocation/ScopedJavaComponentInvoker.java | 89 + .../StaticJavaComponentTargetInvoker.java | 50 + .../java/loader/JavaImplementationLoader.java | 165 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../tuscany/container/java/Messages.properties | 25 + .../src/main/resources/system.fragment | 41 + .../container.java/src/main/test/sca.module | 75 + .../assembly/mock/HelloWorldImpl.componentType | 23 + .../java/assembly/mock/HelloWorldImpl.java | 36 + .../java/assembly/mock/HelloWorldService.java | 27 + .../mock/HelloWorldWithFieldProperties.java | 40 + .../java/assembly/mock/NakedHelloWorld.java | 26 + .../mock/NakedHelloWorldWithInterface.java | 28 + .../account/services/account/AccountReport.java | 32 + .../account/services/account/AccountService.java | 25 + .../account/services/account/AccountService.wsdl | 78 + .../services/account/AccountServiceImpl.java | 42 + .../account/services/account/AccountSummary.java | 46 + .../services/accountdata/AccountDataService.java | 26 + .../accountdata/AccountDataServiceImpl.java | 48 + .../services/accountdata/CheckingAccount.java | 39 + .../services/accountdata/SavingsAccount.java | 39 + .../account/services/accountdata/StockAccount.java | 48 + .../services/stockquote/StockQuoteService.java | 24 + .../services/stockquote/StockQuoteServiceImpl.java | 28 + .../services/stockquote/StockQuoteWebService.wsdl | 98 + .../builder/JavaContextFactoryBuilderTestCase.java | 112 + .../builder/JavaTargetWireBuilderTestCase.java | 132 + .../container/java/builder/MockHandlerBuilder.java | 120 + .../java/builder/MockInterceptorBuilder.java | 66 + .../context/DifferentInterfaceWireTestCase.java | 81 + .../JavaAtomicContextLifecycleTestCase.java | 59 + ...JavaAtomicContextMetadataInjectionTestCase.java | 58 + .../JavaAtomicContextNegativeMetadataTestCase.java | 73 + .../context/JavaAtomicContextScopeTestCase.java | 95 + .../java/context/MultiplicityTestCase.java | 77 + .../java/integration/GreetingProvider.java | 24 + .../java/integration/GreetingProviderImpl.java | 42 + .../container/java/integration/HelloWorldImpl.java | 29 + .../java/integration/HelloWorldMCImpl.java | 61 + .../java/integration/HelloWorldMCTestCase.java | 59 + .../java/integration/HelloWorldService.java | 24 + .../java/integration/HelloWorldTestCase.java | 61 + .../JavaBuilderContextIntegrationTestCase.java | 189 + .../java/integration/JavaIntegrationTestCase.java | 68 + .../integration/JavaRuntimeBootstrapTestCase.java | 53 + .../java/integration/StartStopTestCase.java | 68 + .../binding/EPtoExternalServiceTestCase.java | 99 + .../binding/EntryPointToJavaTestCase.java | 261 + .../ExternalServiceProxyInvokeTestCase.java | 73 + .../binding/JavaToExternalServiceTestCase.java | 61 + .../context/ScopeReferenceTestCase.java | 741 ++ .../java/invocation/MediationTestCase.java | 53 + .../java/invocation/ScopedPojoInvokerTestCase.java | 53 + .../java/invocation/StaticPojoInvokerTestCase.java | 154 + .../java/invocation/mock/MockHandler.java | 38 + .../java/invocation/mock/MockSyncInterceptor.java | 45 + .../java/invocation/mock/SimpleSource.java | 25 + .../java/invocation/mock/SimpleSourceImpl.java | 36 + .../java/invocation/mock/SimpleTarget.java | 28 + .../java/invocation/mock/SimpleTargetImpl.java | 39 + .../loader/JavaImplementationLoaderTestCase.java | 134 + .../container/java/mock/MockConfigContext.java | 64 + .../container/java/mock/MockContextFactory.java | 92 + .../tuscany/container/java/mock/MockFactory.java | 819 +++ .../container/java/mock/MockScopeContext.java | 131 + .../java/mock/binding/foo/FooBinding.java | 58 + .../java/mock/binding/foo/FooBindingBuilder.java | 114 + .../mock/binding/foo/FooBindingWireBuilder.java | 76 + .../container/java/mock/binding/foo/FooClient.java | 37 + .../binding/foo/FooEntryPointContextFactory.java | 31 + .../foo/FooExternalServiceContextFactory.java | 32 + .../foo/FooExternalServiceTargetInvoker.java | 78 + .../mock/components/AbstractGenericComponent.java | 296 + .../java/mock/components/BadContextPojo.java | 26 + .../java/mock/components/BadNamePojo.java | 24 + .../container/java/mock/components/DataObject.java | 38 + .../java/mock/components/GenericComponent.java | 142 + .../java/mock/components/HelloWorldClient.java | 46 + .../java/mock/components/LocalComponentImpl.java | 97 + .../java/mock/components/ModuleScopeComponent.java | 31 + .../ModuleScopeComponentImpl.componentType | 32 + .../mock/components/ModuleScopeComponentImpl.java | 38 + .../ModuleScopeDestroyOnlyComponent.java | 34 + .../components/ModuleScopeEagerInitComponent.java | 39 + .../ModuleScopeEagerInitDestroyComponent.java | 33 + .../ModuleScopeInitDestroyComponent.java | 37 + .../components/ModuleScopeInitOnlyComponent.java | 41 + .../java/mock/components/OtherTarget.java | 27 + .../java/mock/components/OtherTargetImpl.java | 35 + .../java/mock/components/RemotableService.java | 40 + .../java/mock/components/RemotableServiceImpl.java | 61 + .../mock/components/RequestScopeComponent.java | 28 + .../mock/components/RequestScopeComponentImpl.java | 25 + .../RequestScopeDestroyOnlyComponent.java | 36 + .../RequestScopeInitDestroyComponent.java | 36 + .../components/RequestScopeInitOnlyComponent.java | 37 + .../mock/components/SessionScopeComponent.java | 28 + .../mock/components/SessionScopeComponentImpl.java | 28 + .../SessionScopeDestroyOnlyComponent.java | 34 + .../SessionScopeInitDestroyComponent.java | 34 + .../components/SessionScopeInitOnlyComponent.java | 35 + .../container/java/mock/components/Source.java | 32 + .../container/java/mock/components/SourceImpl.java | 63 + .../java/mock/components/StatelessComponent.java | 28 + .../mock/components/StatelessComponentImpl.java | 25 + .../container/java/mock/components/Target.java | 27 + .../container/java/mock/components/TargetImpl.java | 33 + .../java/scopes/BasicModuleScopeTestCase.java | 139 + .../java/scopes/BasicRequestScopeTestCase.java | 158 + .../java/scopes/BasicSessionScopeTestCase.java | 238 + .../java/scopes/BasicStatelessScopeTestCase.java | 129 + .../java/scopes/CompositeScopeTestCase.java | 188 + .../java/scopes/DependencyLifecycleTestCase.java | 93 + .../java/scopes/ModuleScopeLifecycleTestCase.java | 248 + .../container/java/scopes/OrderException.java | 38 + .../java/scopes/OrderedDependentPojo.java | 34 + .../java/scopes/OrderedEagerInitPojo.java | 56 + .../container/java/scopes/OrderedInitPojo.java | 56 + .../java/scopes/RequestScopeLifecycleTestCase.java | 166 + .../java/scopes/RequestScopedOrderedInitPojo.java | 56 + .../java/scopes/SessionScopeLifecycleTestCase.java | 176 + .../java/scopes/SessionScopedOrderedInitPojo.java | 56 + .../src/test/resources/helloworld/example.wsdl | 23 + .../src/test/resources/helloworld/sca.module | 32 + .../src/test/resources/helloworldmc/sca.module | 40 + .../container/java/assembly/tests/sca.module | 54 + .../java/config/ModuleComponentLoaderTest1.module | 24 + .../java/sca/containers/container.rhino/pom.xml | 68 + .../rhino/assembly/JavaScriptImplementation.java | 74 + .../builder/JavaScriptContextFactoryBuilder.java | 132 + .../rhino/builder/JavaScriptTargetWireBuilder.java | 40 + .../rhino/config/JavaScriptContextFactory.java | 114 + .../rhino/context/JavaScriptComponentContext.java | 140 + .../loader/JavaScriptImplementationLoader.java | 168 + .../container/rhino/rhino/E4XDataBinding.java | 108 + .../container/rhino/rhino/RhinoE4XScript.java | 76 + .../tuscany/container/rhino/rhino/RhinoScript.java | 290 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/system.fragment | 32 + .../integration/AbstractJavaScriptTestCase.java | 46 + .../container/rhino/integration/BasicTestCase.java | 27 + .../container/rhino/integration/E4XTestCase.java | 29 + .../container/rhino/integration/HelloWorld.java | 26 + .../rhino/integration/InitializationTestCase.java | 33 + .../rhino/integration/PropertiesTestCase.java | 33 + .../container/rhino/integration/Salutation.java | 25 + .../rhino/integration/ServiceRefsTestCase.java | 27 + .../container/rhino/integration/TestMethods.java | 30 + .../rhino/rhino/RhinoE4XScriptTestCase.java | 89 + .../container/rhino/rhino/RhinoScriptTestCase.java | 186 + .../rhino/rhino/RhinoE4XScriptTestCase.js | 11 + .../container/rhino/rhino/RhinoScriptTestCase.js | 22 + .../tuscany/container/rhino/rhino/helloworld.wsdl | 97 + .../container.rhino/src/test/resources/sca.module | 66 + .../resources/tests/HelloWorldImpl1.componentType | 9 + .../src/test/resources/tests/HelloWorldImpl1.js | 20 + .../resources/tests/HelloWorldImpl2.componentType | 11 + .../src/test/resources/tests/HelloWorldImpl2.js | 20 + .../resources/tests/HelloWorldImpl3a.componentType | 13 + .../src/test/resources/tests/HelloWorldImpl3a.js | 20 + .../resources/tests/HelloWorldImpl4.componentType | 9 + .../src/test/resources/tests/HelloWorldImpl4.js | 26 + .../resources/tests/HelloWorldImpl5.componentType | 9 + .../src/test/resources/tests/HelloWorldImpl5.js | 29 + .../resources/tests/SalutationImpl.componentType | 11 + .../src/test/resources/tests/SalutationImpl.js | 20 + .../src/test/resources/tests/e4x.componentType | 9 + .../src/test/resources/tests/e4x.js | 28 + .../src/test/resources/wsdl/helloworld.wsdl | 97 + .../java-M1-20060522/java/sca/containers/pom.xml | 37 + .../tags/java-M1-20060522/java/sca/core/pom.xml | 107 + .../core/async/builder/AsyncPolicyBuilder.java | 86 + .../core/async/invocation/AsyncInterceptor.java | 108 + .../core/async/work/DefaultWorkManager.java | 68 + .../core/builder/BuilderConfigException.java | 42 + .../tuscany/core/builder/BuilderException.java | 41 + .../tuscany/core/builder/BuilderInitException.java | 39 + .../core/builder/ContextCreationException.java | 41 + .../tuscany/core/builder/ContextFactory.java | 123 + .../core/builder/ContextFactoryBuilder.java | 50 + .../builder/ContextFactoryBuilderRegistry.java | 31 + .../tuscany/core/builder/ContextResolver.java | 29 + .../core/builder/HierarchicalWireBuilder.java | 29 + .../tuscany/core/builder/NoAccessorException.java | 39 + .../apache/tuscany/core/builder/ObjectFactory.java | 35 + .../apache/tuscany/core/builder/PolicyBuilder.java | 28 + .../apache/tuscany/core/builder/PolicyOrderer.java | 26 + .../tuscany/core/builder/SourcePolicyBuilder.java | 31 + .../tuscany/core/builder/SourcePolicyOrderer.java | 32 + .../tuscany/core/builder/TargetPolicyBuilder.java | 29 + .../tuscany/core/builder/TargetPolicyOrderer.java | 28 + .../tuscany/core/builder/UnknownTypeException.java | 42 + .../apache/tuscany/core/builder/WireBuilder.java | 71 + .../impl/ArrayMultiplicityObjectFactory.java | 49 + .../core/builder/impl/AssemblyVisitorImpl.java | 63 + .../impl/ContextFactoryBuilderRegistryImpl.java | 39 + .../core/builder/impl/DefaultWireBuilder.java | 111 + .../core/builder/impl/HierarchicalBuilder.java | 57 + .../impl/ListMultiplicityObjectFactory.java | 45 + .../core/builder/impl/ProxyObjectFactory.java | 42 + .../system/DefaultPolicyBuilderRegistry.java | 102 + .../core/builder/system/PolicyBuilderRegistry.java | 92 + .../tuscany/core/client/BootstrapHelper.java | 138 + .../apache/tuscany/core/client/TuscanyRuntime.java | 182 + .../core/config/ComponentTypeIntrospector.java | 57 + .../core/config/ConfigurationException.java | 44 + .../core/config/ConfigurationLoadException.java | 59 + .../tuscany/core/config/ImplementationCache.java | 46 + .../core/config/InvalidMetaDataException.java | 35 + .../core/config/InvalidRootElementException.java | 45 + .../core/config/InvalidSetterException.java | 39 + .../core/config/JavaIntrospectionHelper.java | 446 ++ .../tuscany/core/config/MetaDataException.java | 37 + .../core/config/MissingInterfaceException.java | 39 + .../core/config/MissingResourceException.java | 35 + .../config/ModuleComponentConfigurationLoader.java | 75 + .../tuscany/core/config/SidefileLoadException.java | 50 + ...AbstractModuleComponentConfigurationLoader.java | 164 + .../impl/Java5ComponentTypeIntrospector.java | 139 + ...StAXModuleComponentConfigurationLoaderImpl.java | 91 + .../config/processor/ComponentNameProcessor.java | 51 + .../core/config/processor/ContextProcessor.java | 50 + .../core/config/processor/DefaultProcessor.java | 112 + .../core/config/processor/DestroyProcessor.java | 47 + .../processor/ImplementationProcessorSupport.java | 107 + .../core/config/processor/InitProcessor.java | 43 + .../core/config/processor/ProcessorHelper.java | 59 + .../core/config/processor/ProcessorUtils.java | 65 + .../core/config/processor/PropertyProcessor.java | 104 + .../processor/PropertyReferenceValidator.java | 80 + .../core/config/processor/ReferenceProcessor.java | 119 + .../core/config/processor/ScopeProcessor.java | 74 + .../core/config/processor/ServiceProcessor.java | 129 + .../apache/tuscany/core/context/AtomicContext.java | 55 + .../tuscany/core/context/AutowireContext.java | 47 + .../core/context/AutowireResolutionException.java | 40 + .../tuscany/core/context/CompositeContext.java | 91 + .../tuscany/core/context/ConfigurationContext.java | 30 + .../org/apache/tuscany/core/context/Context.java | 46 + .../tuscany/core/context/ContextInitException.java | 43 + .../core/context/ContextRuntimeException.java | 39 + .../tuscany/core/context/CoreRuntimeException.java | 43 + .../core/context/DuplicateNameException.java | 39 + .../tuscany/core/context/EntryPointContext.java | 69 + .../apache/tuscany/core/context/EventContext.java | 46 + .../tuscany/core/context/EventException.java | 43 + .../apache/tuscany/core/context/EventFilter.java | 32 + .../tuscany/core/context/EventPublisher.java | 44 + .../core/context/ExternalServiceContext.java | 30 + .../tuscany/core/context/InvalidNameException.java | 43 + .../org/apache/tuscany/core/context/Lifecycle.java | 79 + .../context/MissingContextFactoryException.java | 42 + .../context/MissingImplementationException.java | 42 + .../core/context/MissingScopeException.java | 42 + .../core/context/ProxyConfigurationException.java | 42 + .../apache/tuscany/core/context/QualifiedName.java | 84 + .../tuscany/core/context/RuntimeEventListener.java | 32 + .../tuscany/core/context/ScopeAwareContext.java | 31 + .../apache/tuscany/core/context/ScopeContext.java | 74 + .../tuscany/core/context/ScopeIdentifier.java | 33 + .../core/context/ScopeInitializationException.java | 42 + .../core/context/ScopeRuntimeException.java | 43 + .../apache/tuscany/core/context/ScopeStrategy.java | 43 + .../core/context/ServiceNotFoundException.java | 42 + .../core/context/SystemCompositeContext.java | 37 + .../tuscany/core/context/TargetException.java | 42 + .../tuscany/core/context/event/AbstractEvent.java | 33 + .../core/context/event/AbstractRequestEvent.java | 43 + .../apache/tuscany/core/context/event/Event.java | 28 + .../core/context/event/HttpSessionBound.java | 33 + .../tuscany/core/context/event/HttpSessionEnd.java | 32 + .../core/context/event/HttpSessionEvent.java | 47 + .../core/context/event/InstanceCreated.java | 27 + .../tuscany/core/context/event/ModuleEvent.java | 23 + .../tuscany/core/context/event/ModuleStart.java | 26 + .../tuscany/core/context/event/ModuleStop.java | 29 + .../tuscany/core/context/event/RequestEnd.java | 33 + .../tuscany/core/context/event/RequestEvent.java | 26 + .../tuscany/core/context/event/RequestStart.java | 32 + .../tuscany/core/context/event/SessionBound.java | 23 + .../tuscany/core/context/event/SessionEnd.java | 23 + .../tuscany/core/context/event/SessionEvent.java | 34 + .../tuscany/core/context/event/SessionStart.java | 26 + .../tuscany/core/context/filter/TrueFilter.java | 32 + .../context/impl/AbstractCompositeContext.java | 852 +++ .../tuscany/core/context/impl/AbstractContext.java | 45 + .../core/context/impl/AbstractLifecycle.java | 129 + .../core/context/impl/CompositeContextImpl.java | 113 + .../core/context/impl/EntryPointContextImpl.java | 90 + .../core/context/impl/EventContextImpl.java | 81 + .../context/impl/ExternalServiceContextImpl.java | 75 + .../core/context/scope/AbstractScopeContext.java | 74 + .../core/context/scope/AbstractScopeStrategy.java | 67 + .../core/context/scope/CompositeScopeContext.java | 156 + .../core/context/scope/DefaultScopeStrategy.java | 52 + .../core/context/scope/ModuleScopeContext.java | 194 + .../core/context/scope/RequestScopeContext.java | 228 + .../core/context/scope/SessionScopeContext.java | 258 + .../core/context/scope/StatelessScopeContext.java | 132 + .../core/extension/ComponentTargetInvoker.java | 122 + .../extension/ContextFactoryBuilderSupport.java | 174 + .../core/extension/EntryPointBuilderSupport.java | 111 + .../core/extension/EntryPointContextFactory.java | 111 + .../extension/ExternalServiceBuilderSupport.java | 112 + .../extension/ExternalServiceContextFactory.java | 121 + .../core/extension/ExternalServiceInvoker.java | 23 + .../extension/ExternalServiceTargetInvoker.java | 122 + .../tuscany/core/extension/WireBuilderSupport.java | 102 + .../extension/config/ImplementationProcessor.java | 65 + .../config/InjectorExtensibilityElement.java | 32 + .../extension/config/JavaExtensibilityElement.java | 25 + .../ComponentNameExtensibilityElement.java | 52 + .../extensibility/ContextExtensibilityElement.java | 52 + .../DestroyInvokerExtensibilityElement.java | 29 + .../InitInvokerExtensibilityElement.java | 37 + .../extensibility/InvokerExtensibilityElement.java | 42 + .../core/injection/ContextObjectFactory.java | 41 + .../tuscany/core/injection/EventInvoker.java | 33 + .../core/injection/FactoryInitException.java | 43 + .../tuscany/core/injection/FieldInjector.java | 53 + .../core/injection/InjectionRuntimeException.java | 45 + .../apache/tuscany/core/injection/Injector.java | 33 + .../injection/InterCompositeReferenceFactory.java | 75 + .../tuscany/core/injection/JNDIObjectFactory.java | 46 + .../tuscany/core/injection/MethodEventInvoker.java | 47 + .../tuscany/core/injection/MethodInjector.java | 48 + .../core/injection/NonProxiedTargetFactory.java | 54 + .../tuscany/core/injection/NullEventInvoker.java | 30 + .../core/injection/ObjectCallbackException.java | 42 + .../core/injection/ObjectCreationException.java | 43 + .../tuscany/core/injection/PojoObjectFactory.java | 76 + .../core/injection/SingletonObjectFactory.java | 37 + .../loader/InvalidPropertyFactoryException.java | 46 + .../apache/tuscany/core/loader/LoaderContext.java | 47 + .../tuscany/core/loader/StAXElementLoader.java | 40 + .../tuscany/core/loader/StAXLoaderRegistry.java | 91 + .../tuscany/core/loader/StAXPropertyFactory.java | 42 + .../org/apache/tuscany/core/loader/StAXUtil.java | 160 + .../core/loader/WSDLDefinitionRegistry.java | 95 + .../core/loader/assembly/AbstractLoader.java | 61 + .../core/loader/assembly/AssemblyConstants.java | 47 + .../core/loader/assembly/ComponentLoader.java | 189 + .../core/loader/assembly/ComponentTypeLoader.java | 65 + .../core/loader/assembly/CompositeLoader.java | 62 + .../core/loader/assembly/EntryPointLoader.java | 90 + .../loader/assembly/ExternalServiceLoader.java | 75 + .../core/loader/assembly/ImportWSDLLoader.java | 95 + .../core/loader/assembly/InterfaceJavaLoader.java | 45 + .../core/loader/assembly/InterfaceWSDLLoader.java | 110 + .../core/loader/assembly/ModuleFragmentLoader.java | 42 + .../tuscany/core/loader/assembly/ModuleLoader.java | 50 + .../core/loader/assembly/PropertyLoader.java | 79 + .../core/loader/assembly/ReferenceLoader.java | 64 + .../core/loader/assembly/ServiceLoader.java | 61 + .../tuscany/core/loader/assembly/WireLoader.java | 84 + .../core/loader/impl/JNDIPropertyFactory.java | 62 + .../core/loader/impl/StAXLoaderRegistryImpl.java | 105 + .../loader/impl/StringParserPropertyFactory.java | 110 + .../loader/impl/WSDLDefinitionRegistryImpl.java | 202 + .../core/loader/system/SystemBindingLoader.java | 47 + .../loader/system/SystemImplementationLoader.java | 68 + .../org/apache/tuscany/core/message/Message.java | 58 + .../tuscany/core/message/MessageFactory.java | 29 + .../core/message/impl/MessageFactoryImpl.java | 44 + .../tuscany/core/message/impl/MessageImpl.java | 86 + .../tuscany/core/runtime/RuntimeContext.java | 62 + .../tuscany/core/runtime/RuntimeContextImpl.java | 221 + .../tuscany/core/runtime/RuntimeMonitor.java | 32 + .../tuscany/core/runtime/RuntimeScopeStrategy.java | 46 + .../tuscany/core/sdo/DataFactoryObjectFactory.java | 61 + .../tuscany/core/sdo/TypeHelperObjectFactory.java | 61 + .../tuscany/core/sdo/XMLHelperObjectFactory.java | 61 + .../tuscany/core/sdo/XSDHelperObjectFactory.java | 62 + .../apache/tuscany/core/sdo/helper/SDOHelper.java | 40 + .../sdo/helper/SDOHelperExtensibilityElement.java | 80 + .../core/sdo/helper/SDOHelperProcessor.java | 78 + .../tuscany/core/system/annotation/Autowire.java | 31 + .../tuscany/core/system/annotation/Monitor.java | 32 + .../core/system/annotation/ParentContext.java | 32 + .../system/assembly/SystemAssemblyFactory.java | 66 + .../core/system/assembly/SystemBinding.java | 37 + .../core/system/assembly/SystemImplementation.java | 38 + .../tuscany/core/system/assembly/SystemModule.java | 34 + .../assembly/impl/SystemAssemblyFactoryImpl.java | 84 + .../system/assembly/impl/SystemBindingImpl.java | 41 + .../assembly/impl/SystemImplementationImpl.java | 45 + .../system/assembly/impl/SystemModuleImpl.java | 174 + .../builder/SystemContextFactoryBuilder.java | 343 + .../system/builder/SystemEntryPointBuilder.java | 67 + .../builder/SystemExternalServiceBuilder.java | 67 + .../core/system/config/SystemContextFactory.java | 208 + .../config/SystemEntryPointContextFactory.java | 99 + .../system/config/SystemExtensibilityElement.java | 23 + .../SystemExternalServiceContextFactory.java | 110 + .../config/SystemInjectorExtensibilityElement.java | 34 + .../system/config/SystemObjectContextFactory.java | 98 + .../AutowireExtensibilityElement.java | 53 + .../extensibility/MonitorExtensibilityElement.java | 58 + .../ParentContextExtensibilityElement.java | 54 + .../system/config/processor/AutowireProcessor.java | 90 + .../system/config/processor/MonitorProcessor.java | 69 + .../config/processor/ParentContextProcessor.java | 72 + .../core/system/context/SystemAtomicContext.java | 159 + .../system/context/SystemCompositeContextImpl.java | 91 + .../system/context/SystemEntryPointContext.java | 82 + .../context/SystemExternalServiceContext.java | 67 + .../core/system/context/SystemScopeStrategy.java | 56 + .../system/injection/AutowireObjectFactory.java | 72 + .../apache/tuscany/core/webapp/ContextBinder.java | 39 + .../tuscany/core/webapp/LazyHTTPSessionId.java | 56 + .../apache/tuscany/core/webapp/ServletHost.java | 58 + .../tuscany/core/webapp/TuscanyRequestFilter.java | 96 + .../core/webapp/TuscanyServletListener.java | 129 + .../org/apache/tuscany/core/wire/Interceptor.java | 42 + .../tuscany/core/wire/InvocationConfiguration.java | 181 + .../core/wire/InvocationRuntimeException.java | 44 + .../apache/tuscany/core/wire/MessageChannel.java | 33 + .../apache/tuscany/core/wire/MessageHandler.java | 34 + .../apache/tuscany/core/wire/MethodHashMap.java | 55 + .../tuscany/core/wire/ProxyCreationException.java | 43 + .../core/wire/SourceInvocationConfiguration.java | 131 + .../tuscany/core/wire/SourceWireFactory.java | 34 + .../core/wire/TargetInvocationConfiguration.java | 49 + .../apache/tuscany/core/wire/TargetInvoker.java | 47 + .../tuscany/core/wire/TargetWireFactory.java | 33 + .../tuscany/core/wire/WireConfiguration.java | 92 + .../apache/tuscany/core/wire/WireException.java | 43 + .../org/apache/tuscany/core/wire/WireFactory.java | 76 + .../tuscany/core/wire/WireFactoryFactory.java | 47 + .../core/wire/WireFactoryInitException.java | 43 + .../tuscany/core/wire/WireSourceConfiguration.java | 68 + .../tuscany/core/wire/WireTargetConfiguration.java | 48 + .../tuscany/core/wire/impl/InvokerInterceptor.java | 46 + .../tuscany/core/wire/impl/MessageChannelImpl.java | 68 + .../tuscany/core/wire/impl/MessageDispatcher.java | 46 + .../tuscany/core/wire/impl/NullWireFactory.java | 71 + .../tuscany/core/wire/impl/OneWayInterceptor.java | 48 + .../core/wire/impl/RequestResponseInterceptor.java | 73 + .../core/wire/jdk/JDKInvocationHandler.java | 137 + .../core/wire/jdk/JDKSourceWireFactory.java | 92 + .../core/wire/jdk/JDKTargetWireFactory.java | 95 + .../core/wire/jdk/JDKWireFactoryFactory.java | 66 + .../wire/service/DefaultWireFactoryService.java | 157 + .../core/wire/service/WireFactoryService.java | 51 + .../core/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../sca/core/src/main/resources/META-INF/NOTICE | 18 + .../core/src/main/resources/META-INF/README.txt | 35 + ....tuscany.core.runtime.proxy.ServiceProxyFactory | 1 + .../core/src/main/resources/model/anyobject.xsd | 35 + .../src/main/resources/model/tuscany-system.xsd | 53 + .../apache/tuscany/core/MonitorMessages.properties | 23 + .../java/sca/core/src/main/resources/system.module | 93 + .../AsyncInvocationConfigurationTestCase.java | 197 + .../tuscany/core/async/wire/mock/MockHandler.java | 38 + .../core/async/wire/mock/MockStaticInvoker.java | 86 + .../core/async/wire/mock/MockSyncInterceptor.java | 45 + .../tuscany/core/async/wire/mock/SimpleTarget.java | 28 + .../core/async/wire/mock/SimpleTargetImpl.java | 54 + .../async/work/DefaultWorkManagerTestCase.java | 98 + .../async/work/GeronimoWorkManagerTestCase.java | 138 + .../builder/impl/DefaultWireBuilderTestCase.java | 465 ++ .../impl/NegativeDefaultWireBuilderTestCase.java | 89 + .../java/org/apache/tuscany/core/config/Bean1.java | 45 + .../java/org/apache/tuscany/core/config/Bean2.java | 46 + .../config/JavaIntrospectionHelperTestCase.java | 163 + .../org/apache/tuscany/core/config/SuperBean.java | 48 + .../impl/CoreAnnotationsProcessingTestCase.java | 173 + .../core/config/impl/ScopeTestComponent.java | 24 + .../tuscany/core/config/impl/ScopedParent.java | 26 + .../apache/tuscany/core/config/impl/SuperFoo.java | 23 + .../tuscany/core/config/impl/SuperFooImpl.java | 26 + .../tuscany/core/config/impl/SuperSuperFoo.java | 23 + .../core/config/impl/SuperSuperFooImpl.java | 20 + .../tuscany/core/config/impl/TestComponent.java | 30 + .../core/config/impl/TestComponentImpl.java | 66 + .../core/config/impl/TestLocalComponent.java | 29 + .../core/config/impl/TestLocalComponentImpl.java | 32 + .../impl/TestMultipleInterfacesComponentImpl.java | 29 + .../core/config/impl/TestNonServiceInterface.java | 20 + .../core/config/impl/TestNonServiceInterface2.java | 23 + .../config/impl/TestNonServiceInterfacesImpl.java | 23 + .../config/impl/TestNonServiceSpecifiedImpl.java | 28 + .../context/AbstractCompositeHierarchyTests.java | 109 + .../context/CompositeContextRegisterTestCase.java | 132 + .../core/context/CompositeHierarchyTestCase.java | 99 + .../core/context/QualifiedNameTestCase.java | 52 + .../scope/DefaultScopeStrategyTestCase.java | 51 + .../extension/ContextFactorySupportTestCase.java | 80 + .../EntryPointBuilderSupportTestCase.java | 78 + .../ExternalServiceBuilderSupportTestCase.java | 80 + .../core/extension/WireBuilderSupportTestCase.java | 261 + .../IntraCompositeWireIntegrationTestCase.java | 107 + .../core/loader/JNDIPropertyFactoryTestCase.java | 210 + .../tuscany/core/loader/MockReaderSupport.java | 210 + .../core/loader/StAXLoaderRegistryTestCase.java | 145 + .../StringParserPropertyFactoryTestCase.java | 111 + .../loader/assembly/ComponentLoaderTestCase.java | 151 + .../assembly/ComponentTypeLoaderTestCase.java | 49 + .../loader/assembly/EntryPointLoaderTestCase.java | 63 + .../assembly/ExternalServiceLoaderTestCase.java | 64 + ...InterfaceWSDLLoaderInterfaceStylesTestCase.java | 101 + .../assembly/InterfaceWSDLLoaderTestCase.java | 88 + .../core/loader/assembly/LoaderTestSupport.java | 82 + .../tuscany/core/loader/assembly/MockService.java | 23 + .../assembly/WSDLDefinitionRegistryTestCase.java | 76 + .../core/loader/assembly/WireLoaderTestCase.java | 60 + .../tuscany/core/mock/MockConfigContext.java | 53 + .../org/apache/tuscany/core/mock/MockFactory.java | 413 ++ .../core/mock/component/AutowireSourceImpl.java | 64 + .../mock/component/GenericSystemComponent.java | 22 + .../mock/component/ModuleScopeSystemComponent.java | 28 + .../component/ModuleScopeSystemComponentImpl.java | 25 + .../apache/tuscany/core/mock/component/Source.java | 34 + .../tuscany/core/mock/component/SourceImpl.java | 67 + .../apache/tuscany/core/mock/component/Target.java | 27 + .../tuscany/core/mock/component/TargetImpl.java | 33 + .../tuscany/core/runtime/RuntimeBootTestCase.java | 99 + .../core/runtime/RuntimeContextImplTestCase.java | 286 + .../core/runtime/SystemBootstrapTestCase.java | 127 + .../system/builder/MonitorInjectionTestCase.java | 106 + .../core/system/builder/SystemComponentImpl.java | 167 + .../SystemContextFactoryBuilderTestCase.java | 173 + .../builder/impl/AssemblyVisitorTestCase.java | 136 + .../core/system/context/AutowireTestCase.java | 310 + .../system/context/CompositeNestingTestCase.java | 98 + .../system/context/IntraCompositeWireTestCase.java | 125 + .../SystemCompositeComponentContextTestCase.java | 108 + .../SystemCompositeContextRegisterTestCase.java | 37 + .../context/SystemCompositeHierarchyTestCase.java | 46 + .../context/SystemObjectRegistrationTestCase.java | 84 + .../tuscany/core/system/context/TestBuilder.java | 55 + .../wire/InvocationConfigurationErrorTestCase.java | 155 + .../core/wire/InvocationConfigurationTestCase.java | 153 + .../tuscany/core/wire/InvocationErrorTestCase.java | 122 + .../wire/jdk/JDKInvocationHandlerTestCase.java | 126 + .../wire/jdk/JDKWireFactoryFactoryTestCase.java | 83 + .../apache/tuscany/core/wire/mock/MockHandler.java | 38 + .../tuscany/core/wire/mock/MockScopeContext.java | 131 + .../tuscany/core/wire/mock/MockStaticInvoker.java | 86 + .../core/wire/mock/MockSyncInterceptor.java | 45 + .../tuscany/core/wire/mock/SimpleSource.java | 25 + .../tuscany/core/wire/mock/SimpleSourceImpl.java | 36 + .../tuscany/core/wire/mock/SimpleTarget.java | 28 + .../tuscany/core/wire/mock/SimpleTargetImpl.java | 39 + .../core/config/ModuleComponentLoaderTest1.module | 24 + .../tuscany/core/loader/assembly/example.wsdl | 23 + .../tuscany/core/loader/assembly/example.xsd | 23 + .../core/loader/assembly/interfacestyles.wsdl | 239 + .../sca/core/src/test/resources/system.fragment | 21 + .../java-M1-20060522/java/sca/databinding/pom.xml | 36 + .../java/sca/databinding/sdo/pom.xml | 46 + .../tuscany/databinding/sdo/ImportSDOLoader.java | 106 + .../tuscany/databinding/sdo/SDOObjectFactory.java | 45 + .../tuscany/databinding/sdo/SDOXMLHelper.java | 264 + .../sdo/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../sdo/src/main/resources/META-INF/NOTICE | 18 + .../sdo/src/main/resources/META-INF/README.txt | 35 + .../sdo/src/main/resources/system.fragment | 25 + .../databinding/sdo/ImportSDOLoaderTestCase.java | 59 + .../tuscany/databinding/sdo/LoaderTestSupport.java | 82 + .../databinding/sdo/SDOXMLHelperTestCase.java | 141 + .../tuscany/databinding/sdo/CreditScoreDocLit.wsdl | 76 + .../databinding/sdo/CreditScoreDocLitWrapped.wsdl | 78 + .../apache/tuscany/databinding/sdo/helloworld.wsdl | 106 + .../tags/java-M1-20060522/java/sca/model/pom.xml | 77 + .../tuscany/model/ModelRuntimeException.java | 42 + .../tuscany/model/assembly/AssemblyContext.java | 64 + .../tuscany/model/assembly/AssemblyFactory.java | 260 + .../assembly/AssemblyInitializationException.java | 46 + .../tuscany/model/assembly/AssemblyObject.java | 45 + .../tuscany/model/assembly/AssemblyVisitor.java | 32 + .../tuscany/model/assembly/AtomicComponent.java | 25 + .../model/assembly/AtomicImplementation.java | 28 + .../org/apache/tuscany/model/assembly/Binding.java | 40 + .../apache/tuscany/model/assembly/Component.java | 81 + .../tuscany/model/assembly/ComponentType.java | 66 + .../apache/tuscany/model/assembly/Composite.java | 94 + .../tuscany/model/assembly/CompositeComponent.java | 35 + .../tuscany/model/assembly/ConfiguredPort.java | 63 + .../tuscany/model/assembly/ConfiguredProperty.java | 74 + .../model/assembly/ConfiguredReference.java | 44 + .../tuscany/model/assembly/ConfiguredService.java | 25 + .../model/assembly/ContextFactoryHolder.java | 34 + .../apache/tuscany/model/assembly/EntryPoint.java | 67 + .../apache/tuscany/model/assembly/Extensible.java | 37 + .../tuscany/model/assembly/ExternalService.java | 59 + .../tuscany/model/assembly/Implementation.java | 40 + .../apache/tuscany/model/assembly/ImportWSDL.java | 62 + .../org/apache/tuscany/model/assembly/Module.java | 40 + .../tuscany/model/assembly/ModuleComponent.java | 24 + .../tuscany/model/assembly/ModuleFragment.java | 25 + .../tuscany/model/assembly/Multiplicity.java | 46 + .../tuscany/model/assembly/OverrideOption.java | 39 + .../org/apache/tuscany/model/assembly/Part.java | 49 + .../org/apache/tuscany/model/assembly/Port.java | 47 + .../apache/tuscany/model/assembly/Property.java | 91 + .../tuscany/model/assembly/ProxyFactoryHolder.java | 34 + .../apache/tuscany/model/assembly/Reference.java | 36 + .../org/apache/tuscany/model/assembly/Scope.java | 31 + .../org/apache/tuscany/model/assembly/Service.java | 24 + .../tuscany/model/assembly/ServiceContract.java | 60 + .../apache/tuscany/model/assembly/ServiceURI.java | 58 + .../apache/tuscany/model/assembly/Subsystem.java | 38 + .../org/apache/tuscany/model/assembly/Wire.java | 48 + .../model/assembly/impl/AssemblyContextImpl.java | 88 + .../model/assembly/impl/AssemblyFactoryImpl.java | 217 + .../model/assembly/impl/AssemblyObjectImpl.java | 123 + .../model/assembly/impl/AtomicComponentImpl.java | 30 + .../assembly/impl/AtomicImplementationImpl.java | 29 + .../tuscany/model/assembly/impl/BindingImpl.java | 62 + .../tuscany/model/assembly/impl/ComponentImpl.java | 213 + .../model/assembly/impl/ComponentTypeImpl.java | 147 + .../tuscany/model/assembly/impl/CompositeImpl.java | 357 + .../model/assembly/impl/ConfiguredPortImpl.java | 106 + .../assembly/impl/ConfiguredPropertyImpl.java | 102 + .../assembly/impl/ConfiguredReferenceImpl.java | 53 + .../model/assembly/impl/ConfiguredServiceImpl.java | 30 + .../model/assembly/impl/EntryPointImpl.java | 116 + .../model/assembly/impl/ExtensibleImpl.java | 75 + .../model/assembly/impl/ExternalServiceImpl.java | 116 + .../model/assembly/impl/ImplementationImpl.java | 72 + .../model/assembly/impl/ImportWSDLImpl.java | 82 + .../model/assembly/impl/ModuleComponentImpl.java | 41 + .../model/assembly/impl/ModuleFragmentImpl.java | 35 + .../tuscany/model/assembly/impl/ModuleImpl.java | 104 + .../tuscany/model/assembly/impl/PartImpl.java | 61 + .../tuscany/model/assembly/impl/PortImpl.java | 82 + .../tuscany/model/assembly/impl/PropertyImpl.java | 80 + .../tuscany/model/assembly/impl/ReferenceImpl.java | 41 + .../model/assembly/impl/ServiceContractImpl.java | 60 + .../tuscany/model/assembly/impl/ServiceImpl.java | 29 + .../model/assembly/impl/ServiceURIImpl.java | 210 + .../tuscany/model/assembly/impl/SubsystemImpl.java | 51 + .../tuscany/model/assembly/impl/WireImpl.java | 51 + .../model/assembly/loader/AssemblyModelLoader.java | 38 + .../loader/impl/AssemblyModelLoadException.java | 42 + .../loader/impl/SCDLAssemblyModelLoaderImpl.java | 71 + .../model/types/java/JavaServiceContract.java | 34 + .../types/java/impl/JavaServiceContractImpl.java | 89 + .../model/types/wsdl/WSDLServiceContract.java | 51 + .../types/wsdl/impl/WSDLServiceContractImpl.java | 234 + .../apache/tuscany/model/util/NotifyingList.java | 108 + .../org/apache/tuscany/model/util/XMLNameUtil.java | 212 + .../model/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../sca/model/src/main/resources/META-INF/NOTICE | 18 + .../model/src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/model/sca-binding-sca.xsd | 36 + .../resources/model/sca-binding-webservice.xsd | 37 + .../model/src/main/resources/model/sca-core.xsd | 239 + .../resources/model/sca-implementation-java.xsd | 37 + .../main/resources/model/sca-interface-java.xsd | 38 + .../main/resources/model/sca-interface-wsdl.xsd | 69 + .../sca/model/src/main/resources/model/sca.xsd | 33 + .../org/apache/tuscany/model/Messages.properties | 25 + .../account/services/account/AccountReport.java | 32 + .../account/services/account/AccountService.java | 25 + .../account/services/account/AccountService.wsdl | 78 + .../services/account/AccountServiceImpl.java | 42 + .../account/services/account/AccountSummary.java | 46 + .../services/accountdata/AccountDataService.java | 26 + .../accountdata/AccountDataServiceImpl.java | 48 + .../services/accountdata/CheckingAccount.java | 39 + .../services/accountdata/SavingsAccount.java | 39 + .../account/services/accountdata/StockAccount.java | 48 + .../services/stockquote/StockQuoteService.java | 24 + .../services/stockquote/StockQuoteServiceImpl.java | 28 + .../services/stockquote/StockQuoteWebService.wsdl | 98 + .../apache/tuscany/model/assembly/tests/sca.module | 58 + .../tuscany/model/assembly/tests/sca.subsystem | 24 + .../java/sca/plugins/plugin.java2wsdl/pom.xml | 57 + .../java2wsdl/plugin/Java2WSDLGeneratorMojo.java | 156 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../java/sca/plugins/plugin.wsdl2java/pom.xml | 57 + .../wsdl2java/plugin/WSDL2JavaGeneratorMojo.java | 150 + .../tools/wsdl2java/plugin/WSDLFileOption.java | 90 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../tags/java-M1-20060522/java/sca/plugins/pom.xml | 35 + .../tags/java-M1-20060522/java/sca/pom.xml | 70 + .../tags/java-M1-20060522/java/sca/tomcat/pom.xml | 105 + .../org/apache/tuscany/tomcat/ContainerLoader.java | 100 + .../java/org/apache/tuscany/tomcat/TomcatHost.java | 53 + .../tuscany/tomcat/TuscanyContextListener.java | 152 + .../org/apache/tuscany/tomcat/TuscanyHost.java | 185 + .../org/apache/tuscany/tomcat/TuscanyValve.java | 130 + .../org/apache/tuscany/tomcat/TuscanyWrapper.java | 43 + .../tomcat/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../sca/tomcat/src/main/resources/META-INF/NOTICE | 18 + .../tomcat/src/main/resources/META-INF/README.txt | 35 + .../apache/tuscany/tomcat/LocalStrings.properties | 25 + .../org/apache/tuscany/tomcat/Messages.properties | 39 + .../sca/tomcat/src/main/resources/system.fragment | 31 + .../tomcat/integration/AbstractTomcatTest.java | 298 + .../tuscany/tomcat/integration/HelloWorldImpl.java | 29 + .../tomcat/integration/HelloWorldService.java | 24 + .../tomcat/integration/TestClassLoader.java | 51 + .../tuscany/tomcat/integration/TestServlet.java | 60 + .../integration/TomcatIntegrationTestCase.java | 200 + .../integration/TomcatStandaloneTestCase.java | 79 + .../src/test/resources/app1/WEB-INF/axis2.xml | 183 + .../test/resources/app1/WEB-INF/classes/sca.module | 33 + .../app1/WEB-INF/classes/wsdl/helloworld.wsdl | 97 + .../tomcat/src/test/resources/app1/WEB-INF/web.xml | 21 + .../sca/tomcat/src/test/resources/app1/index.html | 18 + .../test/resources/app2/WEB-INF/classes/sca.module | 33 + .../app2/WEB-INF/classes/wsdl/helloworld.wsdl | 97 + .../tomcat/src/test/resources/app2/WEB-INF/web.xml | 45 + .../sca/tomcat/src/test/resources/app2/index.html | 3 + .../tags/java-M1-20060522/java/sca/tools/pom.xml | 155 + .../java2wsdl/generate/GenerationParameters.java | 314 + .../tools/java2wsdl/generate/Java2WSDL.java | 59 + .../java2wsdl/generate/Java2WSDLGenerator.java | 46 + .../generate/Java2WSDLGeneratorFactory.java | 87 + .../java2wsdl/generate/Java2WSDLGeneratorImpl.java | 286 + .../java2wsdl/generate/TuscanyJava2OMBuilder.java | 428 ++ .../generate/TuscanyJava2WSDLBuilder.java | 165 + .../tools/java2wsdl/generate/WSDLGenEvent.java | 36 + .../tools/java2wsdl/generate/WSDLGenListener.java | 37 + .../tools/java2wsdl/generate/WSDLModel.java | 29 + .../wsdl2java/generate/JavaInterfaceEmitter.java | 200 + .../wsdl2java/generate/JavaInterfaceGenerator.java | 219 + .../generate/SDODataBindingCodegenExtension.java | 47 + .../generate/SDODataBindingTypeMappingEntry.java | 49 + .../wsdl2java/generate/WSDL2JavaGenerator.java | 347 + .../tools/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../sca/tools/src/main/resources/META-INF/NOTICE | 18 + .../tools/src/main/resources/META-INF/README.txt | 35 + .../tuscany/tools/java2wsdl/generate/Account.java | 51 + .../tuscany/tools/java2wsdl/generate/Customer.java | 27 + .../tools/java2wsdl/generate/CustomerValue.java | 32 + .../java2wsdl/generate/CustomerWithAccount.java | 44 + .../generate/TuscanyJava2WSDLTestCase.java | 86 + .../generate/WSDL2JavaGeneratorTestCase.java | 42 + .../tools/src/test/resources/AccountService.wsdl | 239 + .../java-M1-20060522/java/sdo/impl/model/SDO.ecore | 962 +++ .../java/sdo/impl/model/SDO.genmodel | 564 ++ .../java-M1-20060522/java/sdo/impl/model/SDO.mdl | 7670 ++++++++++++++++++++ .../tags/java-M1-20060522/java/sdo/impl/pom.xml | 114 + .../org/apache/tuscany/sdo/AnyTypeDataObject.java | 34 + .../apache/tuscany/sdo/SDOExtendedMetaData.java | 35 + .../java/org/apache/tuscany/sdo/SDOFactory.java | 173 + .../java/org/apache/tuscany/sdo/SDOPackage.java | 1599 ++++ .../org/apache/tuscany/sdo/SDOTypeVisitor.java | 46 + .../tuscany/sdo/SimpleAnyTypeDataObject.java | 32 + .../org/apache/tuscany/sdo/XMLStreamHelper.java | 89 + .../sdo/codegen/BytecodeInterfaceGenerator.java | 95 + .../tuscany/sdo/codegen/GenerationException.java | 39 + .../sdo/codegen/JavaInterfaceGenerator.java | 176 + .../sdo/codegen/NoJavaImplementationException.java | 58 + .../apache/tuscany/sdo/helper/CopyHelperImpl.java | 51 + .../apache/tuscany/sdo/helper/DataFactoryImpl.java | 62 + .../apache/tuscany/sdo/helper/DataHelperImpl.java | 303 + .../tuscany/sdo/helper/EqualityHelperImpl.java | 67 + .../tuscany/sdo/helper/HelperProviderImpl.java | 110 + .../sdo/helper/SDOExtendedMetaDataImpl.java | 96 + .../tuscany/sdo/helper/SDOXSDEcoreBuilder.java | 434 ++ .../apache/tuscany/sdo/helper/TypeHelperImpl.java | 215 + .../apache/tuscany/sdo/helper/XMLDocumentImpl.java | 553 ++ .../apache/tuscany/sdo/helper/XMLHelperImpl.java | 116 + .../tuscany/sdo/helper/XMLStreamHelperImpl.java | 55 + .../apache/tuscany/sdo/helper/XSDHelperImpl.java | 218 + .../tuscany/sdo/impl/AnyTypeDataObjectImpl.java | 296 + .../org/apache/tuscany/sdo/impl/AttributeImpl.java | 732 ++ .../apache/tuscany/sdo/impl/ChangeSummaryImpl.java | 679 ++ .../tuscany/sdo/impl/ChangeSummarySettingImpl.java | 110 + .../org/apache/tuscany/sdo/impl/ClassImpl.java | 773 ++ .../org/apache/tuscany/sdo/impl/DataGraphImpl.java | 816 +++ .../apache/tuscany/sdo/impl/DataObjectBase.java | 238 + .../apache/tuscany/sdo/impl/DataObjectImpl.java | 1507 ++++ .../org/apache/tuscany/sdo/impl/DataTypeImpl.java | 750 ++ .../tuscany/sdo/impl/DynamicDataObjectImpl.java | 196 + .../sdo/impl/DynamicStoreDataObjectImpl.java | 88 + .../java/org/apache/tuscany/sdo/impl/EnumImpl.java | 170 + .../org/apache/tuscany/sdo/impl/FactoryBase.java | 214 + .../org/apache/tuscany/sdo/impl/ReferenceImpl.java | 698 ++ .../apache/tuscany/sdo/impl/SDOFactoryImpl.java | 332 + .../apache/tuscany/sdo/impl/SDOPackageImpl.java | 2133 ++++++ .../sdo/impl/SimpleAnyTypeDataObjectImpl.java | 330 + .../tuscany/sdo/impl/StoreDataObjectImpl.java | 311 + .../tuscany/sdo/model/BaseDataGraphType.java | 125 + .../tuscany/sdo/model/ChangeSummaryType.java | 152 + .../apache/tuscany/sdo/model/DataGraphType.java | 50 + .../org/apache/tuscany/sdo/model/DataObject.java | 30 + .../org/apache/tuscany/sdo/model/ModelFactory.java | 100 + .../org/apache/tuscany/sdo/model/ModelPackage.java | 141 + .../org/apache/tuscany/sdo/model/ModelsType.java | 56 + .../org/apache/tuscany/sdo/model/Property.java | 342 + .../org/apache/tuscany/sdo/model/TextType.java | 51 + .../java/org/apache/tuscany/sdo/model/Type.java | 371 + .../java/org/apache/tuscany/sdo/model/Types.java | 53 + .../java/org/apache/tuscany/sdo/model/XSDType.java | 56 + .../sdo/model/impl/BaseDataGraphTypeImpl.java | 408 ++ .../sdo/model/impl/ChangeSummaryTypeImpl.java | 396 + .../tuscany/sdo/model/impl/DataGraphTypeImpl.java | 187 + .../tuscany/sdo/model/impl/DataObjectImpl.java | 54 + .../tuscany/sdo/model/impl/ModelFactoryImpl.java | 1091 +++ .../tuscany/sdo/model/impl/ModelPackageImpl.java | 4331 +++++++++++ .../tuscany/sdo/model/impl/ModelsTypeImpl.java | 189 + .../tuscany/sdo/model/impl/PropertyImpl.java | 801 ++ .../tuscany/sdo/model/impl/TextTypeImpl.java | 170 + .../apache/tuscany/sdo/model/impl/TypeImpl.java | 851 +++ .../apache/tuscany/sdo/model/impl/TypesImpl.java | 179 + .../apache/tuscany/sdo/model/impl/XSDTypeImpl.java | 189 + .../apache/tuscany/sdo/model/java/JavaFactory.java | 46 + .../apache/tuscany/sdo/model/java/JavaInfo.java | 60 + .../sdo/model/java/impl/JavaFactoryImpl.java | 361 + .../tuscany/sdo/model/java/impl/JavaInfoImpl.java | 185 + .../sdo/model/java/impl/JavaPackageImpl.java | 1149 +++ .../org/apache/tuscany/sdo/util/BasicSequence.java | 134 + .../sdo/util/DataGraphResourceFactoryImpl.java | 644 ++ .../apache/tuscany/sdo/util/DataObjectUtil.java | 2564 +++++++ .../java/org/apache/tuscany/sdo/util/SDOUtil.java | 543 ++ .../apache/tuscany/sdo/util/StAX2SAXAdapter.java | 242 + .../tuscany/sdo/util/metadata/JavaMetaData.java | 85 + .../tuscany/sdo/util/metadata/MetadataFactory.java | 73 + .../sdo/util/metadata/SDOMetaDataGroup.java | 86 + .../tuscany/sdo/util/metadata/TypeMetaData.java | 60 + .../tuscany/sdo/util/metadata/XSDMetaData.java | 60 + .../sdo/util/metadata/impl/JavaMetaDataImpl.java | 241 + .../util/metadata/impl/MetadataFactoryImpl.java | 174 + .../util/metadata/impl/MetadataPackageImpl.java | 1015 +++ .../util/metadata/impl/SDOMetaDataGroupImpl.java | 323 + .../sdo/util/metadata/impl/TypeMetaDataImpl.java | 185 + .../sdo/util/metadata/impl/XSDMetaDataImpl.java | 185 + .../impl/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../impl/src/main/resources/META-INF/MANIFEST.MF | 25 + .../sdo/impl/src/main/resources/META-INF/NOTICE | 18 + .../impl/src/main/resources/META-INF/README.txt | 35 + .../services/commonj.sdo.impl.HelperProvider | 1 + .../sdo/impl/src/main/resources/sdo-metadata.xsd | 42 + .../java/org/apache/tuscany/sdo/codegen/Bar1.java | 23 + .../java/org/apache/tuscany/sdo/codegen/Bar2.java | 23 + .../BytecodeInterfaceGeneratorTestCase.java | 164 + .../java/org/apache/tuscany/sdo/codegen/Foo.java | 23 + .../codegen/JavaInterfaceGeneratorTestCase.java | 126 + .../apache/tuscany/sdo/codegen/MockProperty.java | 75 + .../org/apache/tuscany/sdo/codegen/MockType.java | 93 + .../tuscany/sdo/test/ChangeSummaryTestCase.java | 89 + .../tuscany/sdo/test/DataTypeBaseTypeTestCase.java | 65 + .../tuscany/sdo/test/DefineTypeTestCase.java | 632 ++ .../apache/tuscany/sdo/test/MixedTypeTestCase.java | 86 + .../apache/tuscany/sdo/test/OpenTypeTestCase.java | 82 + .../tuscany/sdo/test/SimpleCopyTestCase.java | 68 + .../tuscany/sdo/test/SimpleDynamicTestCase.java | 78 + .../tuscany/sdo/test/SimpleEqualityTestCase.java | 60 + .../java/org/apache/tuscany/sdo/test/TestUtil.java | 282 + .../apache/tuscany/sdo/test/TypeRoundTripTest.java | 161 + .../tuscany/sdo/test/XMLDocumentTestCase.java | 107 + .../apache/tuscany/sdo/test/XSDHelperTestCase.java | 61 + .../XMLDocumentNoNamespaceSchemaLocation.xsd | 28 + .../test/resources/XMLDocumentSchemaLocation.xsd | 32 + .../src/test/resources/XMLDocumentTestCase.xml | 14 + .../java/sdo/impl/src/test/resources/customer1.xml | 8 + .../java/sdo/impl/src/test/resources/customer2.xml | 8 + .../java/sdo/impl/src/test/resources/datatype.xsd | 31 + .../java/sdo/impl/src/test/resources/mixed.xml | 9 + .../java/sdo/impl/src/test/resources/mixed.xsd | 38 + .../java/sdo/impl/src/test/resources/mixed2.xml | 12 + .../java/sdo/impl/src/test/resources/mixedopen.xml | 12 + .../java/sdo/impl/src/test/resources/names.xsd | 30 + .../java/sdo/impl/src/test/resources/open.xml | 8 + .../java/sdo/impl/src/test/resources/open.xsd | 41 + .../java/sdo/impl/src/test/resources/open2.xml | 9 + .../java/sdo/impl/src/test/resources/quote.xml | 14 + .../sdo/impl/src/test/resources/sdoannotations.xsd | 57 + .../java/sdo/impl/src/test/resources/sdotypes.xsd | 68 + .../sdo/impl/src/test/resources/shallowquote.xml | 11 + .../java/sdo/impl/src/test/resources/simple.xsd | 38 + .../src/test/resources/simplechangesummary.xml | 35 + .../tags/java-M1-20060522/java/sdo/plugin/pom.xml | 42 + .../apache/tuscany/sdo/plugin/GeneratorMojo.java | 264 + .../tuscany/sdo/plugin/SchemaFileOption.java | 189 + .../plugin/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../sdo/plugin/src/main/resources/META-INF/NOTICE | 18 + .../plugin/src/main/resources/META-INF/README.txt | 35 + .../tags/java-M1-20060522/java/sdo/pom.xml | 56 + .../tags/java-M1-20060522/java/sdo/tools/pom.xml | 68 + .../java-M1-20060522/java/sdo/tools/readme.htm | 29 + .../sdo/generate/Interface2JavaGenerator.java | 242 + .../apache/tuscany/sdo/generate/JavaGenerator.java | 616 ++ .../tuscany/sdo/generate/XSD2JavaGenerator.java | 179 + .../adapter/SDOGenClassGeneratorAdapter.java | 43 + .../SDOGenModelGeneratorAdapterFactory.java | 51 + .../adapter/SDOGenPackageGeneratorAdapter.java | 49 + .../sdo/generate/templates/model/SDOClass.java | 4165 +++++++++++ .../generate/templates/model/SDOFactoryClass.java | 1495 ++++ .../eclipse/jdt/core/formatter/CodeFormatter.java | 24 + .../tools/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../sdo/tools/src/main/resources/META-INF/NOTICE | 18 + .../tools/src/main/resources/META-INF/README.txt | 35 + .../java/com/example/sequences/MixedQuote.java | 323 + .../example/sequences/MixedRepeatingChoice.java | 96 + .../com/example/sequences/RepeatingChoice.java | 82 + .../com/example/sequences/SequencesFactory.java | 83 + .../test/java/com/example/sequences/TwoRCs.java | 151 + .../java/com/example/sequences/TwoRCsMixed.java | 165 + .../com/example/sequences/impl/MixedQuoteImpl.java | 657 ++ .../sequences/impl/MixedRepeatingChoiceImpl.java | 299 + .../sequences/impl/RepeatingChoiceImpl.java | 265 + .../sequences/impl/SequencesFactoryImpl.java | 692 ++ .../com/example/sequences/impl/TwoRCsImpl.java | 449 ++ .../example/sequences/impl/TwoRCsMixedImpl.java | 447 ++ .../src/test/java/com/example/simple/Quote.java | 307 + .../java/com/example/simple/SimpleFactory.java | 46 + .../java/com/example/simple/impl/QuoteImpl.java | 712 ++ .../com/example/simple/impl/SimpleFactoryImpl.java | 138 + .../com/example/simple/impl/SimplePackageImpl.java | 908 +++ .../apache/tuscany/sdo/test/SimpleStaticTest.java | 64 + .../tuscany/sdo/test/StaticSequenceNoEmfTest.java | 249 + .../java/org/apache/tuscany/sdo/test/TestUtil.java | 282 + .../java/sdo/tools/src/test/resources/enum.xsd | 47 + .../resources/mixedRepeatingChoiceTestResult.xml | 22 + .../src/test/resources/mixedStaticTestResult.xml | 31 + .../tools/src/test/resources/repeatingChoice.xsd | 29 + .../test/resources/repeatingChoiceTestResult.xml | 22 + .../sdo/tools/src/test/resources/sequences.xsd | 97 + .../java/sdo/tools/src/test/resources/simple.xsd | 38 + .../twoRepeatingChoicesMixedTestResult.xml | 25 + .../resources/twoRepeatingChoicesTestResult.xml | 25 + .../java/sdo/tools/templates/Header.javajetinc | 6 + .../sdo/tools/templates/models/SDOClass.javajet | 1813 +++++ .../tools/templates/models/SDOFactoryClass.javajet | 727 ++ .../tags/java-M1-20060522/java/spec/pom.xml | 263 + .../tags/java-M1-20060522/java/spec/sca/pom.xml | 36 + .../java/org/osoa/sca/CurrentModuleContext.java | 42 + .../src/main/java/org/osoa/sca/ModuleContext.java | 102 + .../osoa/sca/NoRegisteredCallbackException.java | 66 + .../src/main/java/org/osoa/sca/RequestContext.java | 47 + .../spec/sca/src/main/java/org/osoa/sca/SCA.java | 49 + .../main/java/org/osoa/sca/ServiceReference.java | 67 + .../java/org/osoa/sca/ServiceRuntimeException.java | 67 + .../org/osoa/sca/ServiceUnavailableException.java | 64 + .../java/org/osoa/sca/SessionEndedException.java | 66 + .../sca/src/main/java/org/osoa/sca/Version.java | 43 + .../sca/annotations/AllowsPassByReference.java | 36 + .../java/org/osoa/sca/annotations/Callback.java | 42 + .../osoa/sca/annotations/ComponentMetaData.java | 33 + .../org/osoa/sca/annotations/ComponentName.java | 33 + .../java/org/osoa/sca/annotations/Context.java | 34 + .../java/org/osoa/sca/annotations/Destroy.java | 33 + .../main/java/org/osoa/sca/annotations/Init.java | 39 + .../main/java/org/osoa/sca/annotations/OneWay.java | 34 + .../java/org/osoa/sca/annotations/Property.java | 43 + .../java/org/osoa/sca/annotations/Reference.java | 43 + .../java/org/osoa/sca/annotations/Remotable.java | 34 + .../main/java/org/osoa/sca/annotations/Scope.java | 42 + .../java/org/osoa/sca/annotations/Service.java | 41 + .../java/org/osoa/sca/annotations/Session.java | 49 + .../java/org/osoa/sca/annotations/SessionID.java | 33 + .../sca/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../sca/src/main/resources/META-INF/MANIFEST.MF | 16 + .../spec/sca/src/main/resources/META-INF/NOTICE | 18 + .../sca/src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/schemas/sca-binding-sca.xsd | 35 + .../resources/schemas/sca-binding-webservice.xsd | 36 + .../sca/src/main/resources/schemas/sca-core.xsd | 230 + .../resources/schemas/sca-implementation-java.xsd | 36 + .../main/resources/schemas/sca-interface-java.xsd | 37 + .../main/resources/schemas/sca-interface-wsdl.xsd | 37 + .../spec/sca/src/main/resources/schemas/sca.xsd | 31 + .../org/osoa/sca/annotations/CallbackTestCase.java | 68 + .../osoa/sca/annotations/usage/CallbackType.java | 47 + .../tags/java-M1-20060522/java/spec/sdo/pom.xml | 51 + .../src/main/java/commonj/sdo/ChangeSummary.java | 204 + .../sdo/src/main/java/commonj/sdo/DataGraph.java | 73 + .../sdo/src/main/java/commonj/sdo/DataObject.java | 1105 +++ .../sdo/src/main/java/commonj/sdo/Property.java | 79 + .../sdo/src/main/java/commonj/sdo/Sequence.java | 131 + .../spec/sdo/src/main/java/commonj/sdo/Type.java | 143 + .../main/java/commonj/sdo/helper/CopyHelper.java | 82 + .../main/java/commonj/sdo/helper/DataFactory.java | 61 + .../main/java/commonj/sdo/helper/DataHelper.java | 184 + .../java/commonj/sdo/helper/EqualityHelper.java | 89 + .../main/java/commonj/sdo/helper/TypeHelper.java | 70 + .../main/java/commonj/sdo/helper/XMLDocument.java | 152 + .../main/java/commonj/sdo/helper/XMLHelper.java | 167 + .../main/java/commonj/sdo/helper/XSDHelper.java | 193 + .../commonj/sdo/impl/ExternalizableDelegator.java | 87 + .../main/java/commonj/sdo/impl/HelperProvider.java | 364 + .../sdo/impl/NoHelperProviderException.java | 55 + .../sdo/src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../sdo/src/main/resources/META-INF/MANIFEST.MF | 16 + .../spec/sdo/src/main/resources/META-INF/NOTICE | 18 + .../sdo/src/main/resources/META-INF/README.txt | 35 + .../spec/sdo/src/main/resources/xml/datagraph.xsd | 77 + .../spec/sdo/src/main/resources/xml/sdoJava.xml | 45 + .../spec/sdo/src/main/resources/xml/sdoJava.xsd | 85 + .../spec/sdo/src/main/resources/xml/sdoModel.xml | 87 + .../spec/sdo/src/main/resources/xml/sdoModel.xsd | 217 + .../spec/sdo/src/main/resources/xml/sdoXML.xml | 32 + .../spec/sdo/src/main/resources/xml/sdoXML.xsd | 49 + .../commonj/sdo/impl/HelperProviderTestCase.java | 90 + .../src/test/java/test/DefaultHelperProvider.java | 68 + .../src/test/java/test/TCCL1HelperProvider.java | 68 + .../services/commonj.sdo.impl.HelperProvider | 3 + .../services/commonj.sdo.impl.HelperProvider | 1 + .../java/testing/interop/clients/pom.xml | 52 + .../interop/clients/webserviceInteropDoc/pom.xml | 99 + .../LoopbackInteropDocServiceComponentImpl.java | 47 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/sca.module | 38 + .../src/main/resources/wsdl/interopdoc.wsdl | 179 + .../interop/client/InteropDocClientTestCase.java | 149 + .../interop/clients/webserviceSOAPRound2/pom.xml | 100 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/main/resources/sca.module | 28 + .../src/main/resources/wsdl/interoptestdoclit.wsdl | 152 + .../interop/client/InteropTestDocLitTestCase.java | 144 + .../testing/interop/clients/webserviceXSQ/pom.xml | 60 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../src/test/java/interop/ClientTestCase.java | 50 + .../webserviceXSQ/src/test/resources/sca.module | 29 + .../webserviceXSQ/src/test/resources/wsdl/sq.wsdl | 135 + .../java-M1-20060522/java/testing/interop/pom.xml | 35 + .../java/testing/interop/services/pom.xml | 34 + .../interop/services/webserviceInteropDoc/pom.xml | 96 + .../server/InteropDocServiceComponentImpl.java | 45 + .../src/main/resources/sca.module | 33 + .../src/main/resources/wsdl/interopdoc.wsdl | 177 + .../src/main/webapp/WEB-INF/web.xml | 23 + .../java/testing/tomcat/bigbank/pom.xml | 77 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../bigbank/src/main/resources/META-INF/NOTICE | 18 + .../bigbank/src/main/resources/META-INF/README.txt | 35 + .../tuscany/test/bigbank/BigBankTestCase.java | 234 + .../java-M1-20060522/java/testing/tomcat/build.xml | 430 ++ .../java/testing/tomcat/context.xsl | 48 + .../java/testing/tomcat/datasource.xsl | 39 + .../java/testing/tomcat/helloworldweb/pom.xml | 77 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../test/helloworldweb/HelloWorldWebTestCase.java | 100 + .../java/testing/tomcat/helloworldws/pom.xml | 96 + .../src/main/resources/META-INF/LICENSE.txt | 1277 ++++ .../src/main/resources/META-INF/NOTICE | 18 + .../src/main/resources/META-INF/README.txt | 35 + .../helloworldws/HelloWorldWebServiceTestCase.java | 62 + .../java-M1-20060522/java/testing/tomcat/pom.xml | 106 + .../java/testing/tomcat/readme.htm | 63 + .../java/testing/tomcat/server.xsl | 48 + .../java/testing/tomcat/sourceBuild.htm | 116 + 1751 files changed, 237947 insertions(+) create mode 100644 sca-java-1.x/tags/java-M1-20060522/PROPOSAL.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/STATUS create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/BUILDING.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/GettingStarted.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ApplyChangesCommand.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroup.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroupFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Key.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Pager.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Parameter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ResultSetShape.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/SDODataTypes.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/CudGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/MANIFEST.MF create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/config.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/dasmodel4.mdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/StoredProcs.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DatagraphRoot.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DepartmentType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/EmployeeType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyPackageImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DatagraphRootImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DepartmentTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/EmployeeTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/AnOrder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/Customer.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/CustomerFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/DataGraphRoot.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/AnOrderImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerPackageImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/DataGraphRootImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/1xM_mapping_no_cud.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/BooksConfig.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CompanyConfig.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CompanyEmployeeConfig.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustOrdersConnectionProps.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomerConfigWithConverter.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomersOrdersConfig.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/PartsConfig.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCompanyMapping.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMapping.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerOrderMapping.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicStaticCustomer.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/cityStates.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.ecore create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.genmodel create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/companyMapping.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/companyMappingWithConverters.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.ecore create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.genmodel create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customerMapping.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/BUILDING.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/axis2-overlay/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/axis2-overlay/src/main/assembly/bin.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/build-dist.bat create mode 100755 sca-java-1.x/tags/java-M1-20060522/java/distribution/build-dist.sh create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/buildDistribution.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/celtix-overlay/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/celtix-overlay/src/main/assembly/bin.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/configureTomcat.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/context.xsl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/datasource.xsl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/server.xsl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-core-overlay/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-core-overlay/src/main/assembly/bin.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-polish/fixupJars.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-polish/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-samples/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-samples/src/main/assembly/bin.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-tools-overlay/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-tools-overlay/src/main/assembly/bin.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/etc/svn-ignores create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/etc/tuscany-eclipse-codestyle.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/etc/tuscany-idea-codestyle.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-base.css create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-classic.css create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-theme.css create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/print.css create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/DasAccountConfiguration.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/WebservicexService_stockquote.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/mock_stockquote.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.subsystem create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/wsdl/AccountService.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/test/java/bigbank/account/client/AccountClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/Show.Image.html create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/accountfiles.png create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/modualoverview.png create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/webclientfiles.png create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/account/AccountServiceComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/AccountLoginServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/LoginService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountStatusTag.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockStatusTag.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/LoginBarrierTag.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/ServiceTag.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/ui/FormServlet.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/ui/LoginServlet.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/sca.subsystem create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/CustomerProfile.jsp create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/accountTransaction.jsp create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/login.html create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/purchaseStock.jsp create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/stockSale.jsp create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/summary.jsp create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/test/java/bigbank/webclient/client/TestAccountService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/test/java/bigbank/webclient/client/TestLoginService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sampleapps/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/db.lck create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/log.ctrl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/log1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/logmirror.ctrl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c10.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c101.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c111.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c121.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c130.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c141.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c150.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c161.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c171.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c180.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c191.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1a1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1b1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1c0.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1d1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1e0.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1f1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c20.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c200.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c211.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c221.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c230.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c241.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c251.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c260.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c271.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c281.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c290.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2a1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2b1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2c1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2d0.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2e1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2f0.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c300.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c31.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c311.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c320.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c331.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c340.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c351.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c360.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c371.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c380.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c391.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3a0.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3b1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3c0.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3d1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3e0.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3f1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c400.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c41.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c411.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c420.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c431.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c440.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c451.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c460.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c471.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c481.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c490.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c4a1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c51.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c60.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c71.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c81.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c90.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/ca1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cb1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cc0.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cd1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/ce1.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cf0.dat create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/service.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/CompanyConfig.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/Company.jsp create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/META-INF/context.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/das/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/AddService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/AddServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/DivideService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/DivideServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/MultiplyService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/SubtractService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/logging.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/test/java/calculator/CalculatorTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/java/customerinfo/CustomerInfoClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/java/customerinfo/CustomerInfoServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/logging.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/wsdl/customer.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/wsdl/customerinfo.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/test/java/customerinfo/CustomerInfoTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/java/helloworld/HelloWorldClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/logging.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/activemq.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldServer.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/test/java/helloworld/HelloWorldTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/helloworld/HelloWorldImpl.componentType create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/helloworld/HelloWorldImpl.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/webapp/HelloWorldClient.html create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/java/org/apache/tuscany/samples/helloworldjsonrpc/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/java/org/apache/tuscany/samples/helloworldjsonrpc/HelloWorldServiceComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/webapp/HelloWorldJSONRPC.html create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/webapp/HelloWorldWeb.jsp create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/test/java/helloworld/HelloWorldTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldServer.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/logging.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Customer.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/CustomerComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Retailer.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/RetailerComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Shipper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/ShipperComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/SupplyChainClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Warehouse.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/logging.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceAssemblyFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceBinding.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceAssemblyFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceBindingImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSEntryPointContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSExternalServiceContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointInOutSyncMessageReceiver.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2OperationInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2ServiceInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceBindingLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/system.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/StockAccount.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldServiceComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/util/SDODataBindingTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/builder/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLit.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLitWrapped.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/RpcLit.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLit.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLitWrapped.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.checkstyle create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.pmd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.ruleset create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/checkstyle.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceAssemblyFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceWireBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/WebServiceEntryPointBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/ExternalWebServiceContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/WebServiceEntryPointContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/CeltixEntryPointContextImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/RawByteArrayOutputStream.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCAServerDataBindingCallback.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/TuscanyWSDLManager.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/system.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/assembly/JSONRPCBinding.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/config/JSONEntryPointContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServlet.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/ScriptGetterServlet.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/loader/JSONRPCBindingLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/org/apache/tuscany/binding/jsonrpc/handler/jsonrpc.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/system.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServletTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/MockConfigUtils.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletRequest.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletResponse.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpSession.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletConfig.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockBinding.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockCompositeContextImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockEntryPointContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockScopeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/resources/org/apache/tuscany/binding/jsonrpc/assembly/tests/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/sunjars/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/sunjars/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyRuntimeException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/LogLevel.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/MonitorFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/InvalidLevelException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/JavaLoggingMonitorFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/NullMonitorFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/ResourceLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/GeneratedClassLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/ResourceLoaderImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.logging.LogProvider create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.resource.loader.ResourceLoaderProvider create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/java/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/resources/org/apache/tuscany/common/TestMessages.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/resources/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase$Monitor.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaAssemblyFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaImplementation.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaAssemblyFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaImplementationImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/context/JavaAtomicContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/AbstractJavaComponentInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/ScopedJavaComponentInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/StaticJavaComponentTargetInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/loader/JavaImplementationLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/org/apache/tuscany/container/java/Messages.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/system.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/test/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.componentType create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldWithFieldProperties.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorld.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorldWithInterface.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountReport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountSummary.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/StockAccount.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockHandlerBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockInterceptorBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/DifferentInterfaceWireTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextLifecycleTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextMetadataInjectionTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextNegativeMetadataTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextScopeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/MultiplicityTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaBuilderContextIntegrationTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaRuntimeBootstrapTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/StartStopTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EPtoExternalServiceTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EntryPointToJavaTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/ExternalServiceProxyInvokeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/JavaToExternalServiceTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/loader/JavaImplementationLoaderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockConfigContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockScopeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBinding.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingWireBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooEntryPointContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceTargetInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/AbstractGenericComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadContextPojo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadNamePojo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/DataObject.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/GenericComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/HelloWorldClient.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/LocalComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.componentType create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeDestroyOnlyComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitDestroyComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitDestroyComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitOnlyComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTarget.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTargetImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeDestroyOnlyComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitDestroyComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitOnlyComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeDestroyOnlyComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitDestroyComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitOnlyComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Source.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SourceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Target.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/TargetImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicModuleScopeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicRequestScopeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicSessionScopeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicStatelessScopeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/DependencyLifecycleTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/ModuleScopeLifecycleTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedDependentPojo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedEagerInitPojo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedInitPojo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopeLifecycleTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopedOrderedInitPojo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopeLifecycleTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopedOrderedInitPojo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworld/example.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworld/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworldmc/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/assembly/tests/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/config/ModuleComponentLoaderTest1.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptTargetWireBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/config/JavaScriptContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/context/JavaScriptComponentContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/E4XDataBinding.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScript.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoScript.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/system.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/AbstractJavaScriptTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/BasicTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/E4XTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/HelloWorld.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/InitializationTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/PropertiesTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/Salutation.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/ServiceRefsTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/TestMethods.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.componentType create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.componentType create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.componentType create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.componentType create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.componentType create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.componentType create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/e4x.componentType create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/e4x.js create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/containers/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/builder/AsyncPolicyBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/invocation/AsyncInterceptor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/work/DefaultWorkManager.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderConfigException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderInitException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextCreationException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilderRegistry.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextResolver.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/HierarchicalWireBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/NoAccessorException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyOrderer.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyOrderer.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyOrderer.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/UnknownTypeException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ArrayMultiplicityObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/AssemblyVisitorImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ContextFactoryBuilderRegistryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/HierarchicalBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ListMultiplicityObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ProxyObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/DefaultPolicyBuilderRegistry.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/PolicyBuilderRegistry.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/client/BootstrapHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ComponentTypeIntrospector.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationLoadException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ImplementationCache.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidMetaDataException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidRootElementException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidSetterException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/JavaIntrospectionHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MetaDataException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingInterfaceException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingResourceException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ModuleComponentConfigurationLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/SidefileLoadException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/StAXModuleComponentConfigurationLoaderImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ComponentNameProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ContextProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DefaultProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DestroyProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ImplementationProcessorSupport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/InitProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorUtils.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyReferenceValidator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ReferenceProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ScopeProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AtomicContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireResolutionException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/CompositeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ConfigurationContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/Context.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextInitException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextRuntimeException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/CoreRuntimeException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/DuplicateNameException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EntryPointContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventFilter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventPublisher.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/InvalidNameException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/Lifecycle.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingContextFactoryException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingImplementationException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingScopeException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ProxyConfigurationException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/QualifiedName.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/RuntimeEventListener.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeAwareContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeIdentifier.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeInitializationException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeRuntimeException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeStrategy.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ServiceNotFoundException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/SystemCompositeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/TargetException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBound.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEnd.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreated.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStart.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStop.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEnd.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStart.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBound.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEnd.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionStart.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/filter/TrueFilter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractLifecycle.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EntryPointContextImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/ExternalServiceContextImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeStrategy.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategy.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/ModuleScopeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/StatelessScopeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ComponentTargetInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceTargetInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/ImplementationProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/InjectorExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/JavaExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ComponentNameExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ContextExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/DestroyInvokerExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InitInvokerExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InvokerExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ContextObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FactoryInitException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/Injector.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InterCompositeReferenceFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NonProxiedTargetFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NullEventInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCreationException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/InvalidPropertyFactoryException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/LoaderContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXElementLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXLoaderRegistry.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXPropertyFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AbstractLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AssemblyConstants.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/CompositeLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/EntryPointLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceJavaLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleFragmentLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/PropertyLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ReferenceLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ServiceLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/WireLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/JNDIPropertyFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StringParserPropertyFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemBindingLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemImplementationLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContextImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeMonitor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeScopeStrategy.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Autowire.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Monitor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/ParentContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemAssemblyFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemBinding.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemImplementation.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemModule.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemBindingImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemImplementationImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemEntryPointBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemExternalServiceBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemObjectContextFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAtomicContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemEntryPointContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemExternalServiceContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemScopeStrategy.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ContextBinder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/LazyHTTPSessionId.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ServletHost.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyRequestFilter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyServletListener.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/Interceptor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationRuntimeException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageChannel.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageHandler.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/ProxyCreationException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/InvokerInterceptor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageChannelImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageDispatcher.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/OneWayInterceptor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/RequestResponseInterceptor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/services/org.apache.tuscany.core.runtime.proxy.ServiceProxyFactory create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/model/anyobject.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/model/tuscany-system.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/system.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/invocation/AsyncInvocationConfigurationTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockHandler.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockStaticInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockSyncInterceptor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTarget.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTargetImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/DefaultWorkManagerTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/GeronimoWorkManagerTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/NegativeDefaultWireBuilderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean1.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean2.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/JavaIntrospectionHelperTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/SuperBean.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopeTestComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopedParent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestMultipleInterfacesComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface2.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterfacesImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceSpecifiedImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractCompositeHierarchyTests.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeContextRegisterTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/QualifiedNameTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategyTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/integration/IntraCompositeWireIntegrationTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/MockReaderSupport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoaderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/EntryPointLoaderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoaderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderInterfaceStylesTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/LoaderTestSupport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/MockService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WSDLDefinitionRegistryTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WireLoaderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockConfigContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/GenericSystemComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeBootTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/SystemBootstrapTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/IntraCompositeWireTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeComponentContextTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeContextRegisterTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeHierarchyTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemObjectRegistrationTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/TestBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationErrorTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactoryTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockHandler.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockScopeContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockStaticInvoker.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockSyncInterceptor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSource.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSourceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTarget.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTargetImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/config/ModuleComponentLoaderTest1.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/interfacestyles.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/system.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/system.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-binding-sca.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-core.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-implementation-java.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-interface-java.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountReport.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountSummary.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/StockAccount.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.subsystem create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/ContainerLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TomcatHost.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyHost.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyWrapper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/Messages.properties create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/system.fragment create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldService.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestClassLoader.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestServlet.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatStandaloneTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/axis2.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/index.html create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/wsdl/helloworld.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/index.html create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLModel.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Account.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Customer.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/resources/AccountService.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.ecore create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.genmodel create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.mdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/AnyTypeDataObject.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOExtendedMetaData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOPackage.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOTypeVisitor.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SimpleAnyTypeDataObject.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/GenerationException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/NoJavaImplementationException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/CopyHelperImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DataFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/DataHelperImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/EqualityHelperImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/HelperProviderImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOExtendedMetaDataImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOXSDEcoreBuilder.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLDocumentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLHelperImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XSDHelperImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AnyTypeDataObjectImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AttributeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummarySettingImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataGraphImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicStoreDataObjectImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EnumImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SimpleAnyTypeDataObjectImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/StoreDataObjectImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/BaseDataGraphType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ChangeSummaryType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/DataGraphType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/DataObject.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelPackage.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelsType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Property.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/TextType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Type.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Types.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/XSDType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/BaseDataGraphTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ChangeSummaryTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/DataGraphTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/DataObjectImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelPackageImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelsTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/PropertyImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TextTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TypesImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/XSDTypeImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/JavaFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/JavaInfo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaInfoImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaPackageImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/BasicSequence.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataGraphResourceFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/StAX2SAXAdapter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/JavaMetaData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/MetadataFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/SDOMetaDataGroup.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/TypeMetaData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/XSDMetaData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/JavaMetaDataImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/MetadataFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/MetadataPackageImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/SDOMetaDataGroupImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/TypeMetaDataImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/XSDMetaDataImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/MANIFEST.MF create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/services/commonj.sdo.impl.HelperProvider create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/sdo-metadata.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar1.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar2.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGeneratorTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Foo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGeneratorTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockProperty.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DataTypeBaseTypeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/MixedTypeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/OpenTypeTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleCopyTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleDynamicTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleEqualityTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TypeRoundTripTest.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XMLDocumentTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/XSDHelperTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/XMLDocumentNoNamespaceSchemaLocation.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/XMLDocumentSchemaLocation.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/XMLDocumentTestCase.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/customer1.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/customer2.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/datatype.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed2.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixedopen.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/names.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open2.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/quote.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/sdoannotations.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/sdotypes.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/shallowquote.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/simple.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/simplechangesummary.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/SchemaFileOption.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/Interface2JavaGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/JavaGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/XSD2JavaGenerator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenClassGeneratorAdapter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapterFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenPackageGeneratorAdapter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOClass.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/eclipse/jdt/core/formatter/CodeFormatter.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/MixedQuote.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/RepeatingChoice.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/SequencesFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/TwoRCs.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/TwoRCsMixed.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/MixedRepeatingChoiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/RepeatingChoiceImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/TwoRCsImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/TwoRCsMixedImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/Quote.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/SimpleFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/QuoteImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/SimpleFactoryImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/SimplePackageImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/SimpleStaticTest.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/StaticSequenceNoEmfTest.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/enum.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/mixedRepeatingChoiceTestResult.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/mixedStaticTestResult.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/repeatingChoice.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/repeatingChoiceTestResult.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/sequences.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/simple.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/twoRepeatingChoicesMixedTestResult.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/twoRepeatingChoicesTestResult.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/Header.javajetinc create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/models/SDOClass.javajet create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/models/SDOFactoryClass.javajet create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/CurrentModuleContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ModuleContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/RequestContext.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/SCA.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceReference.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceRuntimeException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceUnavailableException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/SessionEndedException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/Version.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Callback.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/ComponentMetaData.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/ComponentName.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Context.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Destroy.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Init.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/OneWay.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Property.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Reference.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Remotable.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Scope.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Service.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Session.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/SessionID.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/MANIFEST.MF create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-binding-sca.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-binding-webservice.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-core.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-implementation-java.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-interface-java.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-interface-wsdl.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/test/java/org/osoa/sca/annotations/CallbackTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/test/java/org/osoa/sca/annotations/usage/CallbackType.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/ChangeSummary.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/DataGraph.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/DataObject.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Property.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Sequence.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Type.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/CopyHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/DataFactory.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/DataHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/EqualityHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/TypeHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XMLDocument.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XMLHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XSDHelper.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/ExternalizableDelegator.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/HelperProvider.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/NoHelperProviderException.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/MANIFEST.MF create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/datagraph.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoJava.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoJava.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoModel.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoModel.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoXML.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoXML.xsd create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/commonj/sdo/impl/HelperProviderTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/test/DefaultHelperProvider.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/test/TCCL1HelperProvider.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/resources/default/META-INF/services/commonj.sdo.impl.HelperProvider create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/resources/tccl1/META-INF/services/commonj.sdo.impl.HelperProvider create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/wsdl/interoptestdoclit.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/java/interop/ClientTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/resources/wsdl/sq.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/resources/sca.module create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/webapp/WEB-INF/web.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/test/java/org/apache/tuscany/test/bigbank/BigBankTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/build.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/context.xsl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/datasource.xsl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/test/java/org/apache/tuscany/test/helloworldweb/HelloWorldWebTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/LICENSE.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/NOTICE create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/README.txt create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/test/java/org/apache/tuscany/test/helloworldws/HelloWorldWebServiceTestCase.java create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/pom.xml create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/readme.htm create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/server.xsl create mode 100644 sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/sourceBuild.htm (limited to 'sca-java-1.x') diff --git a/sca-java-1.x/tags/java-M1-20060522/PROPOSAL.txt b/sca-java-1.x/tags/java-M1-20060522/PROPOSAL.txt new file mode 100644 index 0000000000..4fb0106d64 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/PROPOSAL.txt @@ -0,0 +1,238 @@ +Apache Tuscany Proposal + +RATIONALE +========= + +Tuscany provides multiple language implementations of the Service Component +Architecture (SCA) specifications and related technologies such as SDO (links +to these specifications are in the "Initial Source" section of this proposal). + +Its overall goal is to simplify the implementation of services and the +composition of heterogeneous service networks by building infrastructure +bridging the gaps between language-specific application component +implementation technologies (e.g. Java EE, BPEL, Spring, etc) using SOA +concepts/design approaches (e.g. web services, loosely coupled asynchronous +messaging, ESBs, etc). + +The seed code for the project will consist of in-progress C++ and Java +implementations of several SCA specifications that we intend to continue +development on in conjuction with other Apache communities. More information on +the scope of the seed code can be found in subsequent sections of this +proposal. + +CRITERIA +======== + +Meritocracy: + +The Tuscany committers recognize the desirability of running the project as a +meritocracy; indeed, the scope of the project is so broad that we find it hard +to envision success any other way. One of the lessons taken from the historic +development of middleware is that specifications developed in isolation from +real usable code or amongst a narrowly restricted list of contributors often do +not see widespread adoption. We are eager to engage other members of the +community and operate to the standard of meritocracy that Apache emphasizes. + +Community: + +Tuscany is not based on an existing open source community, but the contributors +involved have experience participating in and building other open source +communities. A primary objective of the project is to build a vibrant community +of users and active contributors. + +Core Developers: + +Most of the initial committers are members of BEA and IBM development teams. 4 +are committers on other Apache projects. + +Alignment: + +An initial implementation has been written in Java and has already been +integrated with Apache Tomcat as a deployment platform; it is expected that +this implementation will soon be integrated with other Java middleware +environments including Apache Geronimo and ObjectWeb Celtix. This +implementation makes extensive use of projects from the Apache Web Services +community, including Axis and associated tools; future implementation of +policies will increase the collaboration with other web service projects. + +Another implementation has also been written in C++ and has been integrated +with Apache HTTPD and the Axis C++ project. + +The scope of the project is broader than just Java and C++, and some +development has started on component containers for other programming languages +including BPEL and PHP. + +As a broad goal is to present a SOA development model that mediates over a +variety of middleware technologies, there is potential synergy with many other +Apache projects including: + + * Customized component/application packaging and deployment on Geronimo + * Data access integration with Beehive controls + * XML model representation and parsing using XMLBeans + * Language/platform neutral messaging infrastructure using Synapse + * OSGi packaging and deployment on Felix + +AVOIDING THE WARNING SIGNS +========================== + +Orphaned products: + +The initial code submission is based on active code developed collaboratively +by BEA and IBM who believe that its continued evolution in an open community +will lead to a stronger, more widely accepted foundation for development of +SOA-based applications. + +Inexperience with open source: + +Several of the committers have experience working on open source projects and +are committers on other Apache projects. The seed materials have been +co-developed in an environment that is structurally similar to open source +communities (for example, design decisions made over mailing lists based on +technical merit). + +Homogenous developers: + +The current list of committers includes developers from several different +companies who are geographically distributed across the U.S., Europe, and Asia. +They are experienced with working in a distributed environment, and with +resolving technical differences outside the scope of a common employer. + +Reliance on salaried developers: + +Most of the initial developers are paid by their employers to contribute to +this project; however, this includes three independent employers with track +records for ongoing investment in open source communities (including Apache +and Eclipse). + +No ties to other Apache products: + +As described in the Alignment section, this framework already has ties to many +Apache products. The initial codebase is already licensed under the Apache +License 2.0. + +A fascination with the Apache brand: + +The committers are intent on developing a strong open source community around +frameworks that treat SOA-centric design in a first-class manner. We believe +that the Apache Software Foundation's emphasis on community development makes +it the most suitable choice for such a project. + +SCOPE OF SUBPROJECTS +==================== + +The initial contributors envision an active community of related projects +sharing a common model for SOA applications but targeting specific technical +areas of that model. + +Tuscany will be seeded with several projects based on donated material (see +the next section): + + * an assembly model defining a mechanism for composing SOA applications + * a Java implementation running on top of Tomcat and Axis + * a Java implementation of SDO2 and a data access subsystem + * a C++ implementation running on top of Apache HTTPD and Axis C++ + * a C++ implementation of SDO2 + +To assist in community building the committers have identified several key +technology areas that will allow new contributors to actively engage in the +project. These include: + + * transition web service integration to Axis2 + * integration with Axis2 policy implementations for security, transactions, + reliable messaging + * support heterogeneous components written in C/C++, BPEL, PHP and other + languages + * support callbacks, allowing a component to call back to the service that + invoked it + * support asynchronous calls using JMS + * support typesafe SDOs in the C++ implementation of SDO2 + +These initial projects are intended merely as starting points and should not +be taken as bounding the scope of the Tuscany project as a whole. Some other +potential projects may include: + + * Integration with existing development frameworks (such as JEE5/EJB3 or + Spring). + * Integration with rich middleware frameworks (such as Celtix or + ServiceMix). + * Frameworks for providing service-oriented data access to a variety of + existing resources. + * Richer tooling support for SOA-based applications, especially in the + areas of services composition, monitoring and policy administration. + +INITIAL SOURCE +============== + +A group of vendors are developing a set of specifications relating to the +design and composition of systems using SOA, collectively called Service +Component Architecture (SCA). In progress versions are available at: + + * http://dev2dev.bea.com/pub/a/2005/11/sca.html + * http://www.ibm.com/developerworks/library/specification/ws-sca/ + * http://www.iona.com/devcenter/sca/ + * http://oracle.com/technology/webservices/sca + * https://www.sdn.sap.com/ + * http://www.sybase.com/sca + +The initial contributors have been developing Java and C++ code bases (already +licensed under the Apache License 2.0) which implement aspects of these +specifications, and intend to donate it to Apache. A snapshot of this code has +been uploaded to JIRA and is is available at: + + * http://issues.apache.org/jira/browse/INCUBATOR-8 + +Although the Tuscany project expects to bootstrap using these materials and in +the case of specifications, to provide feedback that will be incorporated into +their ongoing development, we expect and encourage the open source community to +take the project in new directions not envisioned by them. + +ASF resources to be created +mailing list(s) + + * tuscany-dev@ws.apache.org + * tuscany-commits@ws.apache.org + +Subversion repository + + * https://svn.apache.org/repos/asf/incubator/tuscany + +Jira + + * Tuscany (TUSCANY) + +INITIAL COMMITTERS +================== + + * Jeremy Boynes + * Frank Budinsky + * Don Cai + * Jean-Sebastien Delfino + * Mike Edwards + * Padmapriya Illindala + * Jim Marino + * Geir Magnusson Jr. + * Eddie O'Neil + * Radu Preotiuc-Pietro + * Rick Rineholt + * Pete Robbins + * Michael Rowley + * Edward Slattery + * Ken Tam + * Alexandre Vasseur + * Kevin Williams + +APACHE SPONSOR +============== + +The WS PMC has voted to accept this project into the WS project upon successful +incubation. + +Champion + + * Geir Magnusson Jr. + +Mentors: + + * Sam Ruby + * Davanum Srinivas (Dims) + diff --git a/sca-java-1.x/tags/java-M1-20060522/STATUS b/sca-java-1.x/tags/java-M1-20060522/STATUS new file mode 100644 index 0000000000..afe1e05bcc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/STATUS @@ -0,0 +1,60 @@ +Apache Tuscany Status + +Tuscany provides multiple language implementations of the Service Component Architecture (SCA) specifications and related technologies such as SDO. + +PROJECT STATUS +============== + + Tuscany is being incubated at the request of the Apache Web Services PMC. + For information on incubation please visit the project page at + http://incubator.apache.org/projects/tuscany.html + +PENDING ISSUES +============== +2005-12-28 CCLA received for IBM's contribution of a C++ implementation +2005-12-28 CCLA received for BEA and IBM joint contribution of a Java implementation + +RESOLVED ISSUES SINCE LAST STATUS +================================= +None + +OTHER NEWS +========== + +2006-05-21 Vote to publish Milestone 1 release + +2006-05-02 Vote to add Dan Kulp as a new committer + +2006-01-05 Contribution of Java implementation by BEA and IBM committed +2006-01-05 Contribution of C+ implementation by IBM committed + +RELEASE STATUS +============== +2006-05-21 Milestone 1 release + +REFERENCES +========== +Status file http://svn.apache.org/repos/asf/incubator/tuscany/STATUS +User List tuscany-user@ws.apache.org +Developer List tuscany-dev@ws.apache.org +Commits List tuscany-commits@ws.apache.org +Source Code http://svn.apache.org/repos/asf/incubator/tuscany/ +Issue Tracking http://issues.apache.org/jira/browse/TUSCANY + +Committers + antelder Ant Elder + dkulp Dan Kulp + dims Davanum Srinivas + edslattery Ed Slattery + ekoneil Eddie O'Neil + frankb Frank Budinsky + geirm Geir Magnusson Jr + jsdelfino Jean-Sebastien Delfino + jboynes Jeremy Boynes + jmarino Jim Marino + kentam Ken Tam + kwilliams Kevin Williams + edwardsmj Mike Edwards + robbinspg Pete Robbins + rineholt Rick Rineholt + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/BUILDING.txt b/sca-java-1.x/tags/java-M1-20060522/java/BUILDING.txt new file mode 100644 index 0000000000..ac539de783 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/BUILDING.txt @@ -0,0 +1,23 @@ +Building tuscany/java +===================== + +Initial Setup +------------- + +1) Install J2SE 5.0 SDK (1.5.0_06-b05 works) + +2) Install Maven: +Download Maven 2.0.4 (download from http://maven.apache.org/download.html). + + + +Building +-------- + +1) Change to the top level directory of the Tuscany Java project (tuscany/java) or at top level of your source distribution. +2) Execute: mvn + +Note: Depending on the load of remote Mavan 2.0 repositories you may have to execute mvn several time until required + dependencies are all located in your local maven repository. After you have completed a full successful build you + can use "mvn -o" which is much faster. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/GettingStarted.htm b/sca-java-1.x/tags/java-M1-20060522/java/GettingStarted.htm new file mode 100644 index 0000000000..aba5ae7860 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/GettingStarted.htm @@ -0,0 +1,192 @@ + + + + + + + + + Tuscany - Getting Started + + +
+
+
+

Tuscany - Getting Started - Milestone release 1

+ +

This page describes what is needed to install and run Tuscany + SCA, SDO and DAS for Java.
If you haven't already done so, the first + step is to download the Milestone release 1 of apache Tuscany from our + download page. +

+
+
+

System Requirements

+ +

In order to run the Tuscany there are some + minimum requirements:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
SoftwareDownload Link
Operating systems: +
    +
  • Windows XP SP2
  • +
  • Linux
  • +
+
+
JDK 5.0 + http://java.sun.com/j2se/1.5.0/download.jsp + +
 Optionally: + One of the following if you wish to build the + samples yourself...
Apache Maven 2.0.4 (version + or later)
+
+ http://maven.apache.org/download.html + +
Apache Ant 1.6.5 (version + or later)http://ant.apache.org/bindownload.cgi
+
+
+

Building Samples

+ +

The samples are already built and ready to run. However if you + want to build them yourself you can: 
For example to build + the helloworld sample:

+ +

Using Maven:

+
+

Note:Using Maven the first build will require connection to the internet to download required dependiences to your local Maven repository. Occassionally, these + remote repository can become over burdened resulting in failure to complete the build. If this happens restart the build again. Once a complete build is achieved you can use + the -o option on the mvn command to do offline builds.

+
+
    +
  • Change to the directory: samples/sca/helloworld directory
  • + +
  • Issue the command: mvn 
  • +
+
+
 - OR -
+
+ +

Using Ant:

+
    +
  • Change to the directory: samples/sca/helloworld directory
  • +
  • Issue the command: ant 
  • +
+
+
+

Starting the Server

+ +

Some of the samples require the Tuscany embedded Tomcat server + to be started.

+
    +
  • Change the directory to apache-tomcat-5.5.17\bin
  • +
  • Issue the command: startup
  • +
  • To later stop the server Issue the command: shutdown
  • + +
+
+
+

Samples

+ + + + + + + + + + + + + + + + +
Tuscany samples + and applications
SCA Technology samples + Simple samples that emphasizes  how to to use + Service Component Architecture technology.
+
DAS Technology samplesSimple samples that emphasizes how to use Data + Access Services.
+ Sample applicationsSample business applications that show  SCA and SDO.
+
+
+
+

Getting Help

+ +

First place to look is at the Tuscany FAQ at + http://incubator.apache.org/tuscany/faq.html

+ +

Any problem with this release can be reported to the Tuscany + mailing lists or create a JIRA issue at http://issues.apache.org/jira/browse/Tuscany.

+ + +

+ +

+ +

+ +

 

+ +

 

+ +

 

+ + + + + + +
+ +

Thank you for your interest in Tuscany.

-The + Tuscany Development Team + +

+
+ +

+
+
+
+ + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/README.txt new file mode 100644 index 0000000000..7402609441 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/README.txt @@ -0,0 +1,27 @@ +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. + + +Getting Started +--------------- +Documentation describing the system requirements and the steps to set up the +Tuscany runtime and run the Tuscany basic technology samples can be found in +GettingStarted.htm. Javadoc can be found in the javadoc directory. + + +Thank you for using Tuscany! + +The Tuscany Team. diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/pom.xml new file mode 100644 index 0000000000..98da287328 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/pom.xml @@ -0,0 +1,34 @@ + + + + + org.apache.tuscany + tuscany-project + incubating-M1 + + 4.0.0 + org.apache.tuscany.das + tuscany-das + pom + Tuscany DAS + incubating-M1 + + + rdb + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/pom.xml new file mode 100644 index 0000000000..df7e1072c3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/pom.xml @@ -0,0 +1,103 @@ + + + + + org.apache.tuscany.das + tuscany-das + incubating-M1 + + 4.0.0 + tuscany-das-rdb + Tuscany DAS for Relational Databases + incubating-M1 + + + + commonj + sdo-api + incubating-M1 + compile + + + + org.apache.tuscany + tuscany-sdo-impl + incubating-M1 + compile + + + + + junit + junit + 3.8.1 + test + + + org.apache.derby + derby + 10.1.2.1 + test + + + + + + + org.apache.tuscany + tuscany-sdo-plugin + + + + ${basedir}/src/main/resources/config.xsd + true + true + true + true + + + generate + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + src/main/resources/META-INF/MANIFEST.MF + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*AllTestsDerby.java + + brief + false + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ApplyChangesCommand.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ApplyChangesCommand.java new file mode 100644 index 0000000000..75f81ca1e3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ApplyChangesCommand.java @@ -0,0 +1,101 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb; + +import java.sql.Connection; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +/** + * An ApplyChangesCommand is used to flush the changes associated with a + * modified graph of DataObjects to a database. + * + * + */ +public interface ApplyChangesCommand { + + /** + * Adds a user-provided update command. In the absence of a user-provided + * command, the DAS will generate one. However this alternative may make + * sense if the user requires a SQL statement different from what the DAS + * generates. + * + * @param type + * The DataObject type this command applys to + * @param cmd + * The Command used to UPDATE data objects of the specified type + */ + public void addUpdateCommand(Type type, Command cmd); + + /** + * Adds a user-provided create command. In the absence of a user-provided + * command, the DAS will generate one. However this alternative may make + * sense if the user requires a SQL statement different from what the DAS + * generates. + * + * @param type + * The DataObject type this command applys to + * @param cmd + * The Command used to INSERT data objects of the specified type + */ + public void addCreateCommand(Type type, Command cmd); + + /** + * Adds a user-provided delete command. In the absence of a user-provided + * command, the DAS will generate one. However this alternative may make + * sense if the user requires a SQL statement different from what the DAS + * generates. + * + * @param type + * The DataObject type this command applys to + * @param cmd + * The Command used to DELETE data objects of the specified type + */ + public void addDeleteCommand(Type type, Command cmd); + + /** + * The change history is scanned and modifications to the graph of data + * objects are flushed to the database. + * + * @param root + * the topmost containing data object + */ + public void execute(DataObject root); + + /** + * Provides the java.sql.Connection to be used for this executing this + * command. + * + * @param connection + * the java.sql.Connection + */ + public void setConnection(Connection connection); + + /** + * Provides the java.sql.Connection to be used for this executing this + * command. + * + * @param connection + * the java.sql.Connection + * @param manageTransactions + * true if the DAS should perform tx + * commit/rollback + */ + public void setConnection(Connection connection, boolean manageTransactions); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java new file mode 100644 index 0000000000..37d67fd10c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Command.java @@ -0,0 +1,222 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.impl.CommandFactoryImpl; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +/** + * A Command is used to execute a read or write to a database + * + * + */ +public interface Command { + + public static CommandFactory FACTORY = new CommandFactoryImpl(); + + /** + * Performs the function defined by the command + */ + public void execute(); + + /** + * Performs the function defined by the command and return the results in + * the root DataObject + * + * @return the root DataObject + */ + public DataObject executeQuery(); + + /** + * Returns the parameter associated with "name" + * + * @param name + * the name of the parameter + * @return the associated parameter + */ + public Parameter getParameter(String name); + + /** + * Returns the Parameter at index + * + * @param index + * the index of the Parameter + * @return the associated Parameter + */ + public Parameter getParameter(int index); + + /** + * Sets the value of the named Parameter + * + * @param name + * the name of this Parameter + * @param value + * the value for the Parameter + */ + public void setParameterValue(String name, Object value); + + /** + * Sets the value of the associated Parameter + * + * @param index + * the index of the Parameter + * @param value + * the value for the Parameter + */ + public void setParameterValue(int index, Object value); + + /** + * Sets the "type" of the associated Parameter + * + * @param name + * the name of this Parameter + * @param type + * the SDODataTypes-defined "type" for the Parameter. + */ + public void setParameterType(String string, Type dataType); + + /** + * Sets the "type" of the associated Parameter + * + * @param index + * the index of the Parameter + * @param type + * the SDODataTypes-defined "type" for the Parameter. + */ + public void setParameterType(int index, Type dataType); + + /** + * Returns the value of the associated Parameter + * + * @param name + * the name of the Parameter + * @return the value of the Parameter + */ + public Object getParameterValue(String name); + + /** + * Returns the value of the associated Parameter + * + * @param index + * the index of the Parameter + * @return the value of the Parameter + */ + public Object getParameterValue(int index); + + /** + * Adds a Parameter to the command + * + * @param index + * the index of the parameter + * @param sdoType + * the commonj.sdo.Type of the Parameter + */ + public void addParameter(int index, Type sdoType); + + /** + * Adds a Parameter to the command + * + * @param name + * the index of the parameter + * @param sdoType + * the commonj.sdo.Type of the Parameter + */ + public void addParameter(String name, Type sdoType); + + /** + * Adds a Parameter to the command + * + * @param index + * the index of the parameter + * @param direction + * the direction of the Parameter. Either Parameter.IN, + * Parameter.OUT or Parameter.INOUT + * @param sdoType + * specifies the type as a commonj.sdo.Type from + * {@link SDODataTypes} + */ + public void addParameter(int index, int direction, Type sdoType); + + /** + * Adds a Parameter to the command + * + * @param name + * the name associated with the Parameter + * @param direction + * the direction of the Parameter. Either Parameter.IN, + * Parameter.OUT or Parameter.INOUT + * @param sdoType + * specifies the type as a commonj.sdo.Type from + * {@link SDODataTypes} + */ + public void addParameter(String name, int direction, Type sdoType); + + /** + * Specifies an object model for a graph of DataObjects returned by + * #executeQuery() + * + * @param schema + * the model as a commonj.sdo.Type + */ + public void setDataObjectModel(Type schema); + + /** + * Defines the structure of the ResultSet returned by the JDBC Driver when + * this command is executed. If the shape is not specified then the shape is + * taken from the ResultSetMetatadta instance provided by the JDBC Driver. + *

+ * This method is prvided primarily to support platforms (such as Oracle) + * that do not provide complete support for ResultSetMetadata + * + * @param shape + * the specified result set shape + * @see ResultSetShape + */ + public void setResultSetShape(ResultSetShape shape); + + /** + * Provides the java.sql.Connection to be used for this executing this + * command. + * + * @param connection + * the java.sql.Connection + */ + public void setConnection(Connection connection); + + /** + * Provides the java.sql.Connection to be used for this executing this + * command. + * + * @param connection + * the java.sql.Connection + * @param manageTransactions + * true if the DAS should perform tx + * commit/rollback + */ + public void setConnection(Connection connection, boolean manageTransactions); + + /** + * Cleans up and realeases all resources associated with this command. This + * should be called when the application is done with this command. + */ + public void close(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandFactory.java new file mode 100644 index 0000000000..2bf5e4143d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandFactory.java @@ -0,0 +1,93 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.tuscany.das.rdb.config.Config; + +/** + * A CommandFactory produces {@link Command} and {@link ApplyChangesCommand} + * instances. + * + * + */ +public interface CommandFactory { + + /** + * Creates a Command based on the provided SQL statement + * + * @param sql + * The SQL statement + * @return returns a Command instance + */ + public Command createCommand(String sql); + + /** + * Creates a Command based on the provided SQL statement and configuration + * + * @param sql + * The SQL statement + * @param mappingModel + * The congiguration as XML file stream + * @return returns a COmmand instance + */ + public Command createCommand(String sql, InputStream config); + + /** + * Creates a Command based on the provided SQL statement and configuration + * + * @param sql + * The SQL statement + * @param config + * The congiguration as Config instance + * @return returns a COmmand instance + */ + public Command createCommand(String sql, Config config); + + /** + * Creates an {@linkApplyChangesCommand} instance + * + * @return Returns the ApplyChangesCommand instance + */ + public ApplyChangesCommand createApplyChangesCommand(); + + /** + * Creates an {@linkApplyChangesCommand} instance with the provided + * configuration + * + * @param config + * The provided configuration as a stream over an xml file + * @return Returns an ApplyChangesCOmmand in stance + * @throws IOException + */ + public ApplyChangesCommand createApplyChangesCommand(InputStream config) throws IOException; + + + /** + * Creates an {@linkApplyChangesCommand} instance with the provided + * configuration + * + * @param config + * The provided configuration as a Config instance + * @return Returns an ApplyChangesCommand in stance + * @throws IOException + */ + public ApplyChangesCommand createApplyChangesCommand(Config config); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroup.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroup.java new file mode 100644 index 0000000000..c41f9dcfdc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroup.java @@ -0,0 +1,63 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.impl.CommandGroupFactoryImpl; + +/** + * A CommandGroup represents a set of {@link Command} and single + * {@link ApplyChangesCommand} that are created from a common config file. + * + * + */ +public interface CommandGroup { + + public static CommandGroupFactory FACTORY = new CommandGroupFactoryImpl(); + + /** + * Return the ApplyChangesCommnad for this configured factory + * + * @return Returns an instance of ApplyChangesCommand + */ + public ApplyChangesCommand getApplyChangesCommand(); + + /** + * Gets the named command from this factory's inventory + * + * @param name + * The identifying name of the requested command + * @return Returns the identified command + */ + public Command getCommand(String name); + + /** + * Set the default connection for all command in the group + * + * @param connection + */ + public void setConnection(Connection connection); + + /** + * If the CommandGroup is managing connections then this method + * must be called when the client is done with the instance. + * + */ + public void releaseResources(); + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroupFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroupFactory.java new file mode 100644 index 0000000000..dfcdd81823 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/CommandGroupFactory.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb; + +import java.io.InputStream; + +/** + * A CommandGroupFactory produces {@link CommandGroup} instances. + * + * + */ +public interface CommandGroupFactory { + + /** + * Creates a CommandGroup based on the provided config file stream + * + * @param configStream + * A stream over a DAS config file + * @return returns a CommandGroup instance + */ + public CommandGroup createCommandGroup(InputStream configStream); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java new file mode 100644 index 0000000000..c7357fbe09 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ConfigHelper.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb; + +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; + +/** + * A ConfigHelper is used as an aid in programmatic construction of Config instances. + * Manual contrution fo COnfig is an alternative to providing needed configuration + * information in an XML file + * + */public class ConfigHelper { + + private Config config; + + private MappingWrapper configWrapper; + + private ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; + + public ConfigHelper() { + config = factory.createConfig(); + configWrapper = new MappingWrapper(config); + } + + public ConfigHelper(Config config) { + this.config = config; + configWrapper = new MappingWrapper(config); + } + + public Config newInstance() { + return factory.createConfig(); + } + + public void addPrimaryKey(String columnName) { + configWrapper.addPrimaryKey(columnName); + } + + public void addRelationship(String parentName, String childName) { + configWrapper.addRelationship(parentName, childName); + } + + public void addTable(String name, String propertyName) { + configWrapper.addTable(name, propertyName); + } + + public Config getConfig() { + return config; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java new file mode 100644 index 0000000000..eb1ed24230 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Converter.java @@ -0,0 +1,52 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb; + +/** + * A lightweight Table-column <--> DataObject-property converter framework. + * Converters allow a user to insert a transformation between a column value and + * is destination DataObject property value. For example, by default, a VARCHAR + * column will be represented as a String in its corresponding DataObject + * property. A user could insert a converter that transforms the the VARCHAR + * value to an Integer. If this is done then although the column returns + * character data, the DataObject property will be an Integer + * + * + */ +public interface Converter { + + /** + * Transform the columnData object to a new value and possibly new type. + * This should be the invers operation of #getColumnValue + * + * @param columnData + * The column value to transorm + * @return Returns the transformed value + */ + public Object getPropertyValue(Object columnData); + + /** + * Transform the columnData object to a new value and possibly new type. + * This should be the invers operation of #getPropertyValue + * + * @param propertyData + * The property value to transform + * @return Returns the transformed value + */ + public Object getColumnValue(Object propertyData); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Key.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Key.java new file mode 100644 index 0000000000..4622b2a8fb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/Key.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb; + +import java.util.ArrayList; +import java.util.List; + +/** + * A key instance is used to describe a Table key definition. This is used + * primarily for compound keys since simple keys are described with a name. + * + * + */public class Key { + + private List columnNames = new ArrayList(); + + /** + * Contructor for a single column key + * @param columnName The single column fo rthe key + */ + public Key(String columnName) { + super(); + this.columnNames.add(columnName); + } + + /** + * Constructor for a compound key + * @param columns The array of column names that compose the key + */ + public Key(String[] columns) { + for (int i=0;i + * Explicit definition of type is required only for OUT parameters of stored + * procedures commands + * + * @param type + */ + public void setType(Type type); + + /** + * Set the index of the parameter. For example, if a SQL statement requires + * two parameters, the first one has an index of one. + * + * @param index + * The index of the parameter + */ + public void setIndex(int index); + + /** + * Sets the name of the parameter + * + * @param name + * the parameter name + */ + public void setName(String name); + + /** + * Sets the value of the parameter. All IN and IN_OUT parameters must be set + * beore a command can be executed. + * + * @param value + * The value for the parameter + */ + public void setValue(Object value); + + /** + * Parameters are typically IN and this is the default. A parameter's + * direction must be set when the parameter is OUT or IN_OUT. + * + * @param direction + * the parameters direction + */ + public void setDirection(int direction); + + /** + * TODO Not sure this method is needed. + * @param converter + */ + public void setConverter(Converter converter); + + /** + * @return the type of the paramater in terms of {@link SDODataTypes} + */ + public Type getType(); + + /** + * TODO Not sure this is is needed. + * @return + */ + public Converter getConverter(); + + /** + * @return the index of the parameter + */ + public int getIndex(); + + /** + * @return the name of the parameter + */ + public String getName(); + + /** + * @return the value of the parameter + */ + public Object getValue(); + + /** + * @return the direction of the parameter + */ + public int getDirection(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ResultSetShape.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ResultSetShape.java new file mode 100644 index 0000000000..46838778d1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/ResultSetShape.java @@ -0,0 +1,96 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb; + +import java.sql.ResultSetMetaData; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.graphbuilder.schema.ResultSetTypeMap; + +import commonj.sdo.Type; + +/** + * 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; + + public ResultSetShape(String[] t, String[] c, Type[] dataTypes) { + this.columns = c; + this.tables = t; + this.types = dataTypes; + } + + public ResultSetShape(ResultSetMetaData metadata) throws SQLException { + columns = new String[metadata.getColumnCount()]; + tables = new String[metadata.getColumnCount()]; + types = new Type[metadata.getColumnCount()]; + + ResultSetTypeMap typeMap = ResultSetTypeMap.instance; + for (int i = 1; i <= metadata.getColumnCount(); i++) { + tables[i-1] = metadata.getTableName(i); + columns[i-1] = metadata.getColumnName(i); + types[i-1] = typeMap.getType(metadata.getColumnType(i), true); + } + } + + public int getColumnCount() { + return columns.length; + } + + public String getTableName(int i) { + return tables[i-1]; + } + + public String getColumnName(int i) { + return columns[i-1]; + } + + public Type getColumnType(int i) { + return types[i-1]; + } + + + public String toString() { + StringBuffer result = new StringBuffer(); + result.append(" column/table/type: "); + for (int i=0; i < columns.length; i++) { + result.append(columns[i]); + result.append('\t'); + result.append(tables[i]); + result.append('\t'); + if ( types[i] == null ) + result.append("null"); + else + result.append(types[i].getName()); + result.append('\n'); + } + + return result.toString(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/SDODataTypes.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/SDODataTypes.java new file mode 100644 index 0000000000..683d5092c7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/SDODataTypes.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb; + +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; + +/** + * Defines SDO data types. This is used primalirly to type stored procedure OUT parameters. + * + */public class SDODataTypes { + + static TypeHelper helper = TypeHelper.INSTANCE; + + final public static Type BOOLEAN = helper.getType("commonj.sdo", "Boolean"); + final public static Type BYTE = helper.getType("commonj.sdo", "Byte"); + final public static Type BYTES = helper.getType("commonj.sdo", "ByteArray"); + final public static Type CHARACTER = helper.getType("commonj.sdo", "Char"); + final public static Type DATE = helper.getType("commonj.sdo", "Date"); + final public static Type DATETIME = helper.getType("commonj.sdo", "Date"); + final public static Type DAY = helper.getType("commonj.sdo", "Date"); + final public static Type DECIMAL = helper.getType("commonj.sdo", "Float"); + final public static Type DOUBLE =helper.getType("commonj.sdo", "Double"); + final public static Type DURATION = helper.getType("commonj.sdo", "Date"); + final public static Type FLOAT = helper.getType("commonj.sdo", "Float"); + final public static Type INT = helper.getType("commonj.sdo", "Int"); + final public static Type INTEGER = helper.getType("commonj.sdo", "Integer"); + final public static Type LONG = helper.getType("commonj.sdo", "Long"); + final public static Type MONTH = helper.getType("commonj.sdo", "Date"); + final public static Type MONTHDAY = helper.getType("commonj.sdo", "Date"); + final public static Type OBJECT = helper.getType("commonj.sdo", "Object"); + final public static Type SHORT = helper.getType("commonj.sdo", "Short"); + final public static Type STRING = helper.getType("commonj.sdo", "String"); + final public static Type STRINGS = helper.getType("commonj.sdo", "String"); + final public static Type TIME = helper.getType("commonj.sdo", "Date"); + final public static Type URI = helper.getType("commonj.sdo", "String"); + final public static Type YEAR = helper.getType("commonj.sdo", "Date"); + final public static Type YEARMONTH = helper.getType("commonj.sdo", "Date"); + final public static Type YEARMONTHDAY = helper.getType("commonj.sdo", "Date"); + final public static Type BOOLEANOBJECT = helper.getType("commonj.sdo", "BooleanObject"); + final public static Type BYTEOBJECT = helper.getType("commonj.sdo", "ByteObject"); + final public static Type CHARACTEROBJECT = helper.getType("commonj.sdo", "CharacterObject"); + final public static Type DOUBLEOBJECT = helper.getType("commonj.sdo", "DoubleObject"); + final public static Type FLOATOBJECT = helper.getType("commonj.sdo", "FloatObject"); + final public static Type INTEGEROBJECT = helper.getType("commonj.sdo", "IntObject"); + final public static Type LONGOBJECT = helper.getType("commonj.sdo", "LongObject"); + final public static Type SHORTOBJECT = helper.getType("commonj.sdo", "ShortObject"); + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java new file mode 100644 index 0000000000..b9c4dae0be --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java @@ -0,0 +1,411 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.config.wrapper; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Key; +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.KeyPair; +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.Property; + +public class MappingWrapper { + + private static final ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; + + private static final boolean debug = false; + + private Config config; + + public MappingWrapper() { + // Empty Constructor + } + + public MappingWrapper(Config mapping) { + this.config = mapping; + } + + public Config getConfig() { + return this.config; + } + + public Table getTable(String name) { + if (config == null) + return null; + DebugUtil.debugln(getClass(), debug, "Looking for table " + name); + Iterator i = config.getTable().iterator(); + while (i.hasNext()) { + Table t = (Table) i.next(); + if (name.equals(t.getName())) + return t; + } + + return null; + } + + public Table getTableByPropertyName(String name) { + if (config == null) + return null; + DebugUtil.debugln(getClass(), debug, "Looking for table by property: " + name); + Iterator i = config.getTable().iterator(); + while (i.hasNext()) { + Table t = (Table) i.next(); + TableWrapper wrapper = new TableWrapper(t); + if (name.equals(wrapper.getPropertyName())) + return t; + } + return null; + + // throw new RuntimeException("Table with property name " + name + // + " not found."); + + } + + public void addRelationship(String parentName, String childName) { + + if (config == null) + config = factory.createConfig(); + + QualifiedColumn parent = new QualifiedColumn(parentName); + QualifiedColumn child = new QualifiedColumn(childName); + + Relationship r = factory.createRelationship(); + r.setName(child.getTableName()); + r.setPrimaryKeyTable(parent.getTableName()); + r.setForeignKeyTable(child.getTableName()); + DebugUtil.debugln(getClass(), debug, "Created relationship from " + r.getPrimaryKeyTable() + " to " + + r.getForeignKeyTable() + " named " + r.getName()); + + KeyPair pair = factory.createKeyPair(); + pair.setPrimaryKeyColumn(parent.getColumnName()); + pair.setForeignKeyColumn(child.getColumnName()); + + r.getKeyPair().add(pair); + r.setMany(true); + + config.getRelationship().add(r); + + } + + public void addRelationship(Key parentKey, Key childKey) { + + if (config == null) + config = factory.createConfig(); + + QualifiedColumn parent = new QualifiedColumn((String) parentKey.getColumNames().get(0)); + QualifiedColumn child = new QualifiedColumn((String) childKey.getColumNames().get(0)); + + Relationship r = factory.createRelationship(); + r.setName(child.getTableName()); + r.setPrimaryKeyTable(parent.getTableName()); + r.setForeignKeyTable(child.getTableName()); + DebugUtil.debugln(getClass(), debug, "Created relationship from " + r.getPrimaryKeyTable() + " to " + + r.getForeignKeyTable() + " named " + r.getName()); + + Iterator i = parentKey.getColumNames().iterator(); + Iterator j = childKey.getColumNames().iterator(); + while (i.hasNext() && j.hasNext()) { + parent = new QualifiedColumn((String) i.next()); + child = new QualifiedColumn((String) j.next()); + KeyPair pair = factory.createKeyPair(); + pair.setPrimaryKeyColumn(parent.getColumnName()); + pair.setForeignKeyColumn(child.getColumnName()); + + r.getKeyPair().add(pair); + } + r.setMany(true); + config.getRelationship().add(r); + + } + + public void addPrimaryKey(String columnName) { + Key k = new Key(columnName); + addPrimaryKey(k, false); + } + + public void addPrimaryKey(Key key) { + addPrimaryKey(key, false); + } + + public void addGeneratedPrimaryKey(String columnName) { + Key key = new Key(columnName); + addPrimaryKey(key, true); + } + + private void addPrimaryKey(Key key, boolean generated) { + if (config == null) + config = factory.createConfig(); + + Iterator i = key.getColumNames().iterator(); + while (i.hasNext()) { + String columnName = (String) i.next(); + + QualifiedColumn pkColumn = new QualifiedColumn(columnName); + Table t = findOrCreateTable(pkColumn.getTableName()); + Column c = findOrCreateColumn(t, pkColumn.getColumnName()); + c.setPrimaryKey(true); + if (generated) + c.setGenerated(true); + } + } + + public String getTablePropertyName(String tableName) { + Table t = getTable(tableName); + if (t == null) + return tableName; + String propertyName = t.getPropertyName(); + + if (propertyName == null) + return tableName; + + return propertyName; + } + + public Column getColumn(Table t, String name) { + if (t == null) + return null; + Iterator i = t.getColumn().iterator(); + while (i.hasNext()) { + Column c = (Column) i.next(); + if (c.getName().equals(name)) { + return c; + } + } + DebugUtil + .debugln(getClass(), debug, "WARNING: Could not find column " + name + " in table " + t.getName()); + return null; + } + + public Column getColumnByPropertyName(Table t, String propertyName) { + if (t == null) + return null; + Iterator i = t.getColumn().iterator(); + while (i.hasNext()) { + Column c = (Column) i.next(); + if (c.getName().equals(propertyName)) + return c; + if (c.getPropertyName() != null && c.getPropertyName().equals(propertyName)) + return c; + } + DebugUtil.debugln(getClass(), debug, "WARNING: Could not find column " + propertyName + " in table " + + t.getName()); + return null; + } + + public String getColumnPropertyName(String tableName, String columnName) { + Table t = getTable(tableName); + Column c = getColumn(t, columnName); + if (c == null) + return columnName; + + String propertyName = c.getPropertyName(); + if (propertyName == null) + return c.getName(); + + return propertyName; + } + + public void addCollisionColumn(String columnName) { + + if (config == null) + config = factory.createConfig(); + + QualifiedColumn occColumn = new QualifiedColumn(columnName); + Table t = findOrCreateTable(occColumn.getTableName()); + Column c = findOrCreateColumn(t, occColumn.getColumnName()); + c.setCollision(true); + + config.getTable().add(t); + } + + public void addTable(String tableName, String propertyName) { + Table table = getTable(tableName); + if (table != null) + throw new Error("Table " + tableName + "already exists"); + + table = ConfigFactoryImpl.eINSTANCE.createTable(); + table.setName(tableName); + table.setPropertyName(propertyName); + config.getTable().add(table); + + } + + private Table findOrCreateTable(String tableName) { + Table table = getTable(tableName); + if (table == null) { + table = ConfigFactoryImpl.eINSTANCE.createTable(); + table.setName(tableName); + config.getTable().add(table); + } + return table; + + } + + private Column findOrCreateColumn(Table t, String name) { + Iterator i = t.getColumn().iterator(); + while (i.hasNext()) { + Column c = (Column) i.next(); + if (name.equals(c.getName())) + return c; + } + + Column c = ConfigFactoryImpl.eINSTANCE.createColumn(); + c.setName(name); + t.getColumn().add(c); + return c; + } + + public boolean hasRecursiveRelationships() { + if (config != null) { + Iterator i = getConfig().getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + if (r.getPrimaryKeyTable().equals(r.getForeignKeyTable())) + return true; + } + } + return false; + } + + public Collection getRelationshipsByChildTable(String name) { + ArrayList results = new ArrayList(); + if (config != null) { + Iterator i = getConfig().getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + if (name.equals(r.getForeignKeyTable())) + results.add(r); + } + } + return results; + } + + // TODO optimize + public ArrayList getInsertOrder() { + DebugUtil.debugln(getClass(), debug, "Getting insert order"); + ArrayList inserts = new ArrayList(); + HashMap parentToChild = new HashMap(); + + ArrayList parents = new ArrayList(); + ArrayList children = new ArrayList(); + if (config != null) { + Iterator i = getConfig().getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + parents.add(r.getPrimaryKeyTable()); + children.add(r.getForeignKeyTable()); + parentToChild.put(r.getPrimaryKeyTable(), r.getForeignKeyTable()); + } + + while (parents.size() > 0) { + String parent = (String) parents.get(0); + if (!children.contains(parent)) { + if (!inserts.contains(parent)) + inserts.add(parent); + + String child = (String) parentToChild.get(parent); + if (!inserts.contains(child)) + inserts.add(child); + + parents.remove(parent); + children.remove(child); + } else { + parents.add(parents.remove(0)); + } + } + inserts.addAll(children); + + } + + DebugUtil.debugln(getClass(), debug, inserts); + return inserts; + } + + public ArrayList getDeleteOrder() { + ArrayList deleteOrder = new ArrayList(); + deleteOrder.addAll(getInsertOrder()); + Collections.reverse(deleteOrder); + return deleteOrder; + } + + public void addConverter(String name, String converter) { + if (config == null) + config = factory.createConfig(); + + QualifiedColumn column = new QualifiedColumn(name); + Table t = findOrCreateTable(column.getTableName()); + Column c = findOrCreateColumn(t, column.getColumnName()); + c.setConverterClassName(converter); + + } + + public String getConverter(String tableName, String columnName) { + Table t = getTable(tableName); + Column c = getColumn(t, columnName); + if (c != null) + return c.getConverterClassName(); + return null; + } + + public HashMap getConverters(Table table) { + HashMap converters = new HashMap(); + + Iterator columns = table.getColumn().iterator(); + while (columns.hasNext()) { + Column c = (Column) columns.next(); + if (c.getConverterClassName() != null) { + String property = c.getPropertyName(); + if (property == null) + property = c.getName(); + converters.put(property, c.getConverterClassName()); + } + } + return converters; + } + + public Relationship getRelationshipByReference(Property ref) { + Iterator i = config.getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + if (ref.getName().equals(r.getName()) || ref.getOpposite().getName().equals(r.getName())) + return r; + } + throw new RuntimeException("Could not find relationship " + ref.getName() + " in the configuration"); + } + + public Relationship getRelationshipByName(String name) { + Iterator i = config.getRelationship().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + if (name.equals(r.getName())) + return r; + } + throw new RuntimeException("Could not find relationship " + name + " in the configuration"); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java new file mode 100644 index 0000000000..6babe0c349 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/QualifiedColumn.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.config.wrapper; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + +public class QualifiedColumn { + + private final String tableName; + private final String columnName; + private static boolean debug = false; + + public QualifiedColumn(String name) { + tableName = name.substring(0, name.indexOf('.')); + columnName = name.substring(name.indexOf('.') + 1); + DebugUtil.debugln(getClass(), debug, tableName); + DebugUtil.debugln(getClass(), debug, columnName); + } + + public String getTableName() { + return this.tableName; + } + + public String getColumnName() { + return this.columnName; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java new file mode 100644 index 0000000000..14403367d8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/RelationshipWrapper.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.config.wrapper; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.config.KeyPair; +import org.apache.tuscany.das.rdb.config.Relationship; + +public class RelationshipWrapper { + + private Relationship relationship; + + public RelationshipWrapper(Relationship r) { + this.relationship = r; + } + + public Collection getForeignKeys() { + ArrayList keys = new ArrayList(); + Iterator i = this.relationship.getKeyPair().iterator(); + while ( i.hasNext()) { + KeyPair pair = (KeyPair) i.next(); + keys.add(pair.getForeignKeyColumn()); + } + return keys; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java new file mode 100644 index 0000000000..2c2d1dc677 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/TableWrapper.java @@ -0,0 +1,124 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.config.wrapper; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Table; + +public class TableWrapper { + + private Table table; + + public TableWrapper(Table table) { + this.table = table; + } + + public String getPropertyName() { + return table.getPropertyName() == null ? table.getName() : table + .getPropertyName(); + } + + public Collection getPrimaryKeyNames() { + ArrayList pkNames = new ArrayList(); + Iterator i = table.getColumn().iterator(); + while (i.hasNext()) { + Column c = (Column) i.next(); + if (c.isPrimaryKey()) + pkNames.add(c.getName()); + } + return pkNames; + } + + public Collection getPrimaryKeyProperties() { + + ArrayList keyProperties = new ArrayList(); + Iterator columns = table.getColumn().iterator(); + while (columns.hasNext()) { + Column c = (Column) columns.next(); + if (c.isPrimaryKey()) { + keyProperties.add(getColumnPropertyName(c)); + } + } + + return keyProperties; + } + + private String getColumnPropertyName(Column c) { + if (c.getPropertyName() != null) + return c.getPropertyName(); + else + return c.getName(); + } + + public boolean isGeneratedColumnProperty(String name) { + Column c = getColumnByPropertyName(name); + return c == null ? false : c.isGenerated(); + } + + // public Object getColumnNameByProperty(String propertyName) { + // Iterator i = table.getColumn().iterator(); + // while (i.hasNext()) { + // Column c = (Column) i.next(); + // if (propertyName.equals(c.getPropertyName())) + // return c.getName(); + // } + // return propertyName; + // } + + 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.getName(); + if (propertyName.equals(property)) + return c; + } + + return null; + } + + public Column getCollisionColumn() { + Iterator columns = table.getColumn().iterator(); + while (columns.hasNext()) { + Column c = (Column) columns.next(); + if ( c.isCollision() ) + return c; + } + + return null; + + } + + public String getCollisionColumnPropertyName() { + Column c = getCollisionColumn(); + if ( c.getPropertyName() != null ) + return c.getPropertyName(); + else + return c.getName(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/CudGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/CudGenerator.java new file mode 100644 index 0000000000..411104fa3f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/CudGenerator.java @@ -0,0 +1,64 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.generator.impl; + +import java.util.Collection; + +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.impl.DeleteCommandImpl; +import org.apache.tuscany.das.rdb.impl.InsertCommandImpl; +import org.apache.tuscany.das.rdb.impl.UpdateCommandImpl; + +import commonj.sdo.DataObject; + +public class CudGenerator { + + private static final UpdateGenerator updateGenerator = UpdateGenerator.instance; + + private static final InsertGenerator insertGenerator = InsertGenerator.instance; + + private static final DeleteGenerator deleteGenerator = DeleteGenerator.instance; + + public DeleteCommandImpl getDeleteCommand(Table t) { + return deleteGenerator.getDeleteCommand(t); + } + + public Collection getDeleteParameters(Table table) { + return deleteGenerator.getDeleteParameters(table); + } + + public Collection getCreateParameters(MappingWrapper mapping, DataObject changedObject, Table table) { + return insertGenerator.getInsertParameters(mapping, changedObject, table); + } + + public InsertCommandImpl getInsertCommand(MappingWrapper mapping, DataObject changedObject, + Table table) { + return insertGenerator.getInsertCommand(mapping, changedObject, table); + } + + public UpdateCommandImpl getUpdateCommand(MappingWrapper mapping, + DataObject changedObject, Table table) { + return updateGenerator.getUpdateCommand(mapping, changedObject, table); + } + + public Collection getUpdateParameters(DataObject changedObject, Table table) { + return updateGenerator.getUpdateParameters(changedObject, table); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java new file mode 100644 index 0000000000..c2d312b56d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/DeleteGenerator.java @@ -0,0 +1,98 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.generator.impl; + +import java.util.Collection; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; +import org.apache.tuscany.das.rdb.impl.DeleteCommandImpl; +import org.apache.tuscany.das.rdb.impl.ParameterImpl; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +public class DeleteGenerator { + + public static final DeleteGenerator instance = new DeleteGenerator(); + + private static final boolean debug = false; + + public DeleteGenerator() { + super(); + } + + public String getDeleteStatement(Table t) { + TableWrapper table = new TableWrapper(t); + + StringBuffer statement = new StringBuffer(); + statement.append("delete from "); + statement.append(t.getName()); + statement.append(" where "); + + Iterator names = table.getPrimaryKeyNames().iterator(); + Iterator properties = table.getPrimaryKeyProperties().iterator(); + while (names.hasNext() && properties.hasNext()) { + String name = (String) names.next(); + statement.append(name); + statement.append(" = ?"); + if (names.hasNext() && properties.hasNext()) + statement.append(" and "); + } + + DebugUtil.debugln(getClass(), debug, statement.toString()); + return statement.toString(); + } + + public Collection getDeleteParameters(Table table) { + TableWrapper wrapper = new TableWrapper(table); + return wrapper.getPrimaryKeyProperties(); + } + + public DeleteCommandImpl getDeleteCommand(Table t) { + DeleteCommandImpl deleteCommand = new DeleteCommandImpl(getDeleteStatement(t)); + + Iterator i = getDeleteParameters(t).iterator(); + for(int idx=1; i.hasNext(); idx++) { + String property = (String) i.next(); + Parameter p = new ParameterImpl(); + p.setName(property); + p.setType(SDODataTypes.OBJECT); + p.setConverter(getConverter(t, property)); + p.setIndex(idx); + deleteCommand.addParameter(p); + } + return deleteCommand; + } + + private Converter getConverter(Table t, String name) { + TableWrapper tw = new TableWrapper(t); + String converter = tw.getConverter(name); + if ( converter != null ) { + try { + return (Converter) Class.forName(converter).newInstance(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + return null; + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java new file mode 100644 index 0000000000..5653b23aa2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/InsertGenerator.java @@ -0,0 +1,179 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.generator.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.RelationshipWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; +import org.apache.tuscany.das.rdb.impl.InsertCommandImpl; +import org.apache.tuscany.das.rdb.impl.ParameterImpl; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; + +public class InsertGenerator { + + public static final InsertGenerator instance = new InsertGenerator(); + + private static final boolean debug = false; + + public InsertGenerator() { + super(); + } + + public InsertCommandImpl getInsertCommand(MappingWrapper config, + DataObject changedObject, Table t) { + ArrayList parameters = new ArrayList(); + TableWrapper table = new TableWrapper(t); + StringBuffer statement = new StringBuffer("insert into "); + statement.append(t.getName()); + + Iterator i = getAttributeProperties(changedObject, config).iterator(); + + ArrayList attributes = new ArrayList(); + while (i.hasNext()) { + Property attr = (Property) i.next(); + if (!table.isGeneratedColumnProperty(attr.getName())) { + attributes.add(attr.getName()); + parameters.add(changedObject.getType().getProperty( + attr.getName())); + } + } + + statement.append("("); + Iterator attrs = attributes.iterator(); + while (attrs.hasNext()) { + String name = (String) attrs.next(); + statement.append(""); + statement.append(name); + if (attrs.hasNext()) + statement.append(", "); + else + statement.append(")"); + } + + statement.append(" values ("); + for (int idx = 1; idx <= attributes.size(); idx++) { + statement.append('?'); + if (idx < attributes.size()) + statement.append(", "); + else + statement.append(")"); + } + + InsertCommandImpl cmd = new InsertCommandImpl(statement.toString()); + Iterator params = parameters.iterator(); + for (int idx = 1; params.hasNext(); idx++) { + Property property = (Property) params.next(); + Parameter p = new ParameterImpl(); + p.setName(property.getName()); + p.setType(property.getType()); + p.setConverter(getConverter(table, property.getName())); + p.setIndex(idx); + cmd.addParameter(p); + + } + DebugUtil.debugln(getClass(), debug, statement.toString()); + return cmd; + + } + + private Converter getConverter(TableWrapper tw, String name) { + String converter = tw.getConverter(name); + if ( converter != null ) { + try { + return (Converter) Class.forName(converter).newInstance(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + return null; + } + + private List getAttributeProperties(DataObject obj, MappingWrapper config) { + ArrayList fields = new ArrayList(); + Iterator i = obj.getType().getProperties().iterator(); + while (i.hasNext()) { + Property p = (Property) i.next(); + if (p.getType().isDataType()) { + if (obj.isSet(p)) + fields.add(p); + } else { + if ( obj.isSet(p) ) { + Relationship relationship = config.getRelationshipByReference(p); + if ( p.getOpposite().isMany() || (hasState(config, relationship, obj))) { + RelationshipWrapper r = new RelationshipWrapper( + relationship); + Iterator keys = r.getForeignKeys().iterator(); + while (keys.hasNext()) { + String key = (String) keys.next(); + Property keyProp = obj.getType().getProperty(key); + fields.add(keyProp); + } + } + + } + } + } + + return fields; + + } + + public Collection getInsertParameters(MappingWrapper config, + DataObject changedObject, Table table) { + ArrayList parameters = new ArrayList(); + TableWrapper wrapper = new TableWrapper(table); + + Iterator i = getAttributeProperties(changedObject, config).iterator(); + + while (i.hasNext()) { + Property attr = (Property) i.next(); + if (!wrapper.isGeneratedColumnProperty(attr.getName())) + parameters.add(changedObject.getType().getProperty( + attr.getName())); + } + + return parameters; + } + + private boolean hasState(MappingWrapper config, Relationship rel, DataObject changedObject) { + + if ( !rel.isMany()) { + Table t = config.getTableByPropertyName(changedObject.getType().getName()); + TableWrapper tw = new TableWrapper(t); + RelationshipWrapper rw = new RelationshipWrapper(rel); + if (( rel.getForeignKeyTable().equals(t.getName())) && + ( Collections.disjoint(tw.getPrimaryKeyProperties(),rw.getForeignKeys()) )) + return true; + } + + return false; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java new file mode 100644 index 0000000000..3243ba2388 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/generator/impl/UpdateGenerator.java @@ -0,0 +1,206 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.generator.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.RelationshipWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; +import org.apache.tuscany.das.rdb.impl.OptimisticWriteCommandImpl; +import org.apache.tuscany.das.rdb.impl.ParameterImpl; +import org.apache.tuscany.das.rdb.impl.UpdateCommandImpl; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +public class UpdateGenerator { + + private boolean debug = false; + + public static UpdateGenerator instance = new UpdateGenerator(); + + public UpdateGenerator() { + super(); + } + + public UpdateCommandImpl getUpdateCommand(MappingWrapper mapping, DataObject changedObject, Table table) { + ArrayList parameters = new ArrayList(); + Type type = changedObject.getType(); + TableWrapper t = new TableWrapper(table); + StringBuffer statement = new StringBuffer("update "); + statement.append(table.getName()); + statement.append(" set "); + + + ChangeSummary summary = changedObject.getDataGraph().getChangeSummary(); + Iterator i = getChangedFields(mapping, summary, changedObject).iterator(); + + while (i.hasNext()) { + Property attr = (Property) i.next(); + Column c = t.getColumnByPropertyName(attr.getName()); + if ((c != null) && (c.isCollision() || c.isPrimaryKey())) { + // get rid of comma if OCC or PK is last field + if (!i.hasNext()) { + statement + .delete(statement.length() - 2, statement.length()); + } + } else { + parameters.add(attr); + statement.append(c == null ? attr.getName() : c.getName()); + statement.append(" = ?"); + if (i.hasNext()) + statement.append(", "); + } + } + + statement.append(" where "); + + Iterator names = t.getPrimaryKeyNames().iterator(); + Iterator properties = t.getPrimaryKeyProperties().iterator(); + while (names.hasNext() && properties.hasNext()) { + String name = (String) names.next(); + String property = (String) properties.next(); + statement.append(name); + statement.append(" = ?"); + if (names.hasNext() && properties.hasNext()) + statement.append(" and "); + parameters.add(type.getProperty(property)); + } + + if (t.getCollisionColumn() != null) { + statement.append(" and "); + statement.append(t.getCollisionColumn().getName()); + statement.append(" = ?"); + parameters.add(type.getProperty(t.getCollisionColumnPropertyName())); + } + + + UpdateCommandImpl updateCommand; + if ( t.getCollisionColumn() != null ) + updateCommand = new OptimisticWriteCommandImpl(statement.toString()); + else + updateCommand = new UpdateCommandImpl(statement.toString()); + + Iterator params = parameters.iterator(); + for (int idx = 1; params.hasNext(); idx++ ) { + Property p = (Property)params.next(); + Parameter param = new ParameterImpl(); + param.setName(p.getName()); + param.setType(p.getType()); + param.setConverter(getConverter(t, p.getName())); + param.setIndex(idx); + updateCommand.addParameter(param); + } + DebugUtil.debugln(getClass(), debug, statement.toString()); + return updateCommand; + } + + private List getAttributeProperties(DataObject obj) { + ArrayList fields = new ArrayList(); + Iterator i = obj.getType().getProperties().iterator(); + while ( i.hasNext() ) { + Property p = (Property) i.next(); + if ( p.getType().isDataType()) + fields.add(p); + } + return fields; + } + + + private List getChangedFields(MappingWrapper mapping, ChangeSummary summary, DataObject obj) { + ArrayList changes = new ArrayList(); + Iterator i = summary.getOldValues(obj).iterator(); + while (i.hasNext()) { + ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next(); + if (setting.getProperty().getType().isDataType()) { + changes.add(setting.getProperty()); + } else { + Property ref = setting.getProperty(); + if ( !ref.isMany() ) { + RelationshipWrapper r = new RelationshipWrapper(mapping.getRelationshipByReference(ref)); + + Iterator keys = r.getForeignKeys().iterator(); + while ( keys.hasNext()) { + String key = (String) keys.next(); + Property p = obj.getType().getProperty(key); + changes.add(p); + } + } + + } + } + return changes; + } + + + private Converter getConverter(TableWrapper tw, String name) { + String converter = tw.getConverter(name); + if ( converter != null ) { + try { + return (Converter) Class.forName(converter).newInstance(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + return null; + } + + public Collection getUpdateParameters(DataObject changedObject, Table table) { + Type type = changedObject.getType(); + TableWrapper wrapper = new TableWrapper(table); + Collection pkNames = wrapper.getPrimaryKeyProperties(); + ArrayList parameters = new ArrayList(); + ArrayList pkParams = new ArrayList(); + + Iterator i = getAttributeProperties(changedObject).iterator(); + while (i.hasNext()) { + Property attr = (Property) i.next(); + String field = attr.getName(); + + Parameter p = getParameter(wrapper, type.getProperty(field)); + if (pkNames.contains(field)) { + pkParams.add(p); + } else { + parameters.add(p); + } + } + parameters.addAll(pkParams); + return parameters; + + } + + private Parameter getParameter(TableWrapper wrapper, Property property) { + Parameter param = new ParameterImpl(); + param.setName(property.getName()); + param.setType(property.getType()); + param.setConverter(getConverter(wrapper, property.getName())); + + return param; + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java new file mode 100644 index 0000000000..2d58c0f269 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DataObjectMaker.java @@ -0,0 +1,120 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; + +public class DataObjectMaker { + + private final DataObject rootObject; + + private boolean debug = false; + + public DataObjectMaker(DataObject root) { + this.rootObject = root; + } + + /** + * @param tableData + * @return + */ + public DataObject createAndAddDataObject(TableData tableData, + ResultMetadata resultMetadata) { + // Get a Type from the package and create a standalone DataObject + + DebugUtil.debugln(getClass(), this.debug, "Looking for Type for " + + tableData.getTableName()); + + Type tableClass = findTableTypeByPropertyName(tableData.getTableName()); + + if (tableClass == null) + throw new RuntimeException("An SDO Type with name " + + tableData.getTableName() + " was not found"); + + DataObject obj = DataFactory.INSTANCE.create(tableClass); + + // Now, check to see if the root data object has a containment reference + // to this EClass. If so, add it to the graph. If not, it will be taken + // care + // of when we process relationships + + Iterator i = this.rootObject.getType().getProperties().iterator(); + while (i.hasNext()) { + Property p = (Property) i.next(); + + if (p.isContainment() && p.getType().equals(tableClass)) { + if (p.isMany()) + rootObject.getList(p).add(obj); + // TODO This was a performance optimization for EMF in SDO 1.1, + // check to see if there is + // something equivalent in SDO 2.0 + // ((InternalEList) this.dataGraph.eGet(ref)).addUnique(obj); + else + this.rootObject.set(p, obj); + } + + } + + Iterator columnNames = resultMetadata.getColumnNames( + tableData.getTableName()).iterator(); + while (columnNames.hasNext()) { + String columnName = (String) columnNames.next(); + DataObject dataObject = (DataObject) obj; + Property p = findProperty(dataObject.getType(), columnName); + Object value = tableData.getColumnData(columnName); + + dataObject.set(p, value); + } + + return obj; + } + + // temporary, ignoring case + private Property findProperty(Type type, String columnName) { + Iterator properties = type.getProperties().iterator(); + while (properties.hasNext()) { + Property p = (Property) properties.next(); + if (columnName.equalsIgnoreCase(p.getName())) + return p; + } + return null; + } + + private Type findTableTypeByPropertyName(String tableName) { + Iterator i = rootObject.getType().getProperties().iterator(); + while (i.hasNext()) { + Property p = (Property) i.next(); + // System.out.println(p.getType().getName()); + if (tableName.equals(p.getType().getName())) + return p.getType(); + } + + return null; + } + + private Type findTableTypeByRootReference(String refName) { + return rootObject.getProperty(refName).getType(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java new file mode 100644 index 0000000000..54c536d95c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/DefaultConverter.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.sql.Blob; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.Converter; + + +public class DefaultConverter implements Converter { + + public DefaultConverter() { + super(); + } + + public Object getColumnValue(Object data) { + return data; + } + + public Object getPropertyValue(Object data) { +// if (type.isInstance(data)) +// return data; +// +// if ( data == null ) +// return null; +// +// String name = type.getInstanceClass().getName(); +// if (name == "java.lang.Byte" || name == "byte") { +// return new Byte(data.toString()); +// } +// +// else if (name == "java.lang.Double" || name == "double") { +// return new Double(data.toString()); +// } +// +// else if (name == "java.lang.Float" || name == "float") { +// return new Float(data.toString()); +// } +// +// else if (name == "java.lang.Integer" || name == "int") { +// return new Integer(data.toString()); +// } +// +// else if (name == "java.lang.Long" || name == "long") { +// return new Long(data.toString()); +// } +// +// else if (name == "java.lang.Short" || name == "short") { +// return new Short(data.toString()); +// } +// +// else if (name == "java.lang.String") { +// return String.valueOf(data.toString()); +// } + + if ( data instanceof Blob ) { + Blob b = (Blob) data; + try { + return b.getBytes(1, (int)b.length()); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } else { + return data; + } + + + +// else { +// +// throw new IllegalArgumentException("The database value of type " +// + data.getClass().getName() + " must be converted to type " +// + type.getInstanceClass().getName()); +// } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java new file mode 100644 index 0000000000..6247dea757 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/GraphBuilderMetadata.java @@ -0,0 +1,98 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.ResultSetShape; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.graphbuilder.schema.ESchemaMaker; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.Type; + + +/** + */ +public class GraphBuilderMetadata { + + private Config mappingModel; + private final Collection resultSets = new ArrayList(); + private boolean debug = false; + private Type schema; + + + public GraphBuilderMetadata(Collection results, Type schema, Config model, ResultSetShape shape) throws SQLException { + this.mappingModel = model; + this.schema = schema; + + Iterator i = results.iterator(); + while (i.hasNext()) { + ResultSet rs = (ResultSet) i.next(); + ResultMetadata resultMetadata = new ResultMetadata(rs, mappingModel, shape); + resultSets.add(resultMetadata); + } + + DebugUtil.debugln(getClass(), debug, "Mapping model: " + mappingModel); + } + + + public Collection getResultMetadata() { + return this.resultSets; + } + + + public boolean hasMappingModel() { + return mappingModel == null ? false : true; + } + + + /** + * @return + */ + + public Collection getRelationships() { + if (!hasMappingModel()) { + DebugUtil.debugln(getClass(), debug, "No relationships to return"); + return Collections.EMPTY_LIST; + } + + return mappingModel.getRelationship(); + } + + + /** + * @return + */ + public Type getSchema() { + if ( this.schema == null ) { + ESchemaMaker schemaMaker = new ESchemaMaker(this); + return schemaMaker.createTypes(); + } else { + return this.schema; + } + } + + public Config getMapping() { + return this.mappingModel; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java new file mode 100644 index 0000000000..142aee5c60 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/MultiTableRegistry.java @@ -0,0 +1,105 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; + + + +/** + * + * Used to store and look up table objects based on primary key + * This could be a lot more efficient if we could use LinkedHashMap from JDK 1.4 + */ +public class MultiTableRegistry implements TableRegistry { + + private HashMap tableNameMap; + private HashMap tableValueMap; + private boolean debug = false; + + + public MultiTableRegistry() { + tableNameMap = new HashMap(); + tableValueMap = new HashMap(); + } + + + + /** + * Get the table with the specified name and primary key + * @param tableName + * @param primaryKey + * @return EDataObject + */ + public DataObject get(String tableName, List primaryKey) { + if ( debug ) { + DebugUtil.debugln(getClass(), debug, "Looking for table " + tableName + " with PK " + primaryKey); + DebugUtil.debugln(getClass(), debug, ("\tReturning " + getPkMap(tableName).get(primaryKey))); + } + return (DataObject) getPkMap(tableName).get(primaryKey); + } + + /** + * Add the table with the specified name and primary key + * @param tableName + * @param primaryKey + * @param value + */ + public void put(String tableName, List primaryKey, DataObject value) { + if ( getPkMap(tableName).put(primaryKey, value) == null ) + getCreateValueList(tableName).add(value); + } + + /** + * Get the HashMap that contains the primary key to table object + * mappings. + * @param tableName + * @return HashMap + */ + private HashMap getPkMap(String tableName) { + HashMap pkMap = (HashMap)tableNameMap.get(tableName); + if ( pkMap == null ) { + pkMap = new HashMap(); + tableNameMap.put(tableName, pkMap); + } + return pkMap; + } + + private List getCreateValueList(String tableName) { + List values = (List) tableValueMap.get(tableName); + if ( values == null ) { + values = new ArrayList(); + tableValueMap.put(tableName, values); + } + return values; + } + + + + public boolean contains(String tableName, List primaryKey) { + return get(tableName,primaryKey) == null ? false : true; + + } + + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java new file mode 100644 index 0000000000..04c873db13 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java @@ -0,0 +1,293 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.ResultSetShape; +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.util.DebugUtil; + +import commonj.sdo.Type; + +public class ResultMetadata { + + private HashMap tableToColumnMap = new HashMap(); + + private ArrayList tablePropertyNames = new ArrayList(); + + private ArrayList columnPropertyNames = new ArrayList(); + + private final ResultSet resultSet; + + private final ResultSetShape resultSetShape; + + private final MappingWrapper mappingWrapper; + + private Converter[] converters; + + private static boolean debug = false; + + public ResultMetadata(ResultSet rs, Config model, ResultSetShape shape) + throws SQLException { + debug("Creating new ResultMetadata with mapping model " + model); + this.resultSet = rs; + this.mappingWrapper = new MappingWrapper(model); + + if (shape == null) + this.resultSetShape = new ResultSetShape(rs.getMetaData()); + else + this.resultSetShape = shape; + + this.converters = new Converter[resultSetShape.getColumnCount()]; + + for (int i = 1; i <= resultSetShape.getColumnCount(); i++) { + String tableName = resultSetShape.getTableName(i); + + String tableProperty = mappingWrapper + .getTablePropertyName(tableName); + String columnProperty = mappingWrapper.getColumnPropertyName( + tableName, resultSetShape.getColumnName(i)); + String converter = mappingWrapper.getConverter(tableName, + resultSetShape.getColumnName(i)); + if (converter != null) { + + try { + + Class converterClazz= Class.forName(converter, true, Thread.currentThread().getContextClassLoader()); + if(null != converterClazz) + converters[i - 1]= (Converter) converterClazz.newInstance(); + + }catch( Exception e){ + //try loading below.... + converters[i - 1]= null; //safety + } + + + if(null == converters[i - 1] ) + try{ + + + Converter convInstance = (Converter) Class.forName( + converter).newInstance(); + converters[i - 1] = convInstance; + } catch (Exception ex) { + throw new RuntimeException(ex); + } + + } else { + // TODO make static + converters[i - 1] = new DefaultConverter(); + } + DebugUtil.debugln(getClass(), debug, "Adding table/column: " + + tableProperty + "/" + columnProperty); + tablePropertyNames.add(tableProperty); + columnPropertyNames.add(columnProperty); + + Collection columns = (Collection) tableToColumnMap + .get(tableProperty); + if (columns == null) + columns = new ArrayList(); + columns.add(columnProperty); + tableToColumnMap.put(tableProperty, columns); + } + + // Add any tables defined in the model but not included in the ResultSet + // to the list of propertyNames + if (model != null) { + Iterator tablesFromModel = model.getTable().iterator(); + while (tablesFromModel.hasNext()) { + TableWrapper t = new TableWrapper((Table) tablesFromModel + .next()); + if (tableToColumnMap.get(t.getPropertyName()) == null) + tableToColumnMap.put(t.getPropertyName(), + Collections.EMPTY_LIST); + } + } + + if (debug) { + DebugUtil.debugln(getClass(), debug, toString()); + DebugUtil + .debugln(getClass(), debug, this.resultSetShape.toString()); + } + + } + + private void debug(Object string) { + if (debug) + DebugUtil.debugln(getClass(), debug, string); + } + + public Collection getColumnNames() { + return columnPropertyNames; + } + + public String getColumnPropertyName(int i) { + return (String) columnPropertyNames.get(i - 1); + } + + public String getDatabaseColumnName(int i) { + return resultSetShape.getColumnName(i); + } + + public String getTableName(String columnName) { + return (String) tablePropertyNames.get(columnPropertyNames + .indexOf(columnName)); + } + + public int getTableSize(String tableName) { + return ((Collection) tableToColumnMap.get(tableName)).size(); + } + + public Type getDataType(String columnName) { + return resultSetShape.getColumnType(columnPropertyNames + .indexOf(columnName)); + } + + public String getTablePropertyName(int i) { + return (String) tablePropertyNames.get(i - 1); + } + + public Collection getAllTablePropertyNames() { + return tableToColumnMap.keySet(); + } + + public String toString() { + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (Table Names: "); + Iterator i = tablePropertyNames.iterator(); + while (i.hasNext()) { + String tableName = (String) i.next(); + result.append(' '); + result.append(tableName); + result.append(','); + } + + result.append(" columnNames: "); + + i = columnPropertyNames.iterator(); + while (i.hasNext()) { + String columnName = (String) i.next(); + result.append(' '); + result.append(columnName); + result.append(','); + } + + result.append(" mappingModel: "); + result.append(this.mappingWrapper.getConfig()); + + result.append(" resultSet: "); + result.append(resultSet); + + result.append(" resultSetSize: "); + result.append(resultSetShape.getColumnCount()); + result.append(')'); + return result.toString(); + + } + + /** + * @return + */ + public int getNumberOfTables() { + return tableToColumnMap.keySet().size(); + } + + /** + * Return whether the column at the given position is part of a primary key. + * If we don't have this information, we assume every column is a primary + * key. This results in uniqueness checks using all columns in a table. + * + * @param i + * @return + */ + public boolean isPKColumn(int i) { + if (debug) { + DebugUtil.debugln(getClass(), debug, "Checking to see if " + + getColumnPropertyName(i) + " is a PK column in " + + getTablePropertyName(i)); + } + if (!hasMappingModel()) { + if (debug) + DebugUtil + .debugln(getClass(), debug, + "No mapping model exists, all columns will be considered PK columns"); + return true; + } else { + Table t = mappingWrapper.getTable(getTablePropertyName(i)); + if (t == null) + return true; + Column c = mappingWrapper.getColumn(t, getDatabaseColumnName(i)); + + if (c == null) + return false; + + if (c.isPrimaryKey()) + return true; + } + return false; + } + + public boolean hasMappingModel() { + return mappingWrapper.getConfig() == null ? false : true; + } + + /** + * @param i + * @return + */ + public Type getDataType(int i) { + return resultSetShape.getColumnType(i); + } + + /** + * @param tableName + * @return + */ + public Collection getColumnNames(String tableName) { + return (Collection) tableToColumnMap.get(tableName); + } + + public ResultSet getResultSet() { + return this.resultSet; + } + + public int getResultSetSize() { + return resultSetShape.getColumnCount(); + } + + public boolean isRecursive() { + return mappingWrapper.hasRecursiveRelationships(); + } + + public Converter getConverter(int i) { + return converters[i - 1]; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java new file mode 100644 index 0000000000..8ccc0aee12 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetProcessor.java @@ -0,0 +1,137 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; + +/** + * + * A ResultSetProcessor is used to transform the data in a ResultSet into a set + * of inter-related EDataObjects. + */ +public class ResultSetProcessor { + + private TableRegistry registry; + + private GraphBuilderMetadata metadata; + + private boolean debug = false; + + private final DataObjectMaker doMaker; + + public ResultSetProcessor(DataObject g, GraphBuilderMetadata gbmd) { + + this.metadata = gbmd; + if (metadata.getRelationships().size() == 0) + registry = new SingleTableRegistry(); + else + registry = new MultiTableRegistry(); + + doMaker = new DataObjectMaker(g); + + debug(metadata); + + } + + private void debug(Object output) { + DebugUtil.debugln(getClass(), debug, output); + } + + /** + * Process the ResultSet. For each row in the ResultSet, a + * + * @link ResultSetRow object will be created to represent the row as a set + * of EDataObjects. Then, the relevant relationships will be + * constructed between each object in the + * @link ResultSetRow. + * + * @param rs + * The ResultSet + */ + public void processResults(int start, int end) throws SQLException { + + Iterator i = metadata.getResultMetadata().iterator(); + while ( i.hasNext()) { + ResultMetadata resultMetadata = (ResultMetadata)i.next(); + ResultSet results = resultMetadata.getResultSet(); + + processResultSet(results, resultMetadata, start, end); + + //TODO These statements HAVE to be closed or we will have major problems + //results.getStatement().close(); + results.close(); + } + + } + + + private void processResultSet(ResultSet rs, ResultMetadata rsMetadata, + int start, int end) throws SQLException { + + if ( rs.getType() == ResultSet.TYPE_FORWARD_ONLY) { + while (rs.next() && start < end) { + ResultSetRow rsr = new ResultSetRow(rs, rsMetadata); + addRowToGraph(rsr, rsMetadata); + ++start; + } + } else { + while (rs.absolute(start) && start < end) { + ResultSetRow rsr = new ResultSetRow(rs, rsMetadata); + addRowToGraph(rsr, rsMetadata); + ++start; + } + } + } + + /** + * @param row + * @param resultMetadata + */ + private void addRowToGraph(ResultSetRow row, ResultMetadata resultMetadata) { + RowObjects tableObjects = new RowObjects(metadata, registry); + Iterator tables = row.getAllTableData().iterator(); + while (tables.hasNext()) { + TableData rawDataFromRow = (TableData) tables.next(); + + if ( (resultMetadata.hasMappingModel()) && (!rawDataFromRow.hasValidPrimaryKey() ) ) + continue; + + String tableName = rawDataFromRow.getTableName(); + DataObject tableObject = registry.get(tableName, rawDataFromRow + .getPrimaryKeyValues()); + if (tableObject == null) { + tableObject = doMaker.createAndAddDataObject(rawDataFromRow, resultMetadata); + + debug("Putting table " + tableName + " with PK " + rawDataFromRow.getPrimaryKeyValues() + " into registry"); + + registry.put(tableName, rawDataFromRow.getPrimaryKeyValues(), + tableObject); + } + tableObjects.put(tableName, tableObject); + } + + tableObjects.processRelationships(); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java new file mode 100644 index 0000000000..f68f48fc06 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultSetRow.java @@ -0,0 +1,169 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + + +/** + * + * A ResultSetRow is used to transform a single row of a ResultSet into a set of + * EDataObjects. + */ +public class ResultSetRow { + + private final ResultMetadata metadata; + + private HashMap tableMap = new HashMap(); + + private ArrayList allTableData; + + private boolean debug = false; + + /** + * Method ResultSetRow. + * + * @param rs + * A ResultSet positioned on the desired row + * @param ePackage + * The package used to create EDataObjects + */ + public ResultSetRow(ResultSet rs, ResultMetadata m) throws SQLException { + this.metadata = m; + if (m.isRecursive()) + processRecursiveRow(rs); + else + processRow(rs); + } + + /** + * Processes a single row in the ResultSet Method processRow. + * + * @param rs + */ + private void processRow(ResultSet rs) throws SQLException { + + DebugUtil.debugln(getClass(), debug, ""); + for (int i = 1; i <= metadata.getResultSetSize(); i++) { + Object data = getObject(rs, i); + + TableData table = getRawData(metadata.getTablePropertyName(i)); + DebugUtil.debugln(getClass(), debug, "Adding column: " + + metadata.getColumnPropertyName(i) + "\tValue: " + data + + "\tTable: " + metadata.getTablePropertyName(i)); + table.addData(metadata.getColumnPropertyName(i), metadata + .isPKColumn(i), data); + } + + } + + public void processRecursiveRow(ResultSet rs) throws SQLException { + this.allTableData = new ArrayList(); + int i = 1; + DebugUtil.debugln(getClass(), debug, ""); + while (i <= metadata.getResultSetSize()) { + DebugUtil.debugln(getClass(), debug, ""); + TableData table = new TableData(metadata.getTablePropertyName(i)); + this.allTableData.add(table); + + while ( (i <= metadata.getResultSetSize()) && (metadata.isPKColumn(i))) { + Object data = getObject(rs, i); + DebugUtil.debugln(getClass(), debug, "Adding column: " + + metadata.getColumnPropertyName(i) + "\tValue: " + data + + "\tTable: " + metadata.getTablePropertyName(i)); + table.addData(metadata.getColumnPropertyName(i), true, data); + i++; + } + + while ( (i <= metadata.getResultSetSize()) && + (!metadata.isPKColumn(i))) { + Object data = getObject(rs, i); + DebugUtil.debugln(getClass(), debug, "Adding column: " + + metadata.getColumnPropertyName(i) + "\tValue: " + data + + "\tTable: " + metadata.getTablePropertyName(i)); + table.addData(metadata.getColumnPropertyName(i), false, data); + i++; + } + } + } + + /** + * @param rs + * @param metadata + * @param i + * @return + */ + private Object getObject(ResultSet rs, int i) + throws SQLException { + + Object data = rs.getObject(i); + + if (rs.wasNull()) + return null; + else + return metadata.getConverter(i).getPropertyValue(data); + } + + /** + * Returns a HashMap that holds data for the specified table + * + * @param tableName + * The name of the table + * @return HashMap + */ + public TableData getTable(String tableName) { + return (TableData) tableMap.get(tableName); + } + + /** + * Returns a HashMap that holds data for the specified table If the HashMap + * doesn't exist, it will be created. This is used internally to build the + * ResultSetRow, whereas getTable is used externally to retrieve existing + * table data. + * + * @param tableName + * The name of the table + * @return HashMap + */ + private TableData getRawData(String tableName) { + + TableData table = (TableData) tableMap.get(tableName); + + if (table == null) { + table = new TableData(tableName); + tableMap.put(tableName, table); + } + + return table; + } + + public ArrayList getAllTableData() { + if ( this.allTableData == null ) { + this.allTableData = new ArrayList(); + this.allTableData.addAll(tableMap.values()); + } + DebugUtil.debugln(getClass(), debug, allTableData); + + return this.allTableData; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java new file mode 100644 index 0000000000..f0df0ab7c3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/RowObjects.java @@ -0,0 +1,140 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.config.KeyPair; +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; + + +public class RowObjects { + + private HashMap objectsByTableName; + + private ArrayList tableObjects; + + private static final boolean debug = false; + + private final GraphBuilderMetadata metadata; + + private final TableRegistry registry; + + public RowObjects(GraphBuilderMetadata metadata, TableRegistry registry) { + objectsByTableName = new HashMap(); + tableObjects = new ArrayList(); + this.metadata = metadata; + this.registry = registry; + } + + public void put(String key, DataObject value) { + objectsByTableName.put(key, value); + tableObjects.add(value); + } + + public DataObject get(String tablePropertyName) { + return (DataObject) objectsByTableName.get(tablePropertyName); + } + + void processRelationships() { + MappingWrapper wrapper = new MappingWrapper(metadata.getMapping()); + if (wrapper.hasRecursiveRelationships()) { + processRecursiveRelationships(wrapper); + return; + } + + Iterator i = metadata.getRelationships().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + + + DataObject parentTable = get(wrapper + .getTablePropertyName(r.getPrimaryKeyTable())); + DataObject childTable = get(wrapper + .getTablePropertyName(r.getForeignKeyTable())); + + DebugUtil.debugln(getClass(), debug, "Parent table: " + parentTable); + DebugUtil.debugln(getClass(), debug, "Child table: " + childTable); + + if ((parentTable == null) || (childTable == null)) + continue; + + Property p = parentTable.getType().getProperty(r.getName()); + setOrAdd(parentTable, childTable, p); + + } + } + + + + private void processRecursiveRelationships(MappingWrapper wrapper) { + Iterator i = tableObjects.iterator(); + while (i.hasNext()) { + DataObject table = (DataObject) i.next(); + + Iterator relationships = wrapper.getRelationshipsByChildTable(table.getType().getName()).iterator(); + while ( relationships.hasNext() ) { + Relationship r = (Relationship) relationships.next(); + + DataObject parentTable = findParentTable(table, r, wrapper); + + if (parentTable == null) + continue; + + Property p = parentTable.getType().getProperty(r.getName()); + setOrAdd(parentTable, table, p); + } + + } + } + + private void setOrAdd(DataObject parent, DataObject child, Property p) { + if (p.isMany()) { + parent.getList(p).add(child); + } else { + parent.set(p, child); + } + } + + private DataObject findParentTable(DataObject childTable, + Relationship r, MappingWrapper wrapper) { + + ArrayList fkValue = new ArrayList(); + Iterator keyPairs = r.getKeyPair().iterator(); + while (keyPairs.hasNext()) { + KeyPair pair = (KeyPair) keyPairs.next(); + String childProperty = wrapper.getColumnPropertyName(r.getPrimaryKeyTable(), pair.getForeignKeyColumn()); + + Property p = childTable.getType().getProperty(childProperty); + fkValue.add(childTable.get(p)); + } + + DebugUtil.debugln(getClass(), debug, "Trying to find parent of " + r.getForeignKeyTable() + " with FK " + + fkValue); + DataObject parentTable = registry.get(r.getPrimaryKeyTable(), fkValue); + DebugUtil.debugln(getClass(), debug, "Parent table from registry: " + parentTable); + return parentTable; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java new file mode 100644 index 0000000000..f00ef2770d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/SingleTableRegistry.java @@ -0,0 +1,52 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.List; + +import commonj.sdo.DataObject; + +/** + */ +public class SingleTableRegistry implements TableRegistry { + + //private HashMap values = new HashMap(); + + public SingleTableRegistry() { + // Empty Constructor + } + + /* (non-Javadoc) + * @see com.ibm.ws.sdo.mediator.jdbc.graphbuilder.impl.TableRegistry#get(java.lang.String, java.util.List) + */ + public DataObject get(String tableName, List primaryKey) { + return null; + } + + /* (non-Javadoc) + * @see com.ibm.ws.sdo.mediator.jdbc.graphbuilder.impl.TableRegistry#put(java.lang.String, java.util.List, java.lang.Object) + */ + public void put(String tableName, List primaryKey, DataObject value) { + // do nothing + + } + + public boolean contains(String name, List list) { + return false; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java new file mode 100644 index 0000000000..48b6dc0187 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableData.java @@ -0,0 +1,75 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + + +/** + * + */ +public class TableData { + + private HashMap columnData = new HashMap(); + private ArrayList primaryKey = new ArrayList(); + private final String name; + private boolean hasValidPrimaryKey = true; + private static final boolean debug = false; + + public TableData(String tableName) { + DebugUtil.debugln(getClass(), debug, "Creating TableData for table " + tableName); + this.name = tableName; + } + + + public void addData(String columnName, boolean isPrimaryKeyColumn, Object data) { + DebugUtil.debugln(getClass(), debug, "Adding column " + columnName + " with value " + data); + columnData.put(columnName, data); + if ( isPrimaryKeyColumn ) { + if ( data == null ) { + DebugUtil.debugln(getClass(), debug, "Column " + columnName + " is a primary key column and is null"); + hasValidPrimaryKey = false; + } + primaryKey.add(data); + } + } + + public Object getColumnData(String columnName) { + return columnData.get(columnName); + } + + public String getTableName() { + return this.name; + } + + + /** + * @return + */ + public List getPrimaryKeyValues() { + return primaryKey; + } + + + public boolean hasValidPrimaryKey() { + return hasValidPrimaryKey; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java new file mode 100644 index 0000000000..4b5a3677ae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/TableRegistry.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.impl; + +import java.util.List; + +import commonj.sdo.DataObject; + +/** + */ +public interface TableRegistry { + /** + * Get the table with the specified name and primary key + * @param tableName + * @param primaryKey + * @return EDataObject + */ + public DataObject get(String tableName, List primaryKey); + + /** + * Add the table with the specified name and primary key + * @param tableName + * @param primaryKey + * @param value + */ + public void put(String tableName, List primaryKey, DataObject value); + + public boolean contains(String name, List list); +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java new file mode 100644 index 0000000000..3082384160 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ESchemaMaker.java @@ -0,0 +1,171 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.schema; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata; +import org.apache.tuscany.das.rdb.graphbuilder.impl.ResultMetadata; +import org.apache.tuscany.das.rdb.util.DebugUtil; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; + +/** + * + * An ESchemaMaker is used to create an EMF Schema from an instance of JDBC + * Mediator Metadata. + * + */ +public class ESchemaMaker { + + private final GraphBuilderMetadata metadata; + + private boolean debug = false; + + /** + * Constructor for ESchemaMaker. Creates an SDO model based on the metadata + * passed in. + * + * @param metadata + */ + public ESchemaMaker(GraphBuilderMetadata metadata) { + this.metadata = metadata; + } + + /** + * Creates an EMF Schema by using the + * + * @link TableMaker and + * @link RelationshipMaker to transform + * @link Metadata elements into EMF Schema elements. + */ + + public Type createTypes() { + TypeHelper types = SDOUtil.createTypeHelper(); + + DataObjectUtil.initRuntime(); + SDOUtil.createDataGraph(); + + + Type rootType = SDOUtil.createType(types, getURI(), "DataGraphRoot", false); + + Iterator iter = metadata.getResultMetadata().iterator(); + while (iter.hasNext()) { + + ResultMetadata resultMetadata = (ResultMetadata) iter.next(); + + Iterator names = resultMetadata.getAllTablePropertyNames() + .iterator(); + while (names.hasNext()) { + String tableName = (String) names.next(); + + Type tableType = SDOUtil.createType(types, getURI(), tableName, false); + Property property = SDOUtil.createProperty(rootType, tableName, tableType); + SDOUtil.setMany(property,true); + SDOUtil.setContainment(property, true); + } + + // TODO tablePropertyMap is temporary until Tuscany-203 is fixed + HashMap tablePropertyMap = new HashMap(); + + for (int i = 1; i <= resultMetadata.getColumnNames().size(); i++) { + + Property ref = rootType.getProperty(resultMetadata.getTablePropertyName(i)); + + // TODO Temporary code to check to see if a property has already been added. + // Replace when Tuscany-203 is fixed + ArrayList addedProperties = (ArrayList) tablePropertyMap.get(ref.getName()); + if ( addedProperties == null ) { + addedProperties = new ArrayList(); + tablePropertyMap.put(ref.getName(), addedProperties); + } + + if (ref == null) + throw new RuntimeException("Could not find table " + + resultMetadata.getTablePropertyName(i) + + " in the SDO model"); + + String columnName = resultMetadata.getColumnPropertyName(i); + + // TODO temporary check until Tuscany-203 is fixed + if ( !addedProperties.contains(columnName)) { + addedProperties.add(columnName); + Type atype = (Type) resultMetadata.getDataType(i); + + SDOUtil.createProperty(ref.getType(), columnName, atype); + + DebugUtil.debugln(getClass(), debug, "Adding column " + + columnName + " to " + + resultMetadata.getTablePropertyName(i)); + } + + } + } + + if (metadata.hasMappingModel()) { + MappingWrapper wrapper = new MappingWrapper(metadata.getMapping()); + Iterator i = metadata.getRelationships().iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + + Type parent = rootType.getProperty( + wrapper.getTablePropertyName(r.getPrimaryKeyTable())).getType(); + Type child = rootType.getProperty( + wrapper.getTablePropertyName(r.getForeignKeyTable())).getType(); + if (parent == null) { + throw new RuntimeException("The parent table (" + + r.getPrimaryKeyTable() + ") in relationship " + + r.getName() + + " was not found in the mapping information."); + } else if (child == null) { + throw new RuntimeException("The child table (" + + r.getForeignKeyTable() + ") in relationship " + + r.getName() + + " was not found in the mapping information."); + } + + // ReferenceImpl ref = refMaker.createReference(r, parent, child); + + Property parentProp = SDOUtil.createProperty(parent, r.getName(), child); + Property childProp = SDOUtil.createProperty(child, r.getName() + "_opposite", parent); + SDOUtil.setOpposite(parentProp, childProp); + SDOUtil.setOpposite(childProp, parentProp); + SDOUtil.setMany(parentProp, r.isMany()); + + + + } + + } + + return rootType; + } + + private String getURI() { + return "http:///org.apache.tuscany.das.rdb/das"; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java new file mode 100644 index 0000000000..832cfeac7e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/schema/ResultSetTypeMap.java @@ -0,0 +1,133 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.graphbuilder.schema; + +import java.sql.Types; + +import org.apache.tuscany.sdo.SDOPackage; + +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; + +/** + */ +public class ResultSetTypeMap { + + public static ResultSetTypeMap instance = new ResultSetTypeMap(); + + /** + * Constructor for ResultSetTypeMap. + */ + protected ResultSetTypeMap() { + // Empty Constructor + } + + /** + * These mappings taken primarily from "JDBC API and Tutorial and Reference" by + * Fisher, Ellis and Bruce. + * + * @param type + * @param isNullable + * @return + */ + public Type getEDataType(int type, boolean isNullable) { + + TypeHelper helper = TypeHelper.INSTANCE; + SDOPackage.eINSTANCE.eClass(); + switch (type) { + + case Types.CHAR: + case Types.VARCHAR: + case Types.LONGVARCHAR: + return helper.getType("commonj.sdo", "String"); + + case Types.NUMERIC: + case Types.DECIMAL: + return helper.getType("commonj.sdo", "Decimal"); + + case Types.BIT: + case Types.BOOLEAN: + if (isNullable) + return helper.getType("commonj.sdo", "Boolean"); + else + return helper.getType("commonj.sdo", "boolean"); + + case Types.TINYINT: + case Types.SMALLINT: + case Types.INTEGER: + if (isNullable) { + return helper.getType("commonj.sdo", "IntObject"); + } else + return helper.getType("commonj.sdo", "Int"); + + case Types.BIGINT: + if (isNullable) + return helper.getType("commonj.sdo", "Long"); + else + return helper.getType("commonj.sdo", "long"); + + case Types.REAL: + if (isNullable) + return helper.getType("commonj.sdo", "Float"); + else + return helper.getType("commonj.sdo", "float"); + + case Types.FLOAT: + case Types.DOUBLE: + if (isNullable) + return helper.getType("commonj.sdo", "Double"); + else + return helper.getType("commonj.sdo", "double"); + + case Types.BINARY: + case Types.VARBINARY: + case Types.LONGVARBINARY: + return helper.getType("commonj.sdo", "ByteArray"); + + case Types.DATE: + case Types.TIME: + case Types.TIMESTAMP: + return helper.getType("commonj.sdo", "Date"); + + case Types.CLOB: + return helper.getType("commonj.sdo", "Clob"); + + case Types.BLOB: + return helper.getType("commonj.sdo", "Blob"); + + case Types.ARRAY: + return helper.getType("commonj.sdo", "Array"); + + case Types.DISTINCT: + case Types.STRUCT: + case Types.REF: + case Types.DATALINK: + case Types.JAVA_OBJECT: + return helper.getType("commonj.sdo", "Object"); + + default: + return helper.getType("commonj.sdo", "Object"); + } + + } + + + public Type getType(int columnType, boolean b) { + return getEDataType(columnType, b); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java new file mode 100644 index 0000000000..79baf3c299 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ApplyChangesCommandImpl.java @@ -0,0 +1,111 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.Connection; +import java.sql.DriverManager; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConnectionProperties; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +/** + * + */ +public class ApplyChangesCommandImpl extends BaseCommandImpl implements ApplyChangesCommand { + + private static final boolean debug = false; + + private ChangeSummarizer summarizer = new ChangeSummarizer(); + + public ApplyChangesCommandImpl() { + } + + public ApplyChangesCommandImpl(Config config){ + this.configWrapper = new MappingWrapper(config); + if (config.getConnectionProperties() != null) + setConnection(config.getConnectionProperties()); + } + + public ApplyChangesCommandImpl(Config config, Connection connection){ + this.configWrapper = new MappingWrapper(config); + setConnection(connection); + } + + public void setConnection(ConnectionImpl connection) { + summarizer.setConnection(connection); + } + + public void setConnection(ConnectionProperties c) { + try { + Connection connection = null; + Class.forName(c.getDriverClassName()); + if (c.getDriverUserName() == null) + connection = DriverManager.getConnection(c.getDriverURL()); + else + connection = DriverManager.getConnection(c.getDriverURL(), c.getDriverUserName(), c.getDriverPassword()); + connection.setAutoCommit(false); + setConnection(connection); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + public void addCreateCommand(Type type, Command cmd) { + summarizer.addCreateCommand(type, cmd); + } + + public void addUpdateCommand(Type type, Command cmd) { + summarizer.addUpdateCommand(type, cmd); + } + + public void addDeleteCommand(Type type, Command cmd) { + summarizer.addDeleteCommand(type, cmd); + } + + public void execute(DataObject root) { + DebugUtil.debugln(getClass(), debug, "Executing ApplyChangesCmd"); + + if (summarizer.getConnection() == null) + throw new RuntimeException("A connection must be provided"); + + if (!root.equals(root.getDataGraph().getRootObject())) + throw new RuntimeException("'root' argument must be the root of the datagraph"); + + summarizer.setMapping(configWrapper); + + Changes changes = summarizer.loadChanges(root); + + boolean success = false; + try { + changes.execute(); + success = true; + } finally { + if (success) + summarizer.getConnection().cleanUp(); + else + summarizer.getConnection().errorCleanUp(); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java new file mode 100644 index 0000000000..e827426383 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/BaseCommandImpl.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.Key; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; + +public abstract class BaseCommandImpl { + + protected MappingWrapper configWrapper = new MappingWrapper(); + + public void setConnection(Connection connection) { + setConnection(new ConnectionImpl(connection)); + } + + public void setConnection(Connection connection, boolean manageTransaction) { + ConnectionImpl c = new ConnectionImpl(connection); + c.setManageTransactions(manageTransaction); + setConnection(c); + } + + public abstract void setConnection(ConnectionImpl c); + + public void addRelationship(String parentName, String childName) { + configWrapper.addRelationship(parentName, childName); + } + + public void addRelationship(Key parentKey, Key childKey) { + configWrapper.addRelationship(parentKey, childKey); + } + + public void addPrimaryKey(String pk) { + configWrapper.addPrimaryKey(pk); + } + + public void addPrimaryKey(Key pk) { + configWrapper.addPrimaryKey(pk); + } + + public void addConverter(String name, String converter) { + configWrapper.addConverter(name, converter); + } + + public void addCollisionColumn(String columnName) { + configWrapper.addCollisionColumn(columnName); + } + + public void addGeneratedPrimaryKey(String columnName) { + configWrapper.addGeneratedPrimaryKey(columnName); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java new file mode 100644 index 0000000000..c56c55c636 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeFactory.java @@ -0,0 +1,199 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.impl; + +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.SDODataTypes; +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.generator.impl.CudGenerator; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +public class ChangeFactory { + + private final Type type; + + private InsertCommandImpl createCommand; + + private UpdateCommandImpl updateCommand; + + private DeleteCommandImpl deleteCommand; + + private static final boolean debug = false; + + private CudGenerator cudGenerator; + + private final MappingWrapper mapping; + + private final ConnectionImpl connection; + + public ChangeFactory(Type type, MappingWrapper mapping, ConnectionImpl connection) { + this.type = type; + this.mapping = mapping; + this.connection = connection; + } + + public Type getType() { + return this.type; + } + + public void setCreateCommand(InsertCommandImpl cmd) { + createCommand = cmd; + } + + public void setUpdateCommand(UpdateCommandImpl cmd) { + DebugUtil.debugln(getClass(), debug, "Setting Update Command to " + cmd); + updateCommand = cmd; + } + + public void setDeleteCommand(DeleteCommandImpl cmd) { + deleteCommand = cmd; + } + + private CudGenerator getCudGenerator() { + if (this.cudGenerator == null) + this.cudGenerator = new CudGenerator(); + return this.cudGenerator; + } + + ChangeOperation createUpdateOperation(DataObject changedObject, String propagatedID) { + return new UpdateOperation(getUpdateCommand(changedObject), changedObject, propagatedID); + } + ChangeOperation createUpdateOperation(DataObject changedObject) { + return createUpdateOperation(changedObject, null); + } + + ChangeOperation createDeleteOperation(DataObject changedObject) { + return new DeleteOperation(getDeleteCommand(changedObject), changedObject); + } + + ChangeOperation createInsertOperation(DataObject changedObject, String propagatedID) { + return new CreateOperation(getCreateCommand(changedObject), changedObject, propagatedID); + } + + ChangeOperation createInsertOperation(DataObject changedObject) { + return createInsertOperation(changedObject, null); + } + + + private InsertCommandImpl getCreateCommand(DataObject changedObject) { + + if ( createCommand == null ) { + Table table = mapping.getTableByPropertyName(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.getTableByPropertyName(changedObject.getType().getName()); + } else { + throw new RuntimeException("Table " + changedObject.getType().getName() + " was changed in the DataGraph but is not present in the Config"); + } + } + + + String createStatement = table.getCreate(); + if ( createStatement == null ) { + createCommand = getCudGenerator().getInsertCommand(mapping, changedObject, table); + } else { + createCommand = new InsertCommandImpl(createStatement); + Iterator i = getCudGenerator().getCreateParameters(mapping, changedObject, table).iterator(); + while (i.hasNext()) { + Property p = (Property)i.next(); + createCommand.addParameter(p.getName(), p.getType()); + } + } + createCommand.setConnection(connection); + createCommand.configWrapper = mapping; + } + return createCommand; + } + + private DeleteCommandImpl getDeleteCommand(DataObject changedObject) { + + if ( deleteCommand == null ) { + Table table = mapping.getTableByPropertyName(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.getTableByPropertyName(changedObject.getType().getName()); + } else { + throw new RuntimeException("Table " + changedObject.getType().getName() + " was changed in the DataGraph but is not present in the Config"); + } + } + + String deleteStatement = table.getDelete(); + if ( deleteStatement == null ) { + deleteCommand = getCudGenerator().getDeleteCommand(table); + } else { + deleteCommand = new DeleteCommandImpl(deleteStatement); + Iterator i = getCudGenerator().getDeleteParameters(table).iterator(); + while (i.hasNext()) { + deleteCommand.addParameter((String)i.next(), SDODataTypes.OBJECT); + } + } + deleteCommand.setConnection(connection); + } + return deleteCommand; + } + + private UpdateCommandImpl getUpdateCommand(DataObject changedObject) { + + if ( updateCommand == null ) { + Table table = mapping.getTableByPropertyName(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.getTableByPropertyName(changedObject.getType().getName()); + } else { + throw new RuntimeException("Table " + changedObject.getType().getName() + " was changed in the DataGraph but is not present in the Config"); + } + } + String updateStatement = table.getUpdate(); + if ( updateStatement == null ) { + updateCommand = getCudGenerator().getUpdateCommand(mapping, changedObject,table); + } else { + TableWrapper t = new TableWrapper(table); + if ( t.getCollisionColumn() != null ) + updateCommand = new OptimisticWriteCommandImpl(updateStatement); + else + updateCommand = new UpdateCommandImpl(updateStatement); + + + updateCommand.addParameters(getCudGenerator().getUpdateParameters(changedObject, table)); + + } + updateCommand.setConnection(connection); + updateCommand.configWrapper = mapping; + } + DebugUtil.debugln(getClass(), debug, "Returning updateCommand: " + updateCommand); + return updateCommand; + } + + public MappingWrapper getConfig() { + return this.mapping; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java new file mode 100644 index 0000000000..c5221dda5c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeOperation.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; + +/** + */ +public abstract class ChangeOperation { + + private final WriteCommandImpl writeCommand; + + protected DatabaseObject dObject; + + private static final boolean debug = false; + + protected String propagatedID = null; + + private boolean isInsert = false; + + public ChangeOperation(DeleteCommandImpl command) { + writeCommand = command; + } + + public ChangeOperation(InsertCommandImpl command, DataObject changedObject) { + writeCommand = command; + dObject = new DatabaseObject(command.getMappingModel(), changedObject); + this.isInsert = true; + } + + public ChangeOperation(UpdateCommandImpl command, DataObject changedObject) { + writeCommand = command; + dObject = new DatabaseObject(command.getMappingModel(), changedObject); + } + + public void execute() { + DebugUtil.debugln(getClass(), debug, "Executing change operation"); + + Iterator i = writeCommand.getParameters().iterator(); + while (i.hasNext()) { + Parameter parm = (Parameter) i.next(); + DebugUtil.debugln(getClass(), debug, "setting " + parm.getName() + " to " + dObject.get(parm.getName())); + parm.setValue(dObject.get(parm.getName())); + } + + writeCommand.execute(); + + if ( isInsert && ( propagatedID != null )) { + DebugUtil.debugln(getClass(), debug, "Propagating key " + propagatedID); + int id = writeCommand.getGeneratedKey(); + dObject.setPropagatedID(propagatedID, id); + } + } + + public String getTableName() { + return dObject.getTableName(); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java new file mode 100644 index 0000000000..10984d9d4b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ChangeSummarizer.java @@ -0,0 +1,266 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.impl; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.Key; +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.QualifiedColumn; +import org.apache.tuscany.das.rdb.config.wrapper.RelationshipWrapper; +import org.apache.tuscany.das.rdb.config.wrapper.TableWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; +import org.apache.tuscany.sdo.impl.ChangeSummaryImpl; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +public class ChangeSummarizer { + + private static final boolean debug = false; + + private Changes changes = new Changes(); + + private FactoryRegistry registry; + + private MappingWrapper mapping = new MappingWrapper(); + + private ConnectionImpl connection; + + private HashMap generatedKeys = new HashMap(); + + public ChangeSummarizer() { + // Empty Constructor + } + + public Changes loadChanges(DataObject root) { + ChangeSummary changeSummary = root.getDataGraph().getChangeSummary(); + if (changeSummary.isLogging()) + ((ChangeSummaryImpl) changeSummary).summarize(); + + List changedObjects = changeSummary.getChangedDataObjects(); + DebugUtil.debugln(getClass(), debug, + "List of changed objects contains " + changedObjects.size() + + " object(s)"); + + changes.setInsertOrder(mapping.getInsertOrder()); + changes.setDeleteOrder(mapping.getDeleteOrder()); + + Iterator i = changedObjects.iterator(); + while (i.hasNext()) { + DataObject o = (DataObject) i.next(); + + if (!(o.equals(root))) { + createChange(changeSummary, o); + } + } + + return changes; + } + + public void createChange(ChangeSummary changeSummary, + DataObject changedObject) { + + if (changeSummary.isCreated(changedObject)) { + DebugUtil.debugln(getClass(), debug, "Change is a create"); + if (!changeSummary.isDeleted(changedObject)) { + ChangeFactory factory = getRegistry().getFactory( + changedObject.getType()); + String propagatedID = (String) generatedKeys.get(changedObject + .getType().getName()); + changes.addInsert(factory.createInsertOperation(changedObject, + propagatedID)); + } + } else if (changeSummary.isDeleted(changedObject)) { + ChangeFactory factory = getRegistry().getFactory( + changedObject.getType()); + DebugUtil.debugln(getClass(), debug, "Change is a delete"); + changes.addDelete(factory.createDeleteOperation(changedObject)); + } else { + // bumpCollisionField(changedObject); + DebugUtil.debugln(getClass(), debug, "Change is a modify"); + List attrList = changeSummary.getOldValues(changedObject); + if (hasAttributeChange(attrList)) { + ChangeFactory factory = getRegistry().getFactory( + changedObject.getType()); + DebugUtil.debugln(getClass(), debug, "Attribute Change for " + + changedObject.getType().getName()); + String propagatedID = (String) generatedKeys.get(changedObject + .getType().getName()); + changes.addUpdate(factory.createUpdateOperation(changedObject, + propagatedID)); + } else { + // Reference change + List values = changeSummary.getOldValues(changedObject); + Iterator i = values.iterator(); + while (i.hasNext()) { + ChangeSummary.Setting setting = (ChangeSummary.Setting) i + .next(); + + if (!setting.getProperty().getType().isDataType()) { + DebugUtil.debugln(getClass(), debug, + "Reference change for " + + changedObject.getType().getName()); + + Property ref = setting.getProperty(); + + DebugUtil.debugln(getClass(), debug, ref.getName()); + if (hasState(ref, changedObject) ) { + ChangeFactory factory = getRegistry().getFactory( + changedObject.getType()); + changes.addUpdate(factory + .createUpdateOperation(changedObject)); + } + + } + } + } + } + + } + + private boolean hasState(Property ref, DataObject changedObject) { + if ( ref.getOpposite().isMany() ) { + return true; + } else { + MappingWrapper mw = this.mapping; + if ( mw.getConfig() == null ) + mw = registry.getFactory(changedObject.getType()).getConfig(); + if ( mw.getConfig() == null ) + return false; + + Relationship rel = mw.getRelationshipByReference(ref); + + if ( !rel.isMany()) { + // This is a one-one relationship + Table t = mapping.getTableByPropertyName(changedObject.getType().getName()); + TableWrapper tw = new TableWrapper(t); + RelationshipWrapper rw = new RelationshipWrapper(rel); + if (( rel.getForeignKeyTable().equals(t.getName())) && + ( Collections.disjoint(tw.getPrimaryKeyProperties(),rw.getForeignKeys()) )) + return true; + + } + + } + return false; + } + + private boolean hasAttributeChange(List theChanges) { + Iterator i = theChanges.iterator(); + while (i.hasNext()) { + ChangeSummary.Setting setting = (ChangeSummary.Setting) i.next(); + if (setting.getProperty().getType().isDataType()) + return true; + } + return false; + } + + public void addCreateCommand(Type type, Command cmd) { + ChangeFactory cf = getRegistry().getFactory(type); + cf.setCreateCommand((InsertCommandImpl) cmd); + ((CommandImpl) cmd).setConnection(connection); + } + + public void addUpdateCommand(Type type, Command cmd) { + ChangeFactory cf = getRegistry().getFactory(type); + cf.setUpdateCommand((UpdateCommandImpl) cmd); + ((CommandImpl) cmd).setConnection(connection); + } + + public void addDeleteCommand(Type type, Command cmd) { + ChangeFactory cf = getRegistry().getFactory(type); + cf.setDeleteCommand((DeleteCommandImpl) cmd); + ((CommandImpl) cmd).setConnection(connection); + + } + + private FactoryRegistry getRegistry() { + if (this.registry == null) { + this.registry = new FactoryRegistry(mapping, connection); + } + return this.registry; + } + + public void setConnection(ConnectionImpl connection) { + this.connection = connection; + } + + public void setMapping(MappingWrapper map) { + this.mapping = map; + + if ( mapping.getConfig() == null ) + return; + + Iterator i = mapping.getConfig().getTable().iterator(); + while (i.hasNext()) { + Table t = (Table) i.next(); + Iterator columns = t.getColumn().iterator(); + while ( columns.hasNext()) { + Column c = (Column) columns.next(); + if ( c.isPrimaryKey() && c.isGenerated()) { + DebugUtil.debugln(getClass(), debug, "adding generated key " + + t.getName() + "." + + c.getName()); + generatedKeys.put(t.getName(), c.getName()); + } + } + } + } + + public void addRelationship(String parentName, String childName) { + mapping.addRelationship(parentName, childName); + } + + public void addPrimaryKey(String columnName) { + mapping.addPrimaryKey(columnName); + } + + public void addCollisionColumn(String columnName) { + mapping.addCollisionColumn(columnName); + } + + public void addPrimarykey(Key key) { + mapping.addPrimaryKey(key); + } + + public void addGeneratedPrimaryKey(String columnName) { + QualifiedColumn col = new QualifiedColumn(columnName); + generatedKeys.put(col.getTableName(), col.getColumnName()); + mapping.addGeneratedPrimaryKey(columnName); + } + + public void addConverter(String name, String converterName) { + mapping.addConverter(name, converterName); + } + + public ConnectionImpl getConnection() { + return this.connection; + } + + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java new file mode 100644 index 0000000000..77198fe589 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Changes.java @@ -0,0 +1,80 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.ArrayList; +import java.util.Iterator; + +/** + * Mangages a set of graph-change operations. This simple implementaiton can be + * replaced with a version that provides R/I sorting + * + */ +public class Changes { + + private InsertList inserts = new InsertList(); + private UpdateList updates = new UpdateList(); + private DeleteList deletes = new DeleteList(); + + + public void addInsert(ChangeOperation c) { + inserts.add(c); + } + + public void addUpdate(ChangeOperation c) { + updates.add(c); + } + + public void addDelete(ChangeOperation c) { + deletes.add(c); + } + + /** + * Execute all my change + */ + public void execute() { + + Iterator i = inserts.getSortedList().iterator(); + while ( i.hasNext() ) { + ChangeOperation c = (ChangeOperation) i.next(); + c.execute(); + } + + i = updates.getSortedList().iterator(); + while ( i.hasNext() ) { + ChangeOperation c = (ChangeOperation) i.next(); + c.execute(); + } + + + i = deletes.getSortedList().iterator(); + while (i.hasNext() ) { + ChangeOperation c = (ChangeOperation) i.next(); + c.execute(); + } + + } + + public void setInsertOrder(ArrayList insertOrder) { + inserts.setOrder(insertOrder); + } + + public void setDeleteOrder(ArrayList deleteOrder) { + deletes.setOrder(deleteOrder); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandFactoryImpl.java new file mode 100644 index 0000000000..25c2223f13 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandFactoryImpl.java @@ -0,0 +1,77 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandFactory; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.util.ConfigUtil; + +public class CommandFactoryImpl implements CommandFactory { + + public Command createCommand(String sql) { + return baseCreateCommand(sql, null); + } + + public Command createCommand(String sql, InputStream configStream) { + return baseCreateCommand(sql, ConfigUtil.loadConfig(configStream)); + } + + public Command createCommand(String sql, Config config) { + return baseCreateCommand(sql, config); + } + + public ApplyChangesCommand createApplyChangesCommand() { + return new ApplyChangesCommandImpl(); + } + + public ApplyChangesCommand createApplyChangesCommand(InputStream configStream) throws IOException { + return new ApplyChangesCommandImpl(ConfigUtil.loadConfig(configStream)); + } + + public ApplyChangesCommand createApplyChangesCommand(Config config) { + return new ApplyChangesCommandImpl(config); + } + + // Utilities + + private Command baseCreateCommand(String sql, Config config) { + + sql = sql.trim(); // Remove leading white space + char firstChar = Character.toUpperCase(sql.charAt(0)); + switch (firstChar) { + case 'S': + return new ReadCommandImpl(sql, config); + case 'I': + return new InsertCommandImpl(sql); + case 'U': + return new UpdateCommandImpl(sql); + case 'D': + return new DeleteCommandImpl(sql); + case '{': + return new SPCommandImpl(sql, config); + default: + throw new Error("SQL => " + sql + " is not valid"); + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupFactoryImpl.java new file mode 100644 index 0000000000..196751857e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupFactoryImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.io.InputStream; + +import org.apache.tuscany.das.rdb.CommandGroup; +import org.apache.tuscany.das.rdb.CommandGroupFactory; + +public class CommandGroupFactoryImpl implements CommandGroupFactory { + + + public CommandGroup createCommandGroup(InputStream configStream) { + return new CommandGroupImpl(configStream); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupImpl.java new file mode 100644 index 0000000000..aeaf3a7c57 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandGroupImpl.java @@ -0,0 +1,207 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.io.InputStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +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.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConnectionProperties; +import org.apache.tuscany.das.rdb.util.ConfigUtil; + +/** + * An ConfiguredCommandFactory produces instances of Command and + * ApplyChangesCommand. This factory is initialized with a configuration that + * defines the commands it produces. + * + */ +public class CommandGroupImpl implements CommandGroup { + + private Config config; + + private Connection connection; + + private Map commands = new HashMap(); + + public CommandGroupImpl(InputStream stream) { + super(); + config = ConfigUtil.loadConfig(stream); + initialize(); + } + + private void initialize() { + + Iterator i = config.getCommand().iterator(); + while (i.hasNext()) { + org.apache.tuscany.das.rdb.config.Command commandConfig = (org.apache.tuscany.das.rdb.config.Command) i + .next(); + String kind = commandConfig.getKind(); + if (kind.equalsIgnoreCase("select")) + //TODO - Need to refactor Command heirarchy based on Datasource + if (config.getConnectionProperties() != null) + commands.put(commandConfig.getName(), new ReadCommandImpl(commandConfig.getSQL(), config, getConnection())); + else + commands.put(commandConfig.getName(), new ReadCommandImpl(commandConfig.getSQL(), config)); + else if (kind.equalsIgnoreCase("update")) + commands.put(commandConfig.getName(), new UpdateCommandImpl(commandConfig.getSQL())); + else if (kind.equalsIgnoreCase("insert")) + commands.put(commandConfig.getName(), new InsertCommandImpl(commandConfig.getSQL())); + else if (kind.equalsIgnoreCase("delete")) + commands.put(commandConfig.getName(), new DeleteCommandImpl(commandConfig.getSQL())); + else + throw new Error("Invalid kind of command: " + kind); + + } + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.das.rdb.CommandGroup#getApplyChangesCommand() + */ + public ApplyChangesCommand getApplyChangesCommand() { + ApplyChangesCommand cmd = new ApplyChangesCommandImpl(config, connection); + return cmd; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.das.rdb.CommandGroup#getCommand(java.lang.String) + */ + public Command getCommand(String name) { + if (!commands.containsKey(name)) + throw new RuntimeException("CommandGroup has no command named: " + name); + Command cmd = (Command) commands.get(name); + cmd.setConnection(getConnection()); + return cmd; + } + + + public void setConnection(Connection connection) { + this.connection = connection; + } + + public Connection getConnection() { + if (connection == null) + initializeConnection(); + return connection; + } + + private void initializeConnection() { + + ConnectionProperties cp = config.getConnectionProperties(); + if (cp == null) + throw new Error( + "No connection properties have been configured and no connection has been provided"); + + if (cp.getDataSource() != null) + initViaDataSource(cp); + else + initViaDriverManager(cp); + + } + + private void initViaDriverManager(ConnectionProperties cp) { + Connection connection = null; + + try { + Class.forName(cp.getDriverClassName()); + if (cp.getDriverUserName() == null) + connection = DriverManager.getConnection(cp.getDriverURL()); + else + connection = DriverManager.getConnection(cp.getDriverURL(), cp.getDriverUserName(), cp + .getDriverPassword()); + connection.setAutoCommit(false); + setConnection(connection); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + + } + + // TODO - Refactor to eliminate common initialization code after connection + // is got + private void initViaDataSource(ConnectionProperties cp) { + + Connection connection = null; + + InitialContext ctx; + try { + ctx = new InitialContext(); + } catch (NamingException e) { + throw new Error(e); + } + try { + // TODO - I think we should rename this getDataSourceURL? + DataSource ds = (DataSource) ctx.lookup(cp.getDataSource()); + try { + connection = ds.getConnection(); + connection.setAutoCommit(false); + setConnection(connection); + } catch (SQLException e) { + throw new Error(e); + } + } catch (NamingException e) { + throw new Error(e); + } + + } + + public void releaseResources() { + + if (managingConnections()) + closeConnection(); + } + + private void closeConnection() { + if (connection != null) + try { + connection.close(); + connection = null; + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + /** + * If the config has connection properties then we are "manageing" the + * connection via DriverManager or DataSource + */ + private boolean managingConnections() { + + if (config.getConnectionProperties() == null) + return false; + else + return true; + + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java new file mode 100644 index 0000000000..2ac9e324da --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CommandImpl.java @@ -0,0 +1,145 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.List; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.ResultSetShape; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.XSDHelper; + +public abstract class CommandImpl extends BaseCommandImpl implements Command { + + protected Statement statement; + + protected Parameters parameters = new Parameters(); + + protected static final boolean debug = false; + + protected ResultSetShape resultSetShape; + + public CommandImpl(String sqlString) { + statement = new Statement(sqlString); + + try { + URL url = getClass().getResource("/xml/sdoJava.xsd"); + if (url == null) + throw new RuntimeException( + "Could not find resource: xml/sdoJava.xsd"); + + InputStream inputStream = url.openStream(); + XSDHelper.INSTANCE.define(inputStream, url.toString()); + inputStream.close(); + } catch ( IOException ex ) { + throw new RuntimeException(ex); + } + + } + + public abstract void execute(); + + public abstract DataObject executeQuery(); + + public void setParameterValue(String name, Object value) { + parameters.setParameter(name, value); + } + + public void setParameterValue(int index, Object value) { + parameters.setParameter(index, value); + } + + public void setParameterType(String name, Type dataType) { + parameters.setParameterWithType(name, dataType); + } + + public void setParameterType(int index, Type dataType) { + parameters.setParameterWithType(index, dataType); + } + + public void addParameter(int index, Type sdoType) { + addParameter(index, Parameter.IN, sdoType); + } + + public void addParameter(int index, int direction, Type sdoType) { + parameters.findOrCreateParameterWithIndex(index, direction, sdoType); + } + + public void addParameter(String name, Type sdoType) { + addParameter(name, Parameter.IN, sdoType); + } + + public void addParameter(String name, int direction, Type sdoType) { + parameters.setParameterWithType(name, sdoType); + } + + public void addParameter(Parameter param) { + parameters.add(param); + } + + public Parameter getParameter(String name) { + return parameters.get(name); + } + + public Parameter getParameter(int index) { + return parameters.get(index); + + } + + public List getParameters() { + return parameters.parameterList(); + } + + public Object getParameterValue(String name) { + Parameter p = parameters.get(name); + if (p == null) + throw new RuntimeException("Parameter with name " + name + + " not found"); + + return p; + } + + public Object getParameterValue(int index) { + return parameters.parameterWithIndex(index).getValue(); + } + + public void setConnection(ConnectionImpl connection) { + statement.setConnection(connection); + } + + protected ConnectionImpl getConnection() { + return statement.getConnection(); + } + + + + public void setResultSetShape(ResultSetShape shape) { + this.resultSetShape = shape; + } + + + public void close() { + statement.close(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java new file mode 100644 index 0000000000..2da21bf930 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ConnectionImpl.java @@ -0,0 +1,95 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + + +public class ConnectionImpl { + + private Connection connection; + private static final boolean debug = false; + + private boolean managingTransaction = true; + + public ConnectionImpl(Connection connection) { + this.connection = connection; + + try { + if (connection.getAutoCommit()) + throw new RuntimeException("AutoCommit must be off!"); + } catch (SQLException e) { + throw new RuntimeException(e); + } + + } + + public Connection getJDBCConnection() { + return connection; + } + + public void cleanUp() { + try { + if (managingTransaction) { + DebugUtil.debugln(getClass(), debug, "Committing Transaction"); + connection.commit(); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + public void errorCleanUp() { + try { + if (managingTransaction) { + DebugUtil.debugln(getClass(), debug, "Rolling back Transaction"); + connection.rollback(); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + public PreparedStatement prepareStatement(QueryString queryString) + throws SQLException { + DebugUtil.debugln(getClass(), debug, "Preparing Statement: " + queryString.getPreparedString()); + return connection.prepareStatement(queryString.getPreparedString(), java.sql.Statement.RETURN_GENERATED_KEYS); + } + + public PreparedStatement preparePagedStatement(QueryString queryString) throws SQLException { + DebugUtil.debugln(getClass(), debug, "Preparing Statement: " + queryString.getPreparedString()); + return connection.prepareStatement(queryString.getPreparedString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + } + + public void setManageTransactions(boolean manageTransactions) { + managingTransaction = manageTransactions; + + } + + public CallableStatement prepareCall(QueryString queryString) throws SQLException { + return connection.prepareCall(queryString.getPreparedString()); + } + + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java new file mode 100644 index 0000000000..5c70dc1e6f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/CreateOperation.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + + +import commonj.sdo.DataObject; + +public class CreateOperation extends ChangeOperation { + + public CreateOperation(InsertCommandImpl command, DataObject changedObject, String ID) { + super(command, changedObject); + this.propagatedID = ID; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java new file mode 100644 index 0000000000..eaf56a6c2c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DatabaseObject.java @@ -0,0 +1,148 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.KeyPair; +import org.apache.tuscany.das.rdb.config.Relationship; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; + +/** + * DatabaseObject wraps DataObject. If a field is an FK field, it will return + * the value from the parent. + * + * + */ +public class DatabaseObject { + + private final MappingWrapper mappingWrapper; + + private final DataObject dataObject; + + private Property parentReference; + + private static final boolean debug = false; + + private HashMap keyMappings = new HashMap(); + + public DatabaseObject(Config model, DataObject changedObject) { + this.mappingWrapper = new MappingWrapper(model); + this.dataObject = changedObject; + initialize(); + } + + // Initialize Key Mappings + private void initialize() { + if (mappingWrapper.getConfig() != null) { + List relationships = mappingWrapper.getConfig().getRelationship(); + Iterator i = relationships.iterator(); + while (i.hasNext()) { + Relationship r = (Relationship) i.next(); + DebugUtil.debugln(getClass(), debug, "Initializing relationship: " + r.getName()); + if (r.getForeignKeyTable().equals(getTypeName())) { + List pairs = r.getKeyPair(); + Iterator iter = pairs.iterator(); + while (iter.hasNext()) { + KeyPair pair = (KeyPair) iter.next(); + keyMappings.put(pair.getForeignKeyColumn(), r); + } + } + } + } + } + + public Object get(String parameter) { + + if (isPartOfPrimaryKey(parameter)) + return dataObject.get(parameter); + + Relationship r = (Relationship) keyMappings.get(parameter); + if (r == null) + return dataObject.get(parameter); + + Property parentRef = getParentReference(r.getPrimaryKeyTable()); + DataObject parent = dataObject.getDataObject(parentRef); + if (parent == null) + return null; + String parentKey = getParentKey(r, parameter); + return parent.get(parentKey); + + } + + private String getParentKey(Relationship r, String parameter) { + List keyPairs = r.getKeyPair(); + Iterator i = keyPairs.iterator(); + while (i.hasNext()) { + KeyPair pair = (KeyPair) i.next(); + if (pair.getForeignKeyColumn().equals(parameter)) + return pair.getPrimaryKeyColumn(); + } + return null; + } + + public Property getParentReference(String parentName) { + if (this.parentReference == null) { + + Iterator i = dataObject.getType().getProperties().iterator(); + while (i.hasNext()) { + Property ref = (Property) i.next(); + if ((!ref.getType().isDataType()) && (ref.getType().getName().equals(parentName))) { + this.parentReference = ref; + } + } + } + return this.parentReference; + } + + public String getTableName() { + if (mappingWrapper.getConfig() != null) + return mappingWrapper.getTableByPropertyName(getTypeName()).getName(); + else + return null; + } + + public String getTypeName() { + return dataObject.getType().getName(); + } + + public void setPropagatedID(String propagatedID, int id) { + dataObject.setInt(propagatedID, id); + } + + private boolean isPartOfPrimaryKey(String parameter) { + if (mappingWrapper.getConfig() == null) + return false; + Table t = mappingWrapper.getTable(getTableName()); + if (t == null) + return false; + Column c = mappingWrapper.getColumnByPropertyName(t, parameter); + if (c == null) + return false; + return c.isPrimaryKey(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java new file mode 100644 index 0000000000..3502784b6f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteCommandImpl.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +public class DeleteCommandImpl extends WriteCommandImpl { + + public DeleteCommandImpl(String sqlString) { + super(sqlString); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java new file mode 100644 index 0000000000..8650c6119c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteList.java @@ -0,0 +1,72 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; + +/** + * DeleteList will sort delete operations so that child objects are deleted + * before their parents + * + * + */ +public class DeleteList { + + private HashMap opsByTableName = new HashMap(); + + private ArrayList order; + + private ArrayList deleteOperations = new ArrayList(); + + public DeleteList() { + super(); + } + + public void add(ChangeOperation op) { + if (( order == null ) || ( op.getTableName() == null ) ) { + deleteOperations.add(op); + } else { + String name = op.getTableName(); + ArrayList ops = (ArrayList) opsByTableName.get(name); + if (ops == null) + ops = new ArrayList(); + + ops.add(op); + opsByTableName.put(name, ops); + } + } + + public Collection getSortedList() { + if (( order != null ) && ( opsByTableName.keySet().size() > 0) ) { + Iterator i = this.order.iterator(); + while (i.hasNext()) { + String name = (String) i.next(); + deleteOperations.addAll((Collection) opsByTableName.get(name)); + } + } + + return deleteOperations; + } + + public void setOrder(ArrayList deleteOrder) { + this.order = deleteOrder; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java new file mode 100644 index 0000000000..7b71e0ace9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/DeleteOperation.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import org.apache.tuscany.das.rdb.util.DataObjectUtil; + +import commonj.sdo.DataObject; + +public class DeleteOperation extends ChangeOperation { + + + /** + * @param command + * @param changedObject + * Objects deleted from the graph have lost their "settings" and must + * be restored + */ + public DeleteOperation(DeleteCommandImpl command, DataObject changedObject) { + super(command); + this.dObject = new DatabaseObject(command.getMappingModel(),DataObjectUtil.getRestoredCopy(changedObject)); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java new file mode 100644 index 0000000000..ce09c748f4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/FactoryRegistry.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.HashMap; + +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.Type; + +public class FactoryRegistry { + + private HashMap registry = new HashMap(); + private static final boolean debug = false; + private final MappingWrapper mapping; + private final ConnectionImpl connection; + + public FactoryRegistry(MappingWrapper mapping, ConnectionImpl connection) { + this.mapping = mapping; + this.connection = connection; + } + + public ChangeFactory getFactory(Type type) { + ChangeFactory factory = (ChangeFactory)registry.get(type); + if ( factory == null ) { + DebugUtil.debugln(getClass(), debug, "Creating new ChangeFactory for type " + type.getName()); + factory = new ChangeFactory(type, mapping, connection); + registry.put(type, factory); + } + return factory; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java new file mode 100644 index 0000000000..9c890c7106 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertCommandImpl.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.SQLException; + +public class InsertCommandImpl extends WriteCommandImpl { + + private int generatedKey; + + private boolean hasGeneratedKey = false; + + public InsertCommandImpl(String sqlString) { + super(sqlString); + } + + protected boolean isInsert() { + return true; + } + + public int getGeneratedKey() { + + if (hasGeneratedKey) + return generatedKey; + + throw new RuntimeException("No generated key is available"); + } + + public Object getParameterValue(String name) { + + if (name.equals("generated_key")) + if (hasGeneratedKey) + return new Integer(generatedKey); + else + throw new RuntimeException("No generated key available"); + + return super.getParameterValue(name); + } + + protected void subtypeProcessing() throws SQLException { + loadGeneratedKey(); + } + + private void loadGeneratedKey() throws SQLException { + Integer key = statement.getGeneratedKey(); + if (key != null) { + hasGeneratedKey = true; + generatedKey = key.intValue(); + } + + } + + public String toString() { + + String superString = super.toString(); + StringBuffer buffer = new StringBuffer(superString); + + buffer.append("\nGenerating key: " + hasGeneratedKey); + if (hasGeneratedKey) + buffer.append("\nGenerated key: " + generatedKey); + + return buffer.toString(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java new file mode 100644 index 0000000000..dee6546cfe --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/InsertList.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + +/** + * InsertList will sort ChangeOperation objects so that parents are inserted + * before children + * + * + */ +public class InsertList { + + private HashMap opsByTableName = new HashMap(); + + private ArrayList insertOperations = new ArrayList(); + + private ArrayList order; + + private static final boolean debug = false; + + public void add(ChangeOperation op) { + DebugUtil.debugln(getClass(), debug, "Adding insert operation "); + // If nothing has been added yet, or this is no ordering, simply + // add the operation to the list + if ((order.size() == 0) || (op.getTableName() == null)) { + insertOperations.add(op); + } else { + String name = op.getTableName(); + ArrayList ops = (ArrayList) opsByTableName.get(name); + if (ops == null) + ops = new ArrayList(); + + ops.add(op); + opsByTableName.put(name, ops); + } + } + + public Collection getSortedList() { + DebugUtil.debugln(getClass(), debug, "Getting sorted insert list"); + if ((order.size() > 0) && opsByTableName.keySet().size() > 0) { + Iterator i = this.order.iterator(); + while (i.hasNext()) { + String name = (String) i.next(); + DebugUtil.debugln(getClass(), debug, + "Adding operations for table " + name); + // A null here means a table is in the config but hasn't been changed here + if (opsByTableName.get(name) != null) + insertOperations.addAll((Collection) opsByTableName + .get(name)); + } + } + DebugUtil.debugln(getClass(), debug, "Returning " + + insertOperations.size() + " insert operations"); + return insertOperations; + } + + public void setOrder(ArrayList insertOrder) { + this.order = insertOrder; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java new file mode 100644 index 0000000000..22ff822bb0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/OptimisticWriteCommandImpl.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.SQLException; + +public class OptimisticWriteCommandImpl extends UpdateCommandImpl { + + public OptimisticWriteCommandImpl(String sqlString) { + super(sqlString); + } + + public void execute() { + + boolean success = false; + try { + int rowsAffected = statement.executeUpdate(parameters); + success = true; + if ( rowsAffected == 0 ) + throw new RuntimeException("OCC Exception"); + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + if (success) + statement.getConnection().cleanUp(); + else + statement.getConnection().errorCleanUp(); + } + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java new file mode 100644 index 0000000000..32b17ef3e7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/PagerImpl.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.Pager; + +import commonj.sdo.DataObject; + +public class PagerImpl implements Pager { + + private final ReadCommandImpl command; + private final int size; + private int idx = 1; + + public PagerImpl(Command command, int size) { + this.command = (ReadCommandImpl)command; + this.command.enablePaging(); + this.size = size; + } + + public DataObject next() { + int start = idx; + int end = idx + size; + idx += size; + command.setStartRow(start); + command.setEndRow(end); + return command.executeQuery(); + } + + public DataObject getPage(int page) { + int end = (page * size) + 1; + int start = end - size; + idx = end; + command.setStartRow(start); + command.setEndRow(end); + return command.executeQuery(); + } + + public DataObject previous() { + int start = idx - (2 * size); + if ( start < 1 ) + start = 1; + int end = start + size; + idx = end; + command.setStartRow(start); + command.setEndRow(end); + return command.executeQuery(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java new file mode 100644 index 0000000000..4528661b2c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ParameterImpl.java @@ -0,0 +1,107 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.Parameter; + +import commonj.sdo.Type; + +public class ParameterImpl implements Parameter { + + private int index; + private Type type; + private String name; + private Object value; + private int direction = IN; + private Converter converter; + + public ParameterImpl() { + super(); + } + + public ParameterImpl(String name) { + this.name = name; + } + + public ParameterImpl(int index) { + this.index = index; + } + + public void setType(Type type) { + this.type = type; + } + + public void setIndex(int index) { + if ( index == 0 ) + throw new RuntimeException("Index of zero not allowed"); + this.index = index; + } + + public void setName(String name) { + this.name = name; + } + + public void setValue(Object value) { + this.value = value; + } + + public void setDirection(int direction) { + this.direction = direction; + } + + public Type getType() { + return this.type; + } + + public int getIndex() { + return this.index; + } + + public String getName() { + return this.name; + } + + public Object getValue() { + if ( getConverter() != null ) { + return getConverter().getColumnValue(this.value); + } else { + return this.value; + } + } + + public int getDirection() { + return this.direction; + } + + public void setConverter(Converter converter) { + this.converter = converter; + } + + public Converter getConverter() { + return this.converter; + } + + + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append("Index: " + getIndex()); + buffer.append("\nName: " + getName()); + buffer.append("\nValue: " + getValue()); + return buffer.toString(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java new file mode 100644 index 0000000000..4ea42f41b2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Parameters.java @@ -0,0 +1,150 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.Type; + +public class Parameters { + + private ArrayList parameters = new ArrayList(); + + private ArrayList inParams = new ArrayList(); + + private ArrayList outParams = new ArrayList(); + + private HashMap parametersByName = new HashMap(); + + private static boolean debug = false; + + public Parameters() { + super(); + } + + public Parameter get(String name) { + return (Parameter) parametersByName.get(name); + } + + public Parameter get(int index) { + return (Parameter) parameters.get(index); + } + + public List outParams() { + return outParams; + } + + public List inParams() { + return inParams; + } + + private void addParameter(Parameter param) { + if (param.getDirection() == Parameter.IN) + inParams.add(param); + else if ((param.getDirection() == Parameter.OUT) + || (param.getDirection() == Parameter.IN_OUT)) + outParams.add(param); + + this.parameters.add(param); + parametersByName.put(param.getName(), param); + } + + public void add(Parameter param) { + addParameter(param); + } + + public Parameter findOrCreateParameterNamed(String name) { + Parameter param = get(name); + if (param == null) { + param = new ParameterImpl(name); + addParameter(param); + } + return param; + } + + public Parameter findOrCreateParameterWithIndex(int index, int direction, + Type sdoType) { + Iterator i = parameters.iterator(); + while (i.hasNext()) { + Parameter param = (Parameter) i.next(); + + if (param.getIndex() == index) + return param; + } + DebugUtil.debugln(getClass(), debug, + "Creating new parameter with index " + index); + Parameter newParam = new ParameterImpl(index); + newParam.setDirection(direction); + newParam.setType(sdoType); + addParameter(newParam); + return newParam; + } + + public List parameterList() { + return parameters; + } + + public Parameter findOrCreateParameterWithIndex(int index) { + return findOrCreateParameterWithIndex(index, Parameter.IN, + SDODataTypes.OBJECT); + } + + public void setParameter(int index, Object value) { + Parameter param = findOrCreateParameterWithIndex(index); + param.setValue(value); + } + + public void setParameter(String name, Object value) { + if (name == null) + throw new RuntimeException("Null parameter name not allowed"); + Parameter param = findOrCreateParameterNamed(name); + param.setValue(value); + } + + public void setParameterWithType(String name, Type sdoType) { + if (name == null) + throw new RuntimeException("Null parameter name not allowed"); + Parameter p = findOrCreateParameterNamed(name); + p.setType(sdoType); + } + + public void setParameterWithType(int index, Type sdoType) { + if (index == 0) + throw new RuntimeException("Null parameter index not allowed"); + Parameter p = findOrCreateParameterWithIndex(index); + p.setType(sdoType); + } + + public Parameter parameterWithIndex(int index) { + Iterator i = parameters.iterator(); + while (i.hasNext()) { + Parameter param = (Parameter) i.next(); + + if (param.getIndex() == index) + return param; + } + return null; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java new file mode 100644 index 0000000000..8304457a72 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/QueryString.java @@ -0,0 +1,87 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + + +public class QueryString { + + private final String unmodifiedQueryString; + private final String preparedString; + private HashMap parameters = new HashMap(); + private static final boolean debug = false; + + public QueryString(String originalString) { + this.unmodifiedQueryString = originalString; + this.preparedString = replaceNamesAndSetIndexes(originalString); + } + + public String getPreparedString() { + return this.preparedString; + } + + public String getUnmodifiedString() { + return this.unmodifiedQueryString; + } + + public int getParameterIndex(String name) { + DebugUtil.debugln(getClass(), debug, "Looking for parameter index for: " + name); + //System.out.println(toString()); + return ((Integer)parameters.get(name)).intValue(); + } + + private String replaceNamesAndSetIndexes(String query) { + DebugUtil.debugln(getClass(), debug, "Parameterizing query: " + query); + Pattern p = Pattern.compile(":[\\S&&[^,()]]*"); + Matcher m = p.matcher(query); + + int index = 1; + while (m.find()) { + parameters.put(m.group().substring(1), new Integer(index)); + query = m.replaceFirst("?"); + m = p.matcher(query); + index++; + } + + DebugUtil.debugln(getClass(), debug, "Parameterized query: " + query); + return query; + } + + + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append("\nOriginal SQL: "); + buffer.append(unmodifiedQueryString); + buffer.append("\nPrepared SQL: "); + buffer.append(preparedString); + buffer.append("\nParameters: "); + Iterator i = parameters.keySet().iterator(); + while ( i.hasNext() ) { + String key = (String)i.next(); + buffer.append("\n"); + buffer.append(key); + } + return buffer.toString(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java new file mode 100644 index 0000000000..708fd88b38 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/ReadCommandImpl.java @@ -0,0 +1,168 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConnectionProperties; +import org.apache.tuscany.das.rdb.config.wrapper.MappingWrapper; +import org.apache.tuscany.das.rdb.graphbuilder.impl.GraphBuilderMetadata; +import org.apache.tuscany.das.rdb.graphbuilder.impl.ResultSetProcessor; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +public class ReadCommandImpl extends CommandImpl { + + private Type schema; + + private int startRow = 1; + + private int endRow = Integer.MAX_VALUE; + + public ReadCommandImpl(String sqlString) { + super(sqlString); + } + + public ReadCommandImpl(String sqlString, Config mapping) { + this(sqlString); + if (mapping != null) + setMappingModel(mapping); + } + + //TODO - Need to refactor based on use of DataSource and CommandGroup + public ReadCommandImpl(String sqlString, Config mapping, Connection connection) { + this(sqlString); + setConnection(connection); + if (mapping != null) + setMappingModel(mapping); + } + + public void execute() { + throw new UnsupportedOperationException(); + } + + public DataObject executeQuery() { + + if (statement.getConnection() == null) + throw new RuntimeException("A DASConnection object must be specified before executing the query."); + + boolean success = false; + try { + ResultSet rs = statement.executeQuery(parameters); + success = true; + return buildGraph(rs); + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + if (success) + statement.getConnection().cleanUp(); + else + statement.getConnection().errorCleanUp(); + } + } + + protected DataObject buildGraph(ResultSet result) throws SQLException { + + List results = new ArrayList(); + results.add(result); + + // Before we use the mappingModel, do some checking/updating. If + // inferrable information + // isn't specified, add it in. + + GraphBuilderMetadata gbmd = new GraphBuilderMetadata(results, getSchema(), configWrapper.getConfig(), + resultSetShape); + + // Create the DataGraph + DataGraph g = SDOUtil.createDataGraph(); + + // Create the root object + g.createRootObject(gbmd.getSchema()); + + ChangeSummary summary = g.getChangeSummary(); + + ResultSetProcessor rsp = new ResultSetProcessor(g.getRootObject(), gbmd); + rsp.processResults(getStartRow(), getEndRow()); + + summary.beginLogging(); + + return g.getRootObject(); + } + + private Type getSchema() { + return (Type) schema; + } + + protected int getStartRow() { + return startRow; + } + + protected int getEndRow() { + return endRow; + } + + protected void setStartRow(int startRow) { + this.startRow = startRow; + } + + protected void setEndRow(int endRow) { + this.endRow = endRow; + } + + private void setMappingModel(Config config) { + configWrapper = new MappingWrapper(config); + //TODO - need to refactor and take into regression that lost ability to use Datasource + if (getConnection() == null) + if (config.getConnectionProperties() != null) + setConnection(config.getConnectionProperties()); + } + + public void setConnection(ConnectionProperties c) { + try { + Connection connection = null; + Class.forName(c.getDriverClassName()); + if (c.getDriverUserName() == null) + connection = DriverManager.getConnection(c.getDriverURL()); + else + connection = DriverManager.getConnection(c.getDriverURL(), c.getDriverUserName(), c + .getDriverPassword()); + connection.setAutoCommit(false); + setConnection(connection); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + public void setDataObjectModel(Type schema) { + this.schema = schema; + } + + protected void enablePaging() { + statement.enablePaging(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java new file mode 100644 index 0000000000..7afa3b8563 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SDODataTypeHelper.java @@ -0,0 +1,100 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.Types; + +import org.apache.tuscany.das.rdb.SDODataTypes; + +import commonj.sdo.Type; + +public class SDODataTypeHelper { + + static public int sqlTypeFor(Type sdoType) { + if ( sdoType == SDODataTypes.BOOLEAN) + return Types.BOOLEAN; + else if ( sdoType == SDODataTypes.STRING) + return Types.VARCHAR; + else if ( sdoType == SDODataTypes.BYTE) + return Types.TINYINT; + else if ( sdoType == SDODataTypes.BYTES) + return Types.BINARY; + else if ( sdoType == SDODataTypes.CHARACTER) + return Types.CHAR; + else if ( sdoType == SDODataTypes.DATE) + return Types.DATE; + else if ( sdoType == SDODataTypes.DATETIME) + return Types.DATE; + else if ( sdoType == SDODataTypes.DAY ) + return java.sql.Types.BINARY; + else if ( sdoType == SDODataTypes.DECIMAL ) + return java.sql.Types.DECIMAL; + else if ( sdoType == SDODataTypes.DOUBLE ) + return java.sql.Types.DOUBLE; + else if ( sdoType == SDODataTypes.DURATION ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.FLOAT ) + return java.sql.Types.REAL; + else if ( sdoType == SDODataTypes.INT ) + return java.sql.Types.INTEGER; + else if ( sdoType == SDODataTypes.INTEGER ) + return java.sql.Types.INTEGER; + else if ( sdoType == SDODataTypes.LONG ) + return java.sql.Types.BIGINT; + else if ( sdoType == SDODataTypes.MONTH ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.MONTHDAY ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.OBJECT ) + return java.sql.Types.JAVA_OBJECT; + else if ( sdoType == SDODataTypes.SHORT ) + return java.sql.Types.SMALLINT; + else if ( sdoType == SDODataTypes.STRING ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.STRINGS ) + return java.sql.Types.OTHER; + else if ( sdoType == SDODataTypes.TIME ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.URI ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.YEAR ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.YEARMONTH ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.YEARMONTHDAY ) + return java.sql.Types.VARCHAR; + else if ( sdoType == SDODataTypes.BOOLEANOBJECT ) + return java.sql.Types.BOOLEAN; + else if ( sdoType == SDODataTypes.BYTEOBJECT ) + return java.sql.Types.TINYINT; + else if ( sdoType == SDODataTypes.CHARACTEROBJECT ) + return java.sql.Types.CHAR; + else if ( sdoType == SDODataTypes.DOUBLEOBJECT ) + return java.sql.Types.DOUBLE; + else if ( sdoType == SDODataTypes.FLOATOBJECT ) + return java.sql.Types.REAL; + else if ( sdoType == SDODataTypes.INTEGEROBJECT ) + return java.sql.Types.INTEGER; + else if ( sdoType == SDODataTypes.LONGOBJECT ) + return java.sql.Types.BIGINT; + else if ( sdoType == SDODataTypes.SHORTOBJECT ) + return java.sql.Types.SMALLINT; + else + throw new RuntimeException("Not a valid SDO Type " + sdoType); + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java new file mode 100644 index 0000000000..0fb647815d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/SPCommandImpl.java @@ -0,0 +1,73 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +import commonj.sdo.DataObject; + +public class SPCommandImpl extends ReadCommandImpl { + + public SPCommandImpl(String sqlString) { + super(sqlString); + } + + public SPCommandImpl(String sqlString, Config config) { + super(sqlString, config); + } + + public DataObject executeQuery() { + + boolean success = false; + try { + ResultSet rs = statement.executeCall(parameters); + success = true; + + return buildGraph(rs); + } catch (SQLException e) { + DebugUtil.debugln(getClass(), debug, e); + throw new RuntimeException(e); + } finally { + if (success) + statement.getConnection().cleanUp(); + else + statement.getConnection().errorCleanUp(); + } + } + + public void execute() { + + boolean success = false; + try { + statement.executeUpdateCall(parameters); + success = true; + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + if (success) + statement.getConnection().cleanUp(); + else + statement.getConnection().errorCleanUp(); + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java new file mode 100644 index 0000000000..6bc18dc229 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/Statement.java @@ -0,0 +1,206 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.util.DebugUtil; + +//TODO - Can use some refactoring. Much code is duplicated in "execute" methods +public class Statement { + + protected final QueryString queryString; + + protected ConnectionImpl jdbcConnection; + + private static final boolean debug = false; + + private PreparedStatement preparedStatement; + + private boolean isPaging = false; + + public Statement(String sqlString) { + this.queryString = new QueryString(sqlString); + } + + public ResultSet executeQuery(Parameters parameters) throws SQLException { + + PreparedStatement ps = getPreparedStatement(); + ps = setParameters(ps, parameters); + ResultSet rs = ps.executeQuery(); + + return rs; + } + + public ResultSet executeCall(Parameters parameters) throws SQLException { + try { + CallableStatement cs = jdbcConnection.prepareCall(queryString); + + Iterator inParams = parameters.inParams().iterator(); + while (inParams.hasNext()) { + Parameter param = (Parameter) inParams.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + cs.setObject(param.getIndex(), param.getValue()); + } + + // register out parameters + Iterator outParams = parameters.outParams().iterator(); + while (outParams.hasNext()) { + Parameter param = (Parameter) outParams.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + DebugUtil.debugln(getClass(), debug, "Registering parameter " + param.getName()); + cs.registerOutParameter(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType())); + } + + // Using execute because Derby does not currenlty support + // executeQuery + // for SP + cs.execute(); + ResultSet results = cs.getResultSet(); + + Iterator i = parameters.outParams().iterator(); + while (i.hasNext()) { + Parameter param = (Parameter) i.next(); + param.setValue(cs.getObject(param.getIndex())); + } + + return results; + } catch (SQLException ex) { + ex.printStackTrace(); + throw ex; + } + + } + + public void executeUpdateCall(Parameters parameters) throws SQLException { + CallableStatement cs = jdbcConnection.prepareCall(queryString); + + Iterator inParams = parameters.inParams().iterator(); + while (inParams.hasNext()) { + Parameter param = (Parameter) inParams.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + cs.setObject(param.getIndex(), param.getValue()); + } + + // register out parameters + Iterator outParams = parameters.outParams().iterator(); + while (outParams.hasNext()) { + Parameter param = (Parameter) outParams.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + DebugUtil.debugln(getClass(), debug, "Registering parameter " + param.getName()); + cs.registerOutParameter(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType())); + } + + cs.execute(); + + Iterator out = parameters.outParams().iterator(); + while (out.hasNext()) { + Parameter param = (Parameter) out.next(); + param.setValue(cs.getObject(param.getIndex())); + } + + } + + /** + * TODO - We need to look at using specific ps.setXXX methods when a type + * has been specified and try setObject otherwise. + */ + public int executeUpdate(Parameters parameters) throws SQLException { + DebugUtil.debugln(getClass(), debug, "Executing statement " + queryString.getPreparedString()); + PreparedStatement ps = getPreparedStatement(); + Iterator i = parameters.inParams().iterator(); + while (i.hasNext()) { + Parameter param = (Parameter) i.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + Object value = param.getValue(); + DebugUtil.debugln(getClass(), debug, "Setting parameter " + param.getIndex() + " to " + value); + if (value == null) { + ps.setNull(param.getIndex(), SDODataTypeHelper.sqlTypeFor(param.getType())); + } else { + ps.setObject(param.getIndex(), value); + } + } + return ps.executeUpdate(); + } + + protected PreparedStatement setParameters(PreparedStatement ps, Parameters parameters) + throws SQLException { + Iterator i = parameters.inParams().iterator(); + while (i.hasNext()) { + Parameter param = (Parameter) i.next(); + if (param.getIndex() == 0) + param.setIndex(queryString.getParameterIndex(param.getName())); + ps.setObject(param.getIndex(), param.getValue()); + } + return ps; + } + + public void setConnection(ConnectionImpl jdbcConnection) { + this.jdbcConnection = jdbcConnection; + } + + public ConnectionImpl getConnection() { + return this.jdbcConnection; + } + + private PreparedStatement getPreparedStatement() throws SQLException { + DebugUtil.debugln(getClass(), debug, "Getting prepared statement"); + if (preparedStatement == null) + if (isPaging) + preparedStatement = jdbcConnection.preparePagedStatement(queryString); + else + preparedStatement = jdbcConnection.prepareStatement(queryString); + + return preparedStatement; + } + + public Integer getGeneratedKey() throws SQLException { + + ResultSet rs = getPreparedStatement().getGeneratedKeys(); + if (rs.next()) + return new Integer(rs.getInt(1)); + + return null; + } + + protected void enablePaging() { + isPaging = true; + } + + public void close() { + + if (this.preparedStatement != null) { + try { + preparedStatement.close(); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java new file mode 100644 index 0000000000..7fffe97d5d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateCommandImpl.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +public class UpdateCommandImpl extends WriteCommandImpl { + + public UpdateCommandImpl(String sqlString) { + super(sqlString); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java new file mode 100644 index 0000000000..1ab2f16fca --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateList.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + +import java.util.ArrayList; +import java.util.Collection; + +/** + * Updates don't have to be sorted, so this class is a simple wrapper of ArrayList. + * + */ +public class UpdateList { + + private ArrayList updates = new ArrayList(); + + public UpdateList() { + super(); + } + + public void add(ChangeOperation c) { + updates .add(c); + } + + public Collection getSortedList() { + return updates; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java new file mode 100644 index 0000000000..cbe73a16e4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/UpdateOperation.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.impl; + + +import commonj.sdo.DataObject; + + +public class UpdateOperation extends ChangeOperation { + + public UpdateOperation(UpdateCommandImpl command, DataObject changedObject, String id) { + super(command, changedObject); + this.propagatedID = id; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java new file mode 100644 index 0000000000..ff1ac385d4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/impl/WriteCommandImpl.java @@ -0,0 +1,97 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.impl; + +import java.sql.SQLException; +import java.util.Collection; +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Parameter; +import org.apache.tuscany.das.rdb.config.Config; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +public abstract class WriteCommandImpl extends CommandImpl { + + + public WriteCommandImpl(String sqlString) { + super(sqlString); + } + + public void execute() { + + boolean success = false; + try { + statement.executeUpdate(parameters); + subtypeProcessing(); + success = true; + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + if (success) + statement.getConnection().cleanUp(); + else + statement.getConnection().errorCleanUp(); + } + + } + + public DataObject executeQuery() { + throw new UnsupportedOperationException(); + } + + public Config getMappingModel() { + return configWrapper.getConfig(); + } + + + /** + * Subclasses add specific bahavior + * Default is to do nothing + */ + protected void subtypeProcessing() throws SQLException { + if ( false ) + throw new SQLException(); + } + + public void setDataObjectModel(Type schema) { + // don't really care what the model is here + } + + public String toString() { + + StringBuffer buffer = new StringBuffer(); + buffer.append("\nSQL: " + statement.queryString.getUnmodifiedString()); + buffer.append("\nModified SQL: " + statement.queryString.getPreparedString()); + return buffer.toString(); + } + + public int getGeneratedKey() { + throw new RuntimeException("No generated key is available"); + } + + public void addParameters(Collection updateParameters) { + Iterator i = updateParameters.iterator(); + while ( i.hasNext()) { + Parameter p = (Parameter) i.next(); + addParameter(p); + } + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java new file mode 100644 index 0000000000..15943da067 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/merge/impl/GraphMerger.java @@ -0,0 +1,166 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.merge.impl; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Logger; + +import org.apache.tuscany.das.rdb.config.wrapper.QualifiedColumn; +import org.apache.tuscany.das.rdb.graphbuilder.impl.MultiTableRegistry; +import org.apache.tuscany.das.rdb.graphbuilder.impl.TableRegistry; +import org.apache.tuscany.sdo.impl.ChangeSummaryImpl; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataObject; +import commonj.sdo.Property; + +public class GraphMerger { + + private HashMap keys = new HashMap(); + + private TableRegistry registry = new MultiTableRegistry(); + + private static Logger logger = Logger.getLogger("GraphMerger"); + + //TODO lots of cleanup/design + public GraphMerger() { + // Empty Constructor + } + + public DataObject merge(List graphs) { + DataObject primaryGraph = (DataObject) graphs.get(0); + + Iterator i = graphs.iterator(); + if (i.hasNext()) + i.next(); + while (i.hasNext()) { + primaryGraph = merge(primaryGraph, (DataObject) i.next()); + } + + return primaryGraph; + } + + public DataObject merge(DataObject primary, DataObject secondary) { + addGraphToRegistry(primary); + + ChangeSummary summary = primary + .getDataGraph().getChangeSummary(); + summary.endLogging(); + Iterator i = secondary.getType().getProperties().iterator(); + + while (i.hasNext()) { + Property p = (Property) i.next(); + + Iterator objects = secondary.getList(p.getName()).iterator(); + while (objects.hasNext()) { + DataObject object = (DataObject) objects.next(); + createObjectWithSubtree(primary, p, object); + } + } + ((ChangeSummaryImpl)summary).resumeLogging(); + return primary; + } + + private void createObjectWithSubtree(DataObject root, Property p, + DataObject object) { + Object pk = getPrimaryKey(object); + + if (!registry.contains(object.getType().getName(), Collections + .singletonList(pk))) { + // logger.info("creating " + object.getType().getName() + " with pk " + pk); + DataObject newObject = root.createDataObject(p.getName()); + + + + Iterator attrs = object.getType().getProperties().iterator(); + while (attrs.hasNext()) { + Property attr = (Property) attrs.next(); + if ( attr.getType().isDataType()) { + newObject.set(attr.getName(), object.get(attr)); + } + } + registry.put(object.getType().getName(), Collections + .singletonList(pk), newObject); + + Iterator refs = object.getType().getProperties().iterator(); + while (refs.hasNext()) { + Property ref = (Property) refs.next(); + if ( !ref.getType().isDataType()) { + List refObjects; + if (!ref.isMany()) { + refObjects = Collections.singletonList(object.get(ref)); + } else { + refObjects = (List) object.get(ref); + } + + Iterator iter = refObjects.iterator(); + while (iter.hasNext()) { + DataObject refObject = (DataObject) iter.next(); + createObjectWithSubtree(root, refObject + .getContainmentProperty(), refObject); + + refObject = (DataObject) registry.get(refObject.getType().getName(), Collections.singletonList(getPrimaryKey(refObject))); + if (ref.isMany()) { + newObject.getList( + newObject.getType().getProperty(ref.getName())) + .add(refObject); + } else + newObject.set(newObject.getType().getProperty( + ref.getName()), refObject); + } + } + + } + + } + + } + + private void addGraphToRegistry(DataObject graph1) { + Iterator i = graph1.getType().getProperties().iterator(); + while (i.hasNext()) { + Property p = (Property) i.next(); + Iterator objects = graph1.getList(p).iterator(); + while (objects.hasNext()) { + DataObject object = (DataObject) objects.next(); + Object pk = object.get(getPrimaryKeyName(object)); + logger.finest("Adding object with pk " + pk + " to registry"); + registry.put(object.getType().getName(), Collections + .singletonList(pk), object); + } + } + } + + private Object getPrimaryKey(DataObject object) { + String pkName = getPrimaryKeyName(object); + return object.get(pkName); + } + + private String getPrimaryKeyName(DataObject object) { + return (String) keys.get(object.getType().getName()); + } + + public void addPrimaryKey(String key) { + QualifiedColumn column = new QualifiedColumn(key); + logger.finest("Adding " + column.getTableName() + " " + + column.getColumnName() + " to keys"); + keys.put(column.getTableName(), column.getColumnName()); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java new file mode 100644 index 0000000000..c0d7f41e8b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.util; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.helper.XMLHelper; + +/** + * Config util provides config-related utilities such as loading a Config + * instance from an InputStream + * + */ +public class ConfigUtil { + + public static Config loadConfig(InputStream configStream) { + + if (configStream == null) + throw new Error( + "Cannot load configuration from a null InputStream. Possibly caused by an incorrect config xml file name"); + + SDOUtil.registerStaticTypes(ConfigFactory.class); + XMLHelper helper = XMLHelper.INSTANCE; + + try { + return (Config) helper.load(configStream).getRootObject(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java new file mode 100644 index 0000000000..7f96f9aef4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java @@ -0,0 +1,73 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.util; + +import java.util.Iterator; +import java.util.List; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.ChangeSummary.Setting; +import commonj.sdo.helper.DataFactory; + +/** + */ +public class DataObjectUtil { + + //Utilities + public static DataObject getRestoredCopy(DataObject changedDO) { + DataObject changedCopy = getCopy(changedDO); + restoreAttributeValues(changedCopy, changedDO); + return changedCopy; + } + + public static DataObject getCopy(DataObject original) { + + DataObject copy = DataFactory.INSTANCE.create(original.getType()); + + //Fill in values + Iterator i = original.getType().getProperties().iterator(); + while (i.hasNext()) { + Property feature = (Property) i.next(); + copy.set(feature, original.get(feature)); + } + return copy; + } + + /** + * @param changedCopy + * @return + */ + private static void restoreAttributeValues(DataObject changedCopy, DataObject changedDO) { + + ChangeSummary changeSummary = changedDO.getDataGraph().getChangeSummary(); + List changes = changeSummary.getOldValues(changedDO); + if ( changes == null ) + return; + + Iterator i = changes.iterator(); + while (i.hasNext()) { + Setting s = (Setting) i.next(); + if ( s.getProperty().getType().isDataType() ) + changedCopy.set(s.getProperty(), s.getValue()); + } + } + + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java new file mode 100644 index 0000000000..ed2e1063d6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugFormatter.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.util; + +import java.util.logging.Formatter; +import java.util.logging.LogRecord; + +public class DebugFormatter extends Formatter { + + public String format(LogRecord record) { + StringBuffer message = new StringBuffer(); + message.append("["); + message.append(record.getSourceClassName()); + message.append("] "); + message.append(record.getMessage()); + message.append("\n"); + return message.toString(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java new file mode 100644 index 0000000000..745fe8cb7e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DebugUtil.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.util; + +import java.util.logging.ConsoleHandler; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +//TODO Restructure Logging +public class DebugUtil { + + private static StringBuffer buffer = new StringBuffer(); + private static final Logger logger = Logger.getAnonymousLogger(); + + static { + logger.setUseParentHandlers(false); + Handler h = new ConsoleHandler(); + h.setFormatter(new DebugFormatter()); + logger.addHandler(h); + } + public static void debugln(Class c, boolean flag, Object obj) { + + if ( flag ) { + logger.logp(Level.INFO, getClassName(c), null, obj.toString() ); + } + } + + public static void debug(Class c, boolean flag, Object obj) { + if ( flag ) { + System.out.print("[" + getClassName(c) + "] " + obj ); + } + } + + public static void buffer(boolean flag, Object obj) { + if ( flag ) + buffer.append(obj); + } + + public static void flushBuffer(Class c, boolean flag) { + if ( flag ) { + System.out.println("[" + getClassName(c) + "] " + buffer.toString()); + buffer = new StringBuffer(); + } + } + + private static String getClassName(Class c) { + String className = c.getName(); + return className.substring(className.lastIndexOf(".") + 1); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/MANIFEST.MF b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..cfdce9ed00 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Extension-Name: tuscany-das-rdb +Specification-Title: Tuscany DAS for Relational Databases +Specification-Vendor: Apache Software Foundation +Implementation-Vendor: Apache Software Foundation +Implementation-Vendor-Id: org.apache +Implementation-Title: tuscany-das-rdb +Implementation-Version: incubating-M1 +Bundle-ManifestVersion: 2 +Bundle-Name: Tuscany DAS for Relational Databases +Bundle-SymbolicName: org.apache.tuscany.das.rdb +Bundle-Version: 1.0.0 +Bundle-Vendor: Apache Software Foundation diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/config.xsd b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/config.xsd new file mode 100644 index 0000000000..031f5a9546 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/config.xsd @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/dasmodel4.mdl b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/dasmodel4.mdl new file mode 100644 index 0000000000..1de7601cab --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/main/resources/dasmodel4.mdl @@ -0,0 +1,4645 @@ + +(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 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 "ConnectionProperties" + quid "4362A2FD0085" + class_attributes (list class_attribute_list + (object ClassAttribute "dataSource" + quid "4362A35A035A" + type "String") + (object ClassAttribute "driverClassName" + quid "4362A36D0203" + type "String") + (object ClassAttribute "driverURL" + quid "4362A3740330" + type "String") + (object ClassAttribute "driverPassword" + quid "4362A384022E" + type "String") + (object ClassAttribute "driverUserName" + quid "4378E1B303C2" + 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 "name" + quid "4362A7B2031D" + type "String") + (object ClassAttribute "propertyName" + 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 "name" + 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 "converter" + quid "437B5A6F0153" + type "String")) + 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 "4362A308010D" + roles (list role_list + (object Role "$UNNAMED$4" + quid "4362A3090015" + supplier "Logical View::config::Config" + quidu "4362A2DE0045" + is_navigable TRUE + is_aggregate TRUE) + (object Role "$UNNAMED$5" + quid "4362A3090016" + supplier "Logical View::config::ConnectionProperties" + quidu "4362A2FD0085" + client_cardinality (value cardinality "0..1") + Containment "By Value" + is_navigable TRUE))) + (object Association "$UNNAMED$6" + quid "4362A3D302FA" + roles (list role_list + (object Role "$UNNAMED$7" + quid "4362A3D40143" + supplier "Logical View::config::Command" + quidu "4362A2EC01FE" + is_navigable TRUE + is_aggregate TRUE) + (object Role "$UNNAMED$8" + quid "4362A3D40144" + supplier "Logical View::config::Parameter" + quidu "4362A3C902BA" + client_cardinality (value cardinality "0..n") + Containment "By Value" + is_navigable TRUE))) + (object Association "$UNNAMED$9" + quid "4362A448026C" + roles (list role_list + (object Role "$UNNAMED$10" + quid "4362A4490105" + supplier "Logical View::config::Config" + quidu "4362A2DE0045" + is_navigable TRUE + is_aggregate TRUE) + (object Role "$UNNAMED$11" + quid "4362A4490106" + supplier "Logical View::config::Table" + quidu "4362A43C0002" + client_cardinality (value cardinality "0..n") + Containment "By Value" + is_navigable TRUE))) + (object Association "$UNNAMED$12" + quid "4362A44B0298" + roles (list role_list + (object Role "$UNNAMED$13" + quid "4362A44C01AA" + supplier "Logical View::config::Config" + quidu "4362A2DE0045" + is_navigable TRUE + is_aggregate TRUE) + (object Role "$UNNAMED$14" + quid "4362A44C01AB" + supplier "Logical View::config::Relationship" + quidu "4362A42E03A5" + client_cardinality (value cardinality "0..n") + Containment "By Value" + is_navigable TRUE))) + (object Association "$UNNAMED$15" + quid "4362A76302A1" + roles (list role_list + (object Role "$UNNAMED$16" + quid "4362A7640090" + supplier "Logical View::config::Table" + quidu "4362A43C0002" + is_navigable TRUE + is_aggregate TRUE) + (object Role "$UNNAMED$17" + quid "4362A7640091" + supplier "Logical View::config::Column" + quidu "4362A75C016B" + client_cardinality (value cardinality "0..n") + Containment "By Value" + is_navigable TRUE))) + (object Association "$UNNAMED$18" + quid "4362A771032E" + roles (list role_list + (object Role "$UNNAMED$19" + quid "4362A7720108" + supplier "Logical View::config::Relationship" + quidu "4362A42E03A5" + is_navigable TRUE + is_aggregate TRUE) + (object Role "$UNNAMED$20" + quid "4362A7720109" + supplier "Logical View::config::KeyPair" + quidu "4362A72E0010" + client_cardinality (value cardinality "0..n") + Containment "By Value" + is_navigable TRUE))) + (object Association "$UNNAMED$21" + quid "437B59A10066" + roles (list role_list + (object Role "$UNNAMED$22" + quid "437B59A30145" + supplier "Logical View::config::Command" + quidu "4362A2EC01FE" + Containment "By Value" + is_navigable TRUE + is_aggregate TRUE) + (object Role "$UNNAMED$23" + 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" + 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" + width 536 + height 486 + autoResize TRUE) + (object ClassView "Class" "Logical View::config::ConnectionProperties" @3 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2542, 248) + label (object ItemLabel + Parent_View @3 + location (2317, 67) + fill_color 13434879 + nlines 1 + max_width 450 + justify 0 + label "ConnectionProperties") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "4362A2FD0085" + width 468 + height 386 + autoResize TRUE) + (object ClassView "Class" "Logical View::config::Relationship" @4 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1054, 744) + label (object ItemLabel + Parent_View @4 + 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" + width 468 + height 336 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$18" @5 + location (1081, 1063) + stereotype TRUE + line_color 3342489 + quidu "4362A771032E" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$19" @6 + Parent_View @5 + location (-97, -84) + stereotype TRUE + line_color 3342489 + quidu "4362A7720108" + client @5 + supplier @4 + line_style 3 + origin_attachment (1080, 1063) + terminal_attachment (1080, 912)) + (object RoleView "$UNNAMED$20" @7 + Parent_View @5 + location (-97, -84) + stereotype TRUE + line_color 3342489 + quidu "4362A7720109" + client @5 + supplier @1 + line_style 3 + origin_attachment (1080, 1063) + terminal_attachment (1080, 1215) + label (object SegLabel @8 + Parent_View @7 + 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" @9 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1984, 837) + label (object ItemLabel + Parent_View @9 + location (1784, 656) + fill_color 13434879 + nlines 1 + max_width 400 + justify 0 + label "Table") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "4362A43C0002" + width 418 + height 386 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$15" @10 + location (1778, 1153) + stereotype TRUE + line_color 3342489 + quidu "4362A76302A1" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$16" @11 + Parent_View @10 + location (1003, 6) + stereotype TRUE + line_color 3342489 + quidu "4362A7640090" + client @10 + supplier @9 + line_style 3 + origin_attachment (1778, 1153) + terminal_attachment (1778, 1030)) + (object RoleView "$UNNAMED$17" @12 + Parent_View @10 + location (1003, 6) + stereotype TRUE + line_color 3342489 + quidu "4362A7640091" + client @10 + supplier @2 + line_style 3 + origin_attachment (1778, 1153) + terminal_attachment (1778, 1276) + label (object SegLabel @13 + Parent_View @12 + location (1832, 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" @14 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (186, 806) + label (object ItemLabel + Parent_View @14 + 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" + width 382 + height 236 + autoResize TRUE) + (object ClassView "Class" "Logical View::config::Config" @15 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1054, 155) + label (object ItemLabel + Parent_View @15 + location (959, 74) + fill_color 13434879 + nlines 1 + max_width 190 + justify 0 + label "Config") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "4362A2DE0045" + width 208 + height 186 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$3" @16 + location (1733, 184) + stereotype TRUE + line_color 3342489 + quidu "4362A308010D" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$4" @17 + Parent_View @16 + location (307, -498) + stereotype TRUE + line_color 3342489 + quidu "4362A3090015" + client @16 + supplier @15 + line_style 3 + origin_attachment (1733, 184) + terminal_attachment (1158, 184)) + (object RoleView "$UNNAMED$5" @18 + Parent_View @16 + location (307, -498) + stereotype TRUE + line_color 3342489 + quidu "4362A3090016" + client @16 + supplier @3 + line_style 3 + origin_attachment (1733, 184) + terminal_attachment (2308, 184) + label (object SegLabel @19 + Parent_View @18 + location (2194, 126) + anchor 2 + anchor_loc 1 + nlines 1 + max_width 15 + justify 0 + label "0..1" + pctDist 0.801805 + height 59 + orientation 0)))) + (object AssociationViewNew "$UNNAMED$12" @20 + location (1054, 411) + label (object SegLabel @21 + Parent_View @20 + location (1054, 352) + 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$13" @22 + Parent_View @20 + location (-93, -395) + label (object SegLabel @23 + Parent_View @22 + location (1013, 281) + 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 @20 + supplier @15 + line_style 0) + (object RoleView "$UNNAMED$14" @24 + Parent_View @20 + location (-93, -395) + label (object SegLabel @25 + Parent_View @24 + location (1013, 509) + 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 @20 + supplier @4 + line_style 0 + label (object SegLabel @26 + Parent_View @24 + location (1011, 558) + anchor 2 + anchor_loc 1 + nlines 1 + max_width 15 + justify 0 + label "0..*" + pctDist 0.899471 + height 44 + orientation 1)))) + (object AssociationViewNew "$UNNAMED$9" @27 + location (1666, 248) + stereotype TRUE + line_color 3342489 + quidu "4362A448026C" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$10" @28 + Parent_View @27 + location (860, -558) + stereotype TRUE + line_color 3342489 + quidu "4362A4490105" + client @27 + supplier @15 + line_style 3 + origin_attachment (1667, 247) + terminal_attachment (1158, 247)) + (object RoleView "$UNNAMED$11" @29 + Parent_View @27 + location (860, -558) + stereotype TRUE + line_color 3342489 + quidu "4362A4490106" + client @27 + supplier @9 + vertices (list Points + (1667, 247) + (1972, 247) + (1972, 644)) + line_style 3 + origin_attachment (1667, 247) + terminal_attachment (1972, 644) + label (object SegLabel @30 + Parent_View @29 + location (2031, 380) + 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" @31 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (186, 217) + label (object ItemLabel + Parent_View @31 + 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" + width 264 + height 286 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$6" @32 + location (186, 523) + stereotype TRUE + line_color 3342489 + quidu "4362A3D302FA" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$7" @33 + Parent_View @32 + location (-279, -500) + stereotype TRUE + line_color 3342489 + quidu "4362A3D40143" + client @32 + supplier @31 + line_style 0) + (object RoleView "$UNNAMED$8" @34 + Parent_View @32 + location (-279, -500) + stereotype TRUE + line_color 3342489 + quidu "4362A3D40144" + client @32 + supplier @14 + line_style 0 + label (object SegLabel @35 + Parent_View @34 + 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" @36 + location (634, 212) + stereotype TRUE + line_color 3342489 + quidu "4362A3030323" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$1" @37 + Parent_View @36 + location (200, -470) + stereotype TRUE + line_color 3342489 + quidu "4362A3040108" + client @36 + supplier @15 + line_style 3 + origin_attachment (634, 212) + terminal_attachment (950, 212)) + (object RoleView "$UNNAMED$2" @38 + Parent_View @36 + location (200, -470) + stereotype TRUE + line_color 3342489 + quidu "4362A3040109" + client @36 + supplier @31 + line_style 3 + origin_attachment (634, 212) + terminal_attachment (318, 212) + label (object SegLabel @39 + Parent_View @38 + location (371, 260) + 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" @40 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (465, 1240) + label (object ItemLabel + Parent_View @40 + 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" + width 452 + height 336 + annotation 8 + autoResize TRUE) + (object AssociationViewNew "$UNNAMED$21" @41 + location (484, 626) + stereotype TRUE + line_color 3342489 + quidu "437B59A10066" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$22" @42 + Parent_View @41 + location (50, -614) + stereotype TRUE + line_color 3342489 + quidu "437B59A30145" + client @41 + supplier @31 + vertices (list Points + (484, 626) + (484, 347) + (318, 347)) + line_style 3 + origin_attachment (484, 626) + terminal_attachment (318, 347)) + (object RoleView "$UNNAMED$23" @43 + Parent_View @41 + location (50, -614) + stereotype TRUE + line_color 3342489 + quidu "437B59A30146" + client @41 + supplier @40 + line_style 3 + origin_attachment (484, 626) + terminal_attachment (484, 1072) + label (object SegLabel @44 + Parent_View @43 + 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" @45 + location (682, 589) + label (object ItemLabel + Parent_View @45 + location (538, 505) + fill_color 13434879 + nlines 2 + max_width 288 + justify 0 + label "config") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "4362A2A10169" + width 300 + height 180))))) + root_subsystem (object SubSystem "Component View" + quid "4362A29901BB" + physical_models (list unit_reference_list) + physical_presentations (list unit_reference_list + (object Module_Diagram "Main" + quid "4362A2990258" + title "Main" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list)))) + process_structure (object Processes + quid "4362A29901BC" + ProcsNDevs (list + (object Process_Diagram "Deployment View" + quid "4362A29901BE" + title "Deployment View" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list)))) + properties (object Properties + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "propertyId" + value "809135969") + (object Attribute + tool "Ecore" + name "default__Category" + value (list Attribute_Set + (object Attribute + tool "Ecore" + name "packageName" + value "") + (object Attribute + tool "Ecore" + name "nsPrefix" + value "") + (object Attribute + tool "Ecore" + name "nsURI" + value "") + (object Attribute + tool "Ecore" + name "basePackage" + value "") + (object Attribute + tool "Ecore" + name "prefix" + value "") + (object Attribute + tool "Ecore" + name "annotation" + value ""))) + (object Attribute + tool "Ecore" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Ecore" + name "classifierName" + value "") + (object Attribute + tool "Ecore" + name "constraints" + value "") + (object Attribute + tool "Ecore" + name "xmlName" + value "") + (object Attribute + tool "Ecore" + name "xmlContentKind" + value ("ContentKind" 0)) + (object Attribute + tool "Ecore" + name "ContentKind" + value (list Attribute_Set + (object Attribute + tool "Ecore" + name "Unspecified" + value 0) + (object Attribute + tool "Ecore" + name "Empty" + value 1) + (object Attribute + tool "Ecore" + name "Simple" + value 2) + (object Attribute + tool "Ecore" + name "Mixed" + value 3) + (object Attribute + tool "Ecore" + name "ElementOnly" + value 4))) + (object Attribute + tool "Ecore" + name "annotation" + value ""))) + (object Attribute + tool "Ecore" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Ecore" + name "operationName" + value "") + (object Attribute + tool "Ecore" + name "isUnique" + value TRUE) + (object Attribute + tool "Ecore" + name "annotation" + value ""))) + (object Attribute + tool "Ecore" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Ecore" + name "attributeName" + value "") + (object Attribute + tool "Ecore" + name "isTransient" + value FALSE) + (object Attribute + tool "Ecore" + name "isVolatile" + value FALSE) + (object Attribute + tool "Ecore" + name "isChangeable" + value TRUE) + (object Attribute + tool "Ecore" + name "isUnsettable" + value FALSE) + (object Attribute + tool "Ecore" + name "isUnique" + value TRUE) + (object Attribute + tool "Ecore" + name "isID" + value FALSE) + (object Attribute + tool "Ecore" + name "visibility" + value ("VisibilityKind" 0)) + (object Attribute + tool "Ecore" + name "VisibilityKind" + value (list Attribute_Set + (object Attribute + tool "Ecore" + name "Unspecified" + value 0) + (object Attribute + tool "Ecore" + name "None" + value 1) + (object Attribute + tool "Ecore" + name "Read-only" + value 2) + (object Attribute + tool "Ecore" + name "Read-write" + value 3) + (object Attribute + tool "Ecore" + name "Read-only unsettable" + value 4) + (object Attribute + tool "Ecore" + name "Read-write unsettable" + value 5))) + (object Attribute + tool "Ecore" + name "xmlName" + value "") + (object Attribute + tool "Ecore" + name "xmlNamespace" + value "") + (object Attribute + tool "Ecore" + name "xmlFeatureKind" + value ("FeatureKind" 0)) + (object Attribute + tool "Ecore" + name "FeatureKind" + value (list Attribute_Set + (object Attribute + tool "Ecore" + name "Unspecified" + value 0) + (object Attribute + tool "Ecore" + name "Simple" + value 1) + (object Attribute + tool "Ecore" + name "Attribute" + value 2) + (object Attribute + tool "Ecore" + name "Element" + value 4))) + (object Attribute + tool "Ecore" + name "annotation" + value ""))) + (object Attribute + tool "Ecore" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Ecore" + name "referenceName" + value "") + (object Attribute + tool "Ecore" + name "isTransient" + value FALSE) + (object Attribute + tool "Ecore" + name "isVolatile" + value FALSE) + (object Attribute + tool "Ecore" + name "isChangeable" + value TRUE) + (object Attribute + tool "Ecore" + name "isUnsettable" + value FALSE) + (object Attribute + tool "Ecore" + name "isResolveProxies" + value TRUE) + (object Attribute + tool "Ecore" + name "visibility" + value ("VisibilityKind" 0)) + (object Attribute + tool "Ecore" + name "VisibilityKind" + value (list Attribute_Set + (object Attribute + tool "Ecore" + name "Unspecified" + value 0) + (object Attribute + tool "Ecore" + name "None" + value 1) + (object Attribute + tool "Ecore" + name "Read-only" + value 2) + (object Attribute + tool "Ecore" + name "Read-write" + value 3) + (object Attribute + tool "Ecore" + name "Read-only unsettable" + value 4) + (object Attribute + tool "Ecore" + name "Read-write unsettable" + value 5))) + (object Attribute + tool "Ecore" + name "xmlName" + value "") + (object Attribute + tool "Ecore" + name "xmlNamespace" + value "") + (object Attribute + tool "Ecore" + name "xmlFeatureKind" + value ("FeatureKind" 0)) + (object Attribute + tool "Ecore" + name "FeatureKind" + value (list Attribute_Set + (object Attribute + tool "Ecore" + name "Unspecified" + value 0) + (object Attribute + tool "Ecore" + name "Simple" + value 1) + (object Attribute + tool "Ecore" + name "Attribute" + value 2) + (object Attribute + tool "Ecore" + name "Element" + value 4))) + (object Attribute + tool "Ecore" + name "annotation" + value ""))) + (object Attribute + tool "DDL" + name "propertyId" + value "809135966") + (object Attribute + tool "DDL" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "DDL" + name "Directory" + value "AUTO GENERATE") + (object Attribute + tool "DDL" + name "DataBase" + value ("DataBaseSet" 800)) + (object Attribute + tool "DDL" + name "DataBaseSet" + value (list Attribute_Set + (object Attribute + tool "DDL" + name "ANSI" + value 800) + (object Attribute + tool "DDL" + name "Oracle" + value 801) + (object Attribute + tool "DDL" + name "SQLServer" + value 802) + (object Attribute + tool "DDL" + name "Sybase" + value 803) + (object Attribute + tool "DDL" + name "Watcom" + value 804))) + (object Attribute + tool "DDL" + name "PrimaryKeyColumnName" + value "Id") + (object Attribute + tool "DDL" + name "PrimaryKeyColumnType" + value "NUMBER(5)") + (object Attribute + tool "DDL" + name "ViewName" + value "V_") + (object Attribute + tool "DDL" + name "TableName" + value "T_") + (object Attribute + tool "DDL" + name "InheritSuffix" + value "_V") + (object Attribute + tool "DDL" + name "DropClause" + value FALSE) + (object Attribute + tool "DDL" + name "BaseViews" + value FALSE) + (object Attribute + tool "DDL" + name "DDLScriptFilename" + value "DDL1.SQL"))) + (object Attribute + tool "DDL" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "DDL" + name "ColumnType" + value "VARCHAR") + (object Attribute + tool "DDL" + name "Length" + value "") + (object Attribute + tool "DDL" + name "NullsOK" + value TRUE) + (object Attribute + tool "DDL" + name "PrimaryKey" + value FALSE) + (object Attribute + tool "DDL" + name "Unique" + value FALSE) + (object Attribute + tool "DDL" + name "CompositeUnique" + value FALSE) + (object Attribute + tool "DDL" + name "CheckConstraint" + value ""))) + (object Attribute + tool "DDL" + name "HiddenTool" + value FALSE) + (object Attribute + tool "framework" + name "HiddenTool" + value FALSE) + (object Attribute + tool "IDL" + name "propertyId" + value "809135966") + (object Attribute + tool "IDL" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "IDL" + name "StopOnError" + value TRUE) + (object Attribute + tool "IDL" + name "Directory" + value "AUTO GENERATE") + (object Attribute + tool "IDL" + name "GeneratePreserveRegions" + value TRUE))) + (object Attribute + tool "IDL" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "ImplementationType" + value "") + (object Attribute + tool "IDL" + name "ConstValue" + value "") + (object Attribute + tool "IDL" + name "GenerateDefaultSpecifier" + value FALSE) + (object Attribute + tool "IDL" + name "DefaultSpecifier" + value "") + (object Attribute + tool "IDL" + name "IDLElement" + value TRUE) + (object Attribute + tool "IDL" + name "IDLSpecificationType" + value ("IDLSpecSet" 22)) + (object Attribute + tool "IDL" + name "IDLSpecSet" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "Interface" + value 22) + (object Attribute + tool "IDL" + name "Typedef" + value 54) + (object Attribute + tool "IDL" + name "Enumeration" + value 8) + (object Attribute + tool "IDL" + name "Const" + value 71) + (object Attribute + tool "IDL" + name "Exception" + value 61) + (object Attribute + tool "IDL" + name "Struct" + value 51) + (object Attribute + tool "IDL" + name "Union" + value 81))))) + (object Attribute + tool "IDL" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "Generate" + value TRUE) + (object Attribute + tool "IDL" + name "CmIdentification" + value (value Text " %X% %Q% %Z% %W%")) + (object Attribute + tool "IDL" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "IDL" + name "FileName" + value "AUTO GENERATE") + (object Attribute + tool "IDL" + name "GenerateIDLModule" + value FALSE) + (object Attribute + tool "IDL" + name "InclusionProtectionSymbol" + value "AUTO GENERATE") + (object Attribute + tool "IDL" + name "AdditionalIncludes" + value (value Text "")) + (object Attribute + tool "IDL" + name "IncludeBySimpleName" + value FALSE))) + (object Attribute + tool "IDL" + name "default__Module-Body" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "CmIdentification" + value (value Text " %X% %Q% %Z% %W%")) + (object Attribute + tool "IDL" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "IDL" + name "FileName" + value "AUTO GENERATE") + (object Attribute + tool "IDL" + name "AdditionalIncludes" + value (value Text "")) + (object Attribute + tool "IDL" + name "IncludeBySimpleName" + value FALSE))) + (object Attribute + tool "IDL" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "OperationIsOneWay" + value FALSE) + (object Attribute + tool "IDL" + name "Context" + value "") + (object Attribute + tool "IDL" + name "Raises" + value ""))) + (object Attribute + tool "IDL" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "CaseSpecifier" + value "") + (object Attribute + tool "IDL" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "IDL" + name "DataMemberName" + value "$relationship") + (object Attribute + tool "IDL" + name "IsReadOnly" + value FALSE) + (object Attribute + tool "IDL" + name "IsConst" + value FALSE) + (object Attribute + tool "IDL" + name "ConstValue" + value ""))) + (object Attribute + tool "IDL" + name "default__Has" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "NameIfUnlabeled" + value "the_$supplier") + (object Attribute + tool "IDL" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "IDL" + name "DataMemberName" + value "$relationship") + (object Attribute + tool "IDL" + name "GenerateForwardReference" + value FALSE) + (object Attribute + tool "IDL" + name "IsReadOnly" + value FALSE) + (object Attribute + tool "IDL" + name "BoundedHasRelType" + value ("HasRelTypeSet" 47)) + (object Attribute + tool "IDL" + name "HasRelTypeSet" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "Array" + value 24) + (object Attribute + tool "IDL" + name "Sequence" + value 47))))) + (object Attribute + tool "IDL" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "NameIfUnlabeled" + value "the_$supplier") + (object Attribute + tool "IDL" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "IDL" + name "DataMemberName" + value "$relationship") + (object Attribute + tool "IDL" + name "GenerateForwardReference" + value FALSE) + (object Attribute + tool "IDL" + name "IsReadOnly" + value FALSE) + (object Attribute + tool "IDL" + name "BoundedRoleType" + value ("AssocTypeSet" 47)) + (object Attribute + tool "IDL" + name "AssocTypeSet" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "Array" + value 24) + (object Attribute + tool "IDL" + name "Sequence" + value 47))))) + (object Attribute + tool "IDL" + name "default__Uses" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "GenerateForwardReference" + value FALSE))) + (object Attribute + tool "IDL" + name "default__Subsystem" + value (list Attribute_Set + (object Attribute + tool "IDL" + name "Directory" + value "AUTO GENERATE"))) + (object Attribute + tool "IDL" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Java" + name "propertyId" + value "809135966") + (object Attribute + tool "Java" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "Java" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "Java" + name "StopOnError" + value FALSE) + (object Attribute + tool "Java" + name "Directory" + value "AUTO GENERATE") + (object Attribute + tool "Java" + name "UsePrefixes" + value FALSE) + (object Attribute + tool "Java" + name "InstanceVariablePrefix" + value "m_") + (object Attribute + tool "Java" + name "ClassVariablePrefix" + value "s_") + (object Attribute + tool "Java" + name "DefaultAttributeDataType" + value "int") + (object Attribute + tool "Java" + name "DefaultOperationReturnType" + value "void"))) + (object Attribute + tool "Java" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Final" + value FALSE) + (object Attribute + tool "Java" + name "GenerateDefaultConstructor" + value TRUE) + (object Attribute + tool "Java" + name "ConstructorIs" + value ("Ctor_Set" 62)) + (object Attribute + tool "Java" + name "Ctor_Set" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Public" + value 62) + (object Attribute + tool "Java" + name "Protected" + value 63) + (object Attribute + tool "Java" + name "Private" + value 64))) + (object Attribute + tool "Java" + name "GenerateFinalizer" + value FALSE) + (object Attribute + tool "Java" + name "GenerateStaticInitializer" + value FALSE) + (object Attribute + tool "Java" + name "GenerateInstanceInitializer" + value FALSE))) + (object Attribute + tool "Java" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Generate" + value TRUE) + (object Attribute + tool "Java" + name "CmIdentification" + value (value Text "")) + (object Attribute + tool "Java" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "Java" + name "AdditionalImports" + value (value Text "")))) + (object Attribute + tool "Java" + name "default__Module-Body" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Generate" + value TRUE) + (object Attribute + tool "Java" + name "CmIdentification" + value (value Text "")) + (object Attribute + tool "Java" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "Java" + name "AdditionalImports" + value (value Text "")))) + (object Attribute + tool "Java" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Java" + name "Abstract" + value FALSE) + (object Attribute + tool "Java" + name "Static" + value FALSE) + (object Attribute + tool "Java" + name "Final" + value FALSE) + (object Attribute + tool "Java" + name "Native" + value FALSE) + (object Attribute + tool "Java" + name "Synchronized" + value FALSE))) + (object Attribute + tool "Java" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Java" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "Java" + name "Final" + value FALSE) + (object Attribute + tool "Java" + name "Transient" + value FALSE) + (object Attribute + tool "Java" + name "Volatile" + value FALSE))) + (object Attribute + tool "Java" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Java" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "Java" + name "ContainerClass" + value "") + (object Attribute + tool "Java" + name "InitialValue" + value "") + (object Attribute + tool "Java" + name "Final" + value FALSE) + (object Attribute + tool "Java" + name "Transient" + value FALSE) + (object Attribute + tool "Java" + name "Volatile" + value FALSE))) + (object Attribute + tool "Java" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Oracle8" + name "propertyId" + value "360000002") + (object Attribute + tool "Oracle8" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "DDLScriptFilename" + value "DDL1.SQL") + (object Attribute + tool "Oracle8" + name "DropClause" + value FALSE) + (object Attribute + tool "Oracle8" + name "PrimaryKeyColumnName" + value "_ID") + (object Attribute + tool "Oracle8" + name "PrimaryKeyColumnType" + value "NUMBER(5,0)") + (object Attribute + tool "Oracle8" + name "SchemaNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "SchemaNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "TableNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "TableNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "TypeNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "TypeNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "ViewNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "ViewNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "VarrayNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "VarrayNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "NestedTableNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "NestedTableNameSuffix" + value "") + (object Attribute + tool "Oracle8" + name "ObjectTableNamePrefix" + value "") + (object Attribute + tool "Oracle8" + name "ObjectTableNameSuffix" + value ""))) + (object Attribute + tool "Oracle8" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "IsSchema" + value FALSE))) + (object Attribute + tool "Oracle8" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "OID" + value "") + (object Attribute + tool "Oracle8" + name "WhereClause" + value "") + (object Attribute + tool "Oracle8" + name "CheckConstraint" + value "") + (object Attribute + tool "Oracle8" + name "CollectionTypeLength" + value "") + (object Attribute + tool "Oracle8" + name "CollectionTypePrecision" + value "") + (object Attribute + tool "Oracle8" + name "CollectionTypeScale" + value "") + (object Attribute + tool "Oracle8" + name "CollectionOfREFS" + value FALSE))) + (object Attribute + tool "Oracle8" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "MethodKind" + value ("MethodKindSet" 1903)) + (object Attribute + tool "Oracle8" + name "OverloadID" + value "") + (object Attribute + tool "Oracle8" + name "OrderNumber" + value "") + (object Attribute + tool "Oracle8" + name "IsReadNoDataState" + value FALSE) + (object Attribute + tool "Oracle8" + name "IsReadNoProcessState" + value FALSE) + (object Attribute + tool "Oracle8" + name "IsWriteNoDataState" + value FALSE) + (object Attribute + tool "Oracle8" + name "IsWriteNoProcessState" + value FALSE) + (object Attribute + tool "Oracle8" + name "IsSelfish" + value FALSE) + (object Attribute + tool "Oracle8" + name "TriggerType" + value ("TriggerTypeSet" 1801)) + (object Attribute + tool "Oracle8" + name "TriggerEvent" + value ("TriggerEventSet" 1601)) + (object Attribute + tool "Oracle8" + name "TriggerText" + value "") + (object Attribute + tool "Oracle8" + name "TriggerReferencingNames" + value "") + (object Attribute + tool "Oracle8" + name "TriggerForEach" + value ("TriggerForEachSet" 1701)) + (object Attribute + tool "Oracle8" + name "TriggerWhenClause" + value "") + (object Attribute + tool "Oracle8" + name "MethodKindSet" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "MapMethod" + value 1901) + (object Attribute + tool "Oracle8" + name "OrderMethod" + value 1902) + (object Attribute + tool "Oracle8" + name "Function" + value 1903) + (object Attribute + tool "Oracle8" + name "Procedure" + value 1904) + (object Attribute + tool "Oracle8" + name "Operator" + value 1905) + (object Attribute + tool "Oracle8" + name "Constructor" + value 1906) + (object Attribute + tool "Oracle8" + name "Destructor" + value 1907) + (object Attribute + tool "Oracle8" + name "Trigger" + value 1908) + (object Attribute + tool "Oracle8" + name "Calculated" + value 1909))) + (object Attribute + tool "Oracle8" + name "TriggerTypeSet" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "AFTER" + value 1801) + (object Attribute + tool "Oracle8" + name "BEFORE" + value 1802) + (object Attribute + tool "Oracle8" + name "INSTEAD OF" + value 1803))) + (object Attribute + tool "Oracle8" + name "TriggerForEachSet" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "ROW" + value 1701) + (object Attribute + tool "Oracle8" + name "STATEMENT" + value 1702))) + (object Attribute + tool "Oracle8" + name "TriggerEventSet" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "INSERT" + value 1601) + (object Attribute + tool "Oracle8" + name "UPDATE" + value 1602) + (object Attribute + tool "Oracle8" + name "DELETE" + value 1603) + (object Attribute + tool "Oracle8" + name "INSERT OR UPDATE" + value 1604) + (object Attribute + tool "Oracle8" + name "INSERT OR DELETE" + value 1605) + (object Attribute + tool "Oracle8" + name "UPDATE OR DELETE" + value 1606) + (object Attribute + tool "Oracle8" + name "INSERT OR UPDATE OR DELETE" + value 1607))))) + (object Attribute + tool "Oracle8" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "OrderNumber" + value ""))) + (object Attribute + tool "Oracle8" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Oracle8" + name "OrderNumber" + value "") + (object Attribute + tool "Oracle8" + name "IsUnique" + value FALSE) + (object Attribute + tool "Oracle8" + name "NullsAllowed" + value TRUE) + (object Attribute + tool "Oracle8" + name "Length" + value "") + (object Attribute + tool "Oracle8" + name "Precision" + value "2") + (object Attribute + tool "Oracle8" + name "Scale" + value "6") + (object Attribute + tool "Oracle8" + name "IsIndex" + value FALSE) + (object Attribute + tool "Oracle8" + name "IsPrimaryKey" + value FALSE) + (object Attribute + tool "Oracle8" + name "CompositeUnique" + value FALSE) + (object Attribute + tool "Oracle8" + name "CheckConstraint" + value ""))) + (object Attribute + tool "Oracle8" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Repository" + name "HiddenTool" + value FALSE) + (object Attribute + tool "cg" + name "propertyId" + value "809135966") + (object Attribute + tool "cg" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "cg" + name "UseMSVC" + value FALSE) + (object Attribute + tool "cg" + name "HeaderFileExtension" + value "h") + (object Attribute + tool "cg" + name "HeaderFileBackupExtension" + value "h~") + (object Attribute + tool "cg" + name "HeaderFileTemporaryExtension" + value "h#") + (object Attribute + tool "cg" + name "CodeFileExtension" + value "cpp") + (object Attribute + tool "cg" + name "CodeFileBackupExtension" + value "cp~") + (object Attribute + tool "cg" + name "CodeFileTemporaryExtension" + value "cp#") + (object Attribute + tool "cg" + name "CreateMissingDirectories" + value TRUE) + (object Attribute + tool "cg" + name "StopOnError" + value FALSE) + (object Attribute + tool "cg" + name "ErrorLimit" + value 30) + (object Attribute + tool "cg" + name "Directory" + value "$ROSECPP_SOURCE") + (object Attribute + tool "cg" + name "PathSeparator" + value "") + (object Attribute + tool "cg" + name "FileNameFormat" + value "128vx_b") + (object Attribute + tool "cg" + name "BooleanType" + value "int") + (object Attribute + tool "cg" + name "AllowTemplates" + value TRUE) + (object Attribute + tool "cg" + name "AllowExplicitInstantiations" + value TRUE) + (object Attribute + tool "cg" + name "AllowProtectedInheritance" + value TRUE) + (object Attribute + tool "cg" + name "CommentWidth" + value 60) + (object Attribute + tool "cg" + name "OneByValueContainer" + value "$targetClass") + (object Attribute + tool "cg" + name "OneByReferenceContainer" + value "$targetClass *") + (object Attribute + tool "cg" + name "OptionalByValueContainer" + value "OptionalByValue<$targetClass>") + (object Attribute + tool "cg" + name "OptionalByReferenceContainer" + value "$targetClass *") + (object Attribute + tool "cg" + name "FixedByValueContainer" + value "$targetClass[$limit]") + (object Attribute + tool "cg" + name "UnorderedFixedByValueContainer" + value "$targetClass[$limit]") + (object Attribute + tool "cg" + name "FixedByReferenceContainer" + value "$targetClass *[$limit]") + (object Attribute + tool "cg" + name "UnorderedFixedByReferenceContainer" + value "$targetClass *[$limit]") + (object Attribute + tool "cg" + name "BoundedByValueContainer" + value "BoundedListByValue<$targetClass,$limit>") + (object Attribute + tool "cg" + name "UnorderedBoundedByValueContainer" + value "BoundedSetByValue<$targetClass,$limit>") + (object Attribute + tool "cg" + name "BoundedByReferenceContainer" + value "BoundedListByReference<$targetClass,$limit>") + (object Attribute + tool "cg" + name "UnorderedBoundedByReferenceContainer" + value "BoundedSetByReference<$targetClass,$limit>") + (object Attribute + tool "cg" + name "UnboundedByValueContainer" + value "UnboundedListByValue<$targetClass>") + (object Attribute + tool "cg" + name "UnorderedUnboundedByValueContainer" + value "UnboundedSetByValue<$targetClass>") + (object Attribute + tool "cg" + name "UnboundedByReferenceContainer" + value "UnboundedListByReference<$targetClass>") + (object Attribute + tool "cg" + name "UnorderedUnboundedByReferenceContainer" + value "UnboundedSetByReference<$targetClass>") + (object Attribute + tool "cg" + name "QualifiedByValueContainer" + value "AssociationByValue<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "UnorderedQualifiedByValueContainer" + value "DictionaryByValue<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "QualifiedByReferenceContainer" + value "AssociationByReference<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "UnorderedQualifiedByReferenceContainer" + value "DictionaryByReference<$qualtype, $qualcont>") + (object Attribute + tool "cg" + name "GeneratePreserveRegions" + value TRUE))) + (object Attribute + tool "cg" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "ImplementationType" + value "") + (object Attribute + tool "cg" + name "ClassKey" + value "class") + (object Attribute + tool "cg" + name "GenerateEmptyRegions" + value ("GenerateEmptyRegionSet" 3)) + (object Attribute + tool "cg" + name "GenerateEmptyRegionSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "None" + value 0) + (object Attribute + tool "cg" + name "Preserved" + value 1) + (object Attribute + tool "cg" + name "Unpreserved" + value 2) + (object Attribute + tool "cg" + name "All" + value 3))) + (object Attribute + tool "cg" + name "PutBodiesInSpec" + value FALSE) + (object Attribute + tool "cg" + name "GenerateDefaultConstructor" + value ("GenerateSet" 199)) + (object Attribute + tool "cg" + name "DefaultConstructorVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "InlineDefaultConstructor" + value FALSE) + (object Attribute + tool "cg" + name "ExplicitDefaultConstructor" + value FALSE) + (object Attribute + tool "cg" + name "GenerateCopyConstructor" + value ("GenerateSet" 199)) + (object Attribute + tool "cg" + name "CopyConstructorVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "InlineCopyConstructor" + value FALSE) + (object Attribute + tool "cg" + name "ExplicitCopyConstructor" + value FALSE) + (object Attribute + tool "cg" + name "GenerateDestructor" + value TRUE) + (object Attribute + tool "cg" + name "DestructorVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "DestructorKind" + value ("ThreeKindSet" 200)) + (object Attribute + tool "cg" + name "InlineDestructor" + value FALSE) + (object Attribute + tool "cg" + name "GenerateAssignmentOperation" + value ("GenerateSet" 199)) + (object Attribute + tool "cg" + name "AssignmentVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "AssignmentKind" + value ("ThreeKindSet" 200)) + (object Attribute + tool "cg" + name "InlineAssignmentOperation" + value FALSE) + (object Attribute + tool "cg" + name "GenerateEqualityOperations" + value ("GenerateSet" 199)) + (object Attribute + tool "cg" + name "EqualityVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "EqualityKind" + value ("FriendKindSet" 200)) + (object Attribute + tool "cg" + name "InlineEqualityOperations" + value FALSE) + (object Attribute + tool "cg" + name "GenerateRelationalOperations" + value FALSE) + (object Attribute + tool "cg" + name "RelationalVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "RelationalKind" + value ("FriendKindSet" 200)) + (object Attribute + tool "cg" + name "InlineRelationalOperations" + value FALSE) + (object Attribute + tool "cg" + name "GenerateStorageMgmtOperations" + value FALSE) + (object Attribute + tool "cg" + name "StorageMgmtVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "InlineStorageMgmtOperations" + value FALSE) + (object Attribute + tool "cg" + name "GenerateSubscriptOperation" + value FALSE) + (object Attribute + tool "cg" + name "SubscriptVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "SubscriptKind" + value ("ThreeKindSet" 200)) + (object Attribute + tool "cg" + name "SubscriptResultType" + value "") + (object Attribute + tool "cg" + name "InlineSubscriptOperation" + value FALSE) + (object Attribute + tool "cg" + name "GenerateDereferenceOperation" + value FALSE) + (object Attribute + tool "cg" + name "DereferenceVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "DereferenceKind" + value ("ThreeKindSet" 200)) + (object Attribute + tool "cg" + name "DereferenceResultType" + value "") + (object Attribute + tool "cg" + name "InlineDereferenceOperation" + value FALSE) + (object Attribute + tool "cg" + name "GenerateIndirectionOperation" + value FALSE) + (object Attribute + tool "cg" + name "IndirectionVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "IndirectionKind" + value ("ThreeKindSet" 200)) + (object Attribute + tool "cg" + name "IndirectionResultType" + value "") + (object Attribute + tool "cg" + name "InlineIndirectionOperation" + value FALSE) + (object Attribute + tool "cg" + name "GenerateStreamOperations" + value FALSE) + (object Attribute + tool "cg" + name "StreamVisibility" + value ("VisibilitySet" 45)) + (object Attribute + tool "cg" + name "InlineStreamOperations" + value FALSE) + (object Attribute + tool "cg" + name "ThreeKindSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202))) + (object Attribute + tool "cg" + name "KindSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Static" + value 203))) + (object Attribute + tool "cg" + name "FriendKindSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Friend" + value 204))) + (object Attribute + tool "cg" + name "GenerateSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "DeclareAndDefine" + value 199) + (object Attribute + tool "cg" + name "DeclareOnly" + value 205) + (object Attribute + tool "cg" + name "DoNotDeclare" + value 206))) + (object Attribute + tool "cg" + name "VisibilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Public" + value 45) + (object Attribute + tool "cg" + name "Protected" + value 44) + (object Attribute + tool "cg" + name "Private" + value 43) + (object Attribute + tool "cg" + name "Implementation" + value 14))) + (object Attribute + tool "cg" + name "ConstValue" + value "") + (object Attribute + tool "cg" + name "GenerateDefaultSpecifier" + value FALSE) + (object Attribute + tool "cg" + name "DefaultSpecifier" + value ""))) + (object Attribute + tool "cg" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Generate" + value TRUE) + (object Attribute + tool "cg" + name "GenerateEmptyRegions" + value ("GenerateEmptyRegionSet" 3)) + (object Attribute + tool "cg" + name "GenerateEmptyRegionSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "None" + value 0) + (object Attribute + tool "cg" + name "Preserved" + value 1) + (object Attribute + tool "cg" + name "Unpreserved" + value 2) + (object Attribute + tool "cg" + name "All" + value 3))) + (object Attribute + tool "cg" + name "CmIdentification" + value (value Text " %X% %Q% %Z% %W%")) + (object Attribute + tool "cg" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "cg" + name "FileName" + value "AUTO GENERATE") + (object Attribute + tool "cg" + name "AllowExtensionlessFileName" + value FALSE) + (object Attribute + tool "cg" + name "InclusionProtectionSymbol" + value "AUTO GENERATE") + (object Attribute + tool "cg" + name "IncludeFormat" + value (value Text +|// $package +|#include "$file" +| + )) + (object Attribute + tool "cg" + name "IncludeBySimpleName" + value FALSE) + (object Attribute + tool "cg" + name "IncludePrecompiledHeader" + value FALSE) + (object Attribute + tool "cg" + name "IncludeOrder" + value "AMIR") + (object Attribute + tool "cg" + name "AdditionalIncludes" + value (value Text "")) + (object Attribute + tool "cg" + name "InliningStyle" + value ("InliningStyleSet" 207)) + (object Attribute + tool "cg" + name "InliningStyleSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "InClassDeclaration" + value 208) + (object Attribute + tool "cg" + name "FollowingClassDeclaration" + value 207))) + (object Attribute + tool "cg" + name "TypesDefined" + value (value Text "")) + (object Attribute + tool "cg" + name "IncludeClosure" + value (value Text "")))) + (object Attribute + tool "cg" + name "default__Module-Body" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Generate" + value TRUE) + (object Attribute + tool "cg" + name "GenerateEmptyRegions" + value ("GenerateEmptyRegionSet" 3)) + (object Attribute + tool "cg" + name "GenerateEmptyRegionSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "None" + value 0) + (object Attribute + tool "cg" + name "Preserved" + value 1) + (object Attribute + tool "cg" + name "Unpreserved" + value 2) + (object Attribute + tool "cg" + name "All" + value 3))) + (object Attribute + tool "cg" + name "CmIdentification" + value (value Text " %X% %Q% %Z% %W%")) + (object Attribute + tool "cg" + name "CopyrightNotice" + value (value Text "")) + (object Attribute + tool "cg" + name "FileName" + value "AUTO GENERATE") + (object Attribute + tool "cg" + name "AllowExtensionlessFileName" + value FALSE) + (object Attribute + tool "cg" + name "IncludeFormat" + value (value Text +|// $package +|#include "$file" +| + )) + (object Attribute + tool "cg" + name "IncludeBySimpleName" + value FALSE) + (object Attribute + tool "cg" + name "IncludePrecompiledHeader" + value TRUE) + (object Attribute + tool "cg" + name "IncludeOrder" + value "AMIR") + (object Attribute + tool "cg" + name "AdditionalIncludes" + value (value Text "")) + (object Attribute + tool "cg" + name "InliningStyle" + value ("InliningStyleSet" 207)) + (object Attribute + tool "cg" + name "InliningStyleSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "InClassDeclaration" + value 208) + (object Attribute + tool "cg" + name "FollowingClassDeclaration" + value 207))) + (object Attribute + tool "cg" + name "TypesDefined" + value (value Text "")) + (object Attribute + tool "cg" + name "IncludeClosure" + value (value Text "")))) + (object Attribute + tool "cg" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "OperationKind" + value ("OperationKindSet" 200)) + (object Attribute + tool "cg" + name "OperationKindSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Static" + value 203) + (object Attribute + tool "cg" + name "Friend" + value 204))) + (object Attribute + tool "cg" + name "OperationIsConst" + value FALSE) + (object Attribute + tool "cg" + name "OperationIsExplicit" + value FALSE) + (object Attribute + tool "cg" + name "Inline" + value FALSE) + (object Attribute + tool "cg" + name "EntryCode" + value (value Text "")) + (object Attribute + tool "cg" + name "ExitCode" + value (value Text "")) + (object Attribute + tool "cg" + name "GenerateEmptyRegions" + value ("GenerateEmptyRegionSet" 3)) + (object Attribute + tool "cg" + name "GenerateEmptyRegionSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "None" + value 0) + (object Attribute + tool "cg" + name "Preserved" + value 1) + (object Attribute + tool "cg" + name "Unpreserved" + value 2) + (object Attribute + tool "cg" + name "All" + value 3))) + (object Attribute + tool "cg" + name "BodyAnnotations" + value "") + (object Attribute + tool "cg" + name "OperationIsOneWay" + value FALSE) + (object Attribute + tool "cg" + name "Context" + value "") + (object Attribute + tool "cg" + name "Raises" + value ""))) + (object Attribute + tool "cg" + name "default__Has" + value (list Attribute_Set + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "Ordered" + value TRUE) + (object Attribute + tool "cg" + name "NameIfUnlabeled" + value "the_$supplier") + (object Attribute + tool "cg" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "cg" + name "DataMemberName" + value "$relationship") + (object Attribute + tool "cg" + name "DataMemberVisibility" + value ("DataMemberVisibilitySet" 14)) + (object Attribute + tool "cg" + name "DataMemberVisibilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Public" + value 45) + (object Attribute + tool "cg" + name "Protected" + value 44) + (object Attribute + tool "cg" + name "Private" + value 43) + (object Attribute + tool "cg" + name "Implementation" + value 14) + (object Attribute + tool "cg" + name "AtRelationshipVisibility" + value 210))) + (object Attribute + tool "cg" + name "DataMemberMutability" + value ("DataMemberMutabilitySet" 0)) + (object Attribute + tool "cg" + name "DataMemberMutabilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Unrestricted" + value 0) + (object Attribute + tool "cg" + name "Mutable" + value 1) + (object Attribute + tool "cg" + name "Const" + value 2))) + (object Attribute + tool "cg" + name "DataMemberIsVolatile" + value FALSE) + (object Attribute + tool "cg" + name "DataMemberFieldSize" + value "") + (object Attribute + tool "cg" + name "InitialValue" + value (value Text "")) + (object Attribute + tool "cg" + name "GenerateGetOperation" + value TRUE) + (object Attribute + tool "cg" + name "GenerateSetOperation" + value TRUE) + (object Attribute + tool "cg" + name "GetName" + value "get_$relationship") + (object Attribute + tool "cg" + name "SetName" + value "set_$relationship") + (object Attribute + tool "cg" + name "GetSetKinds" + value ("GetSetKindsSet" 200)) + (object Attribute + tool "cg" + name "GetSetKindsSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Static" + value 203) + (object Attribute + tool "cg" + name "Friend" + value 204))) + (object Attribute + tool "cg" + name "ContainerClass" + value "") + (object Attribute + tool "cg" + name "SelectorName" + value "") + (object Attribute + tool "cg" + name "SelectorType" + value "") + (object Attribute + tool "cg" + name "GetIsConst" + value TRUE) + (object Attribute + tool "cg" + name "GetResultIsConst" + value ("GetResultIsConstSet" 2)) + (object Attribute + tool "cg" + name "GetResultIsConstSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "False" + value 0) + (object Attribute + tool "cg" + name "True" + value 1) + (object Attribute + tool "cg" + name "Same_As_Function" + value 2))) + (object Attribute + tool "cg" + name "GetSetByReference" + value FALSE) + (object Attribute + tool "cg" + name "InlineGet" + value TRUE) + (object Attribute + tool "cg" + name "SetReturnsValue" + value FALSE) + (object Attribute + tool "cg" + name "InlineSet" + value TRUE) + (object Attribute + tool "cg" + name "ForwardReferenceOnly" + value FALSE) + (object Attribute + tool "cg" + name "GenerateForwardReference" + value FALSE) + (object Attribute + tool "cg" + name "IsReadOnly" + value FALSE) + (object Attribute + tool "cg" + name "BoundedHasRelType" + value ("HasRelTypeSet" 47)) + (object Attribute + tool "cg" + name "HasRelTypeSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Array" + value 24) + (object Attribute + tool "cg" + name "Sequence" + value 47))))) + (object Attribute + tool "cg" + name "default__Association" + value (list Attribute_Set + (object Attribute + tool "cg" + name "NameIfUnlabeled" + value "the_$targetClass"))) + (object Attribute + tool "cg" + name "default__Inherit" + value (list Attribute_Set + (object Attribute + tool "cg" + name "InstanceArguments" + value ""))) + (object Attribute + tool "cg" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "ForwardReferenceOnly" + value FALSE) + (object Attribute + tool "cg" + name "NameIfUnlabeled" + value "the_$targetClass") + (object Attribute + tool "cg" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "cg" + name "DataMemberName" + value "$target") + (object Attribute + tool "cg" + name "DataMemberVisibility" + value ("DataMemberVisibilitySet" 14)) + (object Attribute + tool "cg" + name "DataMemberVisibilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Public" + value 45) + (object Attribute + tool "cg" + name "Protected" + value 44) + (object Attribute + tool "cg" + name "Private" + value 43) + (object Attribute + tool "cg" + name "Implementation" + value 14) + (object Attribute + tool "cg" + name "AtRelationshipVisibility" + value 210))) + (object Attribute + tool "cg" + name "DataMemberMutability" + value ("DataMemberMutabilitySet" 0)) + (object Attribute + tool "cg" + name "DataMemberMutabilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Unrestricted" + value 0) + (object Attribute + tool "cg" + name "Mutable" + value 1) + (object Attribute + tool "cg" + name "Const" + value 2))) + (object Attribute + tool "cg" + name "DataMemberIsVolatile" + value FALSE) + (object Attribute + tool "cg" + name "DataMemberFieldSize" + value "") + (object Attribute + tool "cg" + name "InitialValue" + value (value Text "")) + (object Attribute + tool "cg" + name "ContainerClass" + value "") + (object Attribute + tool "cg" + name "ContainerGet" + value "$data.get($keys)") + (object Attribute + tool "cg" + name "ContainerSet" + value "$data.set($keys,$value)") + (object Attribute + tool "cg" + name "QualifiedContainer" + value "") + (object Attribute + tool "cg" + name "AssocClassContainer" + value "$supplier *") + (object Attribute + tool "cg" + name "AssocClassInitialValue" + value (value Text "")) + (object Attribute + tool "cg" + name "GetSetKinds" + value ("GetSetKindsSet" 200)) + (object Attribute + tool "cg" + name "GetSetKindsSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Static" + value 203) + (object Attribute + tool "cg" + name "Friend" + value 204))) + (object Attribute + tool "cg" + name "GetSetByReference" + value FALSE) + (object Attribute + tool "cg" + name "GenerateGetOperation" + value TRUE) + (object Attribute + tool "cg" + name "GetName" + value "get_$target") + (object Attribute + tool "cg" + name "GetIsConst" + value TRUE) + (object Attribute + tool "cg" + name "GetResultIsConst" + value ("GetResultIsConstSet" 2)) + (object Attribute + tool "cg" + name "GetResultIsConstSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "False" + value 0) + (object Attribute + tool "cg" + name "True" + value 1) + (object Attribute + tool "cg" + name "Same_As_Function" + value 2))) + (object Attribute + tool "cg" + name "InlineGet" + value TRUE) + (object Attribute + tool "cg" + name "GenerateSetOperation" + value TRUE) + (object Attribute + tool "cg" + name "SetName" + value "set_$target") + (object Attribute + tool "cg" + name "SetReturnsValue" + value FALSE) + (object Attribute + tool "cg" + name "InlineSet" + value TRUE) + (object Attribute + tool "cg" + name "QualifiedGetSetByReference" + value ("QualifiedGetSetByReferenceSet" 2)) + (object Attribute + tool "cg" + name "QualifiedGetSetByReferenceSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "False" + value 0) + (object Attribute + tool "cg" + name "True" + value 1) + (object Attribute + tool "cg" + name "Same_As_GetSetByReference" + value 2))) + (object Attribute + tool "cg" + name "GenerateQualifiedGetOperation" + value TRUE) + (object Attribute + tool "cg" + name "QualifiedGetName" + value "get_$target") + (object Attribute + tool "cg" + name "QualifiedGetIsConst" + value TRUE) + (object Attribute + tool "cg" + name "QualifiedGetResultIsConst" + value ("GetResultIsConstSet" 2)) + (object Attribute + tool "cg" + name "InlineQualifiedGet" + value TRUE) + (object Attribute + tool "cg" + name "GenerateQualifiedSetOperation" + value TRUE) + (object Attribute + tool "cg" + name "QualifiedSetName" + value "set_$target") + (object Attribute + tool "cg" + name "QualifiedSetReturnsValue" + value FALSE) + (object Attribute + tool "cg" + name "InlineQualifiedSet" + value TRUE) + (object Attribute + tool "cg" + name "GenerateAssocClassDataMember" + value TRUE) + (object Attribute + tool "cg" + name "AssocClassDataMemberName" + value "$target") + (object Attribute + tool "cg" + name "AssocClassDataMemberVisibility" + value ("DataMemberVisibilitySet" 14)) + (object Attribute + tool "cg" + name "DataMemberVisibilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Public" + value 45) + (object Attribute + tool "cg" + name "Protected" + value 44) + (object Attribute + tool "cg" + name "Private" + value 43) + (object Attribute + tool "cg" + name "Implementation" + value 14) + (object Attribute + tool "cg" + name "AtRelationshipVisibility" + value 210))) + (object Attribute + tool "cg" + name "AssocClassDataMemberMutability" + value ("DataMemberMutabilitySet" 0)) + (object Attribute + tool "cg" + name "DataMemberMutabilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Unrestricted" + value 0) + (object Attribute + tool "cg" + name "Mutable" + value 1) + (object Attribute + tool "cg" + name "Const" + value 2))) + (object Attribute + tool "cg" + name "AssocClassDataMemberIsVolatile" + value FALSE) + (object Attribute + tool "cg" + name "AssocClassGetSetKinds" + value ("GetSetKindsSet" 200)) + (object Attribute + tool "cg" + name "GenerateAssocClassGetOperation" + value TRUE) + (object Attribute + tool "cg" + name "AssocClassGetName" + value "get_$target") + (object Attribute + tool "cg" + name "AssocClassGetIsConst" + value TRUE) + (object Attribute + tool "cg" + name "AssocClassGetResultIsConst" + value ("GetResultIsConstSet" 2)) + (object Attribute + tool "cg" + name "InlineAssocClassGet" + value TRUE) + (object Attribute + tool "cg" + name "GenerateAssocClassSetOperation" + value TRUE) + (object Attribute + tool "cg" + name "AssocClassSetName" + value "set_$target") + (object Attribute + tool "cg" + name "AssocClassSetReturnsValue" + value FALSE) + (object Attribute + tool "cg" + name "InlineAssocClassSet" + value TRUE) + (object Attribute + tool "cg" + name "AssocClassForwardReferenceOnly" + value TRUE) + (object Attribute + tool "cg" + name "GenerateForwardReference" + value FALSE) + (object Attribute + tool "cg" + name "IsReadOnly" + value FALSE) + (object Attribute + tool "cg" + name "BoundedRoleType" + value ("AssocTypeSet" 47)) + (object Attribute + tool "cg" + name "AssocTypeSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Array" + value 24) + (object Attribute + tool "cg" + name "Sequence" + value 47))))) + (object Attribute + tool "cg" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "cg" + name "DataMemberName" + value "$attribute") + (object Attribute + tool "cg" + name "DataMemberVisibility" + value ("DataMemberVisibilitySet" 14)) + (object Attribute + tool "cg" + name "DataMemberVisibilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Public" + value 45) + (object Attribute + tool "cg" + name "Protected" + value 44) + (object Attribute + tool "cg" + name "Private" + value 43) + (object Attribute + tool "cg" + name "Implementation" + value 14) + (object Attribute + tool "cg" + name "AtAttributeVisibility" + value 211))) + (object Attribute + tool "cg" + name "DataMemberMutability" + value ("DataMemberMutabilitySet" 0)) + (object Attribute + tool "cg" + name "DataMemberMutabilitySet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Unrestricted" + value 0) + (object Attribute + tool "cg" + name "Mutable" + value 1) + (object Attribute + tool "cg" + name "Const" + value 2))) + (object Attribute + tool "cg" + name "DataMemberIsVolatile" + value FALSE) + (object Attribute + tool "cg" + name "DataMemberFieldSize" + value "") + (object Attribute + tool "cg" + name "GenerateGetOperation" + value TRUE) + (object Attribute + tool "cg" + name "GenerateSetOperation" + value TRUE) + (object Attribute + tool "cg" + name "GetName" + value "get_$attribute") + (object Attribute + tool "cg" + name "SetName" + value "set_$attribute") + (object Attribute + tool "cg" + name "GetSetKinds" + value ("GetSetKindsSet" 200)) + (object Attribute + tool "cg" + name "GetSetKindsSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Common" + value 200) + (object Attribute + tool "cg" + name "Virtual" + value 201) + (object Attribute + tool "cg" + name "Abstract" + value 202) + (object Attribute + tool "cg" + name "Static" + value 203) + (object Attribute + tool "cg" + name "Friend" + value 204))) + (object Attribute + tool "cg" + name "GetIsConst" + value TRUE) + (object Attribute + tool "cg" + name "GetResultIsConst" + value ("GetResultIsConstSet" 2)) + (object Attribute + tool "cg" + name "GetResultIsConstSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "False" + value 0) + (object Attribute + tool "cg" + name "True" + value 1) + (object Attribute + tool "cg" + name "Same_As_Function" + value 2))) + (object Attribute + tool "cg" + name "GetSetByReference" + value FALSE) + (object Attribute + tool "cg" + name "InlineGet" + value TRUE) + (object Attribute + tool "cg" + name "SetReturnsValue" + value FALSE) + (object Attribute + tool "cg" + name "InlineSet" + value TRUE) + (object Attribute + tool "cg" + name "CaseSpecifier" + value "") + (object Attribute + tool "cg" + name "IsReadOnly" + value FALSE))) + (object Attribute + tool "cg" + name "default__Uses" + value (list Attribute_Set + (object Attribute + tool "cg" + name "ForwardReferenceOnly" + value FALSE) + (object Attribute + tool "cg" + name "BodyReferenceOnly" + value FALSE) + (object Attribute + tool "cg" + name "GenerateForwardReference" + value FALSE))) + (object Attribute + tool "cg" + name "default__Subsystem" + value (list Attribute_Set + (object Attribute + tool "cg" + name "Directory" + value "AUTO GENERATE") + (object Attribute + tool "cg" + name "DirectoryIsOnSearchList" + value FALSE) + (object Attribute + tool "cg" + name "PrecompiledHeader" + value ""))) + (object Attribute + tool "cg" + name "default__Category" + value (list Attribute_Set + (object Attribute + tool "cg" + name "IsNamespace" + value FALSE) + (object Attribute + tool "cg" + name "Indent" + value 2) + (object Attribute + tool "cg" + name "CodeName" + value "") + (object Attribute + tool "cg" + name "GenerateEmptyRegions" + value ("GenerateEmptyRegionSet" 3)) + (object Attribute + tool "cg" + name "GenerateEmptyRegionSet" + value (list Attribute_Set + (object Attribute + tool "cg" + name "None" + value 0) + (object Attribute + tool "cg" + name "Preserved" + value 1) + (object Attribute + tool "cg" + name "Unpreserved" + value 2) + (object Attribute + tool "cg" + name "All" + value 3))))) + (object Attribute + tool "MSVC" + name "propertyId" + value "809135966") + (object Attribute + tool "MSVC" + name "default__Project" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Version" + value "5.0"))) + (object Attribute + tool "MSVC" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Type" + value ("MSVCClassTypeSet" 0)) + (object Attribute + tool "MSVC" + name "MSVCClassTypeSet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Normal" + value 0) + (object Attribute + tool "MSVC" + name "Interface_Part" + value 1) + (object Attribute + tool "MSVC" + name "Connection_Part" + value 2) + (object Attribute + tool "MSVC" + name "Class_Factory" + value 3))) + (object Attribute + tool "MSVC" + name "CObjectFunctionality" + value ("CObjectFunctionalitySet" 0)) + (object Attribute + tool "MSVC" + name "CObjectFunctionalitySet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "None" + value 0) + (object Attribute + tool "MSVC" + name "Dynamic" + value 1) + (object Attribute + tool "MSVC" + name "Dyncreate" + value 2) + (object Attribute + tool "MSVC" + name "Serial" + value 3))) + (object Attribute + tool "MSVC" + name "GenerateOverrideGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "GenerateDataGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_DATA_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateFieldGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_FIELD_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateMessageGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "GenerateMessageMap" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_MSG_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "MESSAGE_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "OLEFactory" + value ("OLEFactorySet" 0)) + (object Attribute + tool "MSVC" + name "OLEFactorySet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "None" + value 0) + (object Attribute + tool "MSVC" + name "Built_in" + value 1) + (object Attribute + tool "MSVC" + name "Simple" + value 2) + (object Attribute + tool "MSVC" + name "Licensed" + value 3))) + (object Attribute + tool "MSVC" + name "OLEName" + value "") + (object Attribute + tool "MSVC" + name "OLEClassID" + value "") + (object Attribute + tool "MSVC" + name "GenerateOLECtlType" + value FALSE) + (object Attribute + tool "MSVC" + name "OLECtlType" + value "") + (object Attribute + tool "MSVC" + name "GenerateOLETypeLib" + value FALSE) + (object Attribute + tool "MSVC" + name "OLETypeLibID" + value "") + (object Attribute + tool "MSVC" + name "OLETypeLibMajor" + value "") + (object Attribute + tool "MSVC" + name "OLETypeLibMinor" + value "") + (object Attribute + tool "MSVC" + name "GeneratePropPageIDs" + value FALSE) + (object Attribute + tool "MSVC" + name "OLEPropPageIDs" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateDispatchMap" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "StockProperties" + value (value Text "")) + (object Attribute + tool "MSVC" + name "StockFunctions" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DispatchDefValue" + value "") + (object Attribute + tool "MSVC" + name "GenerateDispIdEnum" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_DISP_ID_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateInterfaceMap" + value FALSE) + (object Attribute + tool "MSVC" + name "INTERFACE_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "InitInterface" + value "") + (object Attribute + tool "MSVC" + name "GenerateEventMap" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_EVENT_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_EVENT_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "EVENT_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "StockEvents" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateEventSinkMap" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_EVENTSINK_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_EVENTSINK_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "EVENTSINK_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "PropNotifySinks" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateConnectionMap" + value FALSE) + (object Attribute + tool "MSVC" + name "CONNECTION_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "ConnectionPointIID" + value "") + (object Attribute + tool "MSVC" + name "InheritanceType" + value "") + (object Attribute + tool "MSVC" + name "DeclSpec" + value "") + (object Attribute + tool "MSVC" + name "OLECommands" + value (value Text "")) + (object Attribute + tool "MSVC" + name "MFCDeclares" + value (value Text "")) + (object Attribute + tool "MSVC" + name "MFCImplements" + value (value Text "")) + (object Attribute + tool "MSVC" + name "ATL_Declares" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateCOMMap" + value FALSE) + (object Attribute + tool "MSVC" + name "COM_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateConnectionPointMap" + value FALSE) + (object Attribute + tool "MSVC" + name "CONNECTION_POINT_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateMsgMap" + value FALSE) + (object Attribute + tool "MSVC" + name "MSG_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GeneratePropertyMap" + value FALSE) + (object Attribute + tool "MSVC" + name "PROPERTY_MAP_Entries" + value (value Text "")))) + (object Attribute + tool "MSVC" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Type" + value ("MSVCOperationTypeSet" 0)) + (object Attribute + tool "MSVC" + name "MSVCOperationTypeSet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Normal" + value 0) + (object Attribute + tool "MSVC" + name "Virtual_Override" + value 1) + (object Attribute + tool "MSVC" + name "Message_Handler" + value 2) + (object Attribute + tool "MSVC" + name "Dispatch_Handler" + value 3) + (object Attribute + tool "MSVC" + name "Event_Firing_Function" + value 4) + (object Attribute + tool "MSVC" + name "Event_Sink_Handler" + value 5) + (object Attribute + tool "MSVC" + name "Std_OLE_Method" + value 6) + (object Attribute + tool "MSVC" + name "Command_Parser" + value 7) + (object Attribute + tool "MSVC" + name "Property_Get_Function" + value 8) + (object Attribute + tool "MSVC" + name "Property_Set_Function" + value 9) + (object Attribute + tool "MSVC" + name "Property_Notify_Function" + value 10) + (object Attribute + tool "MSVC" + name "Macro_Generated_Function" + value 11))) + (object Attribute + tool "MSVC" + name "AFX_MSG_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "MESSAGE_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_EVENT_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "EVENT_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "AFX_EVENTSINK_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "EVENTSINK_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "CallType" + value "") + (object Attribute + tool "MSVC" + name "DeclSpec" + value "") + (object Attribute + tool "MSVC" + name "BodyImage" + value (value Text "")))) + (object Attribute + tool "MSVC" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Type" + value ("MSVCAttributeTypeSet" 0)) + (object Attribute + tool "MSVC" + name "MSVCAttributeTypeSet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Normal" + value 0) + (object Attribute + tool "MSVC" + name "Member_Property" + value 1) + (object Attribute + tool "MSVC" + name "Get_Set_Property" + value 2) + (object Attribute + tool "MSVC" + name "Dialog_Data" + value 3) + (object Attribute + tool "MSVC" + name "Field_Data" + value 4) + (object Attribute + tool "MSVC" + name "Stock_Property" + value 5))) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DeclSpec" + value "") + (object Attribute + tool "MSVC" + name "PointerBase" + value "") + (object Attribute + tool "MSVC" + name "CallType" + value "") + (object Attribute + tool "MSVC" + name "StockPropertyImplementation" + value ""))) + (object Attribute + tool "MSVC" + name "default__Has" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Type" + value ("MSVCAttributeTypeSet" 0)) + (object Attribute + tool "MSVC" + name "MSVCAttributeTypeSet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Normal" + value 0) + (object Attribute + tool "MSVC" + name "Member_Property" + value 1) + (object Attribute + tool "MSVC" + name "Get_Set_Property" + value 2) + (object Attribute + tool "MSVC" + name "Dialog_Data" + value 3) + (object Attribute + tool "MSVC" + name "Field_Data" + value 4) + (object Attribute + tool "MSVC" + name "Stock_Property" + value 5))) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DeclSpec" + value "") + (object Attribute + tool "MSVC" + name "PointerBase" + value "") + (object Attribute + tool "MSVC" + name "CallType" + value "") + (object Attribute + tool "MSVC" + name "StockPropertyImplementation" + value ""))) + (object Attribute + tool "MSVC" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Type" + value ("MSVCAttributeTypeSet" 0)) + (object Attribute + tool "MSVC" + name "MSVCAttributeTypeSet" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "Normal" + value 0) + (object Attribute + tool "MSVC" + name "Member_Property" + value 1) + (object Attribute + tool "MSVC" + name "Get_Set_Property" + value 2) + (object Attribute + tool "MSVC" + name "Dialog_Data" + value 3) + (object Attribute + tool "MSVC" + name "Field_Data" + value 4) + (object Attribute + tool "MSVC" + name "Stock_Property" + value 5))) + (object Attribute + tool "MSVC" + name "AFX_DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DISPATCH_MAP_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "DeclSpec" + value "") + (object Attribute + tool "MSVC" + name "PointerBase" + value "") + (object Attribute + tool "MSVC" + name "CallType" + value "") + (object Attribute + tool "MSVC" + name "StockPropertyImplementation" + value ""))) + (object Attribute + tool "MSVC" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "GenerateIncludesGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_INCLUDES_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateInsertLocation" + value FALSE))) + (object Attribute + tool "MSVC" + name "default__Module-Body" + value (list Attribute_Set + (object Attribute + tool "MSVC" + name "GenerateIncludesGroup" + value FALSE) + (object Attribute + tool "MSVC" + name "AFX_INCLUDES_Entries" + value (value Text "")) + (object Attribute + tool "MSVC" + name "GenerateInsertLocation" + value FALSE))) + (object Attribute + tool "cg" + name "HiddenTool" + value FALSE) + (object Attribute + tool "SCC" + name "HiddenTool" + value FALSE) + (object Attribute + tool "TypeLibImporter" + name "HiddenTool" + value FALSE) + (object Attribute + tool "Visual Basic" + name "propertyId" + value "783606378") + (object Attribute + tool "Visual Basic" + name "default__Class" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "CreatableSet" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "Private" + value 221) + (object Attribute + tool "Visual Basic" + name "PublicNotCreatable" + value 213) + (object Attribute + tool "Visual Basic" + name "SingleUse" + value 214) + (object Attribute + tool "Visual Basic" + name "GlobalSingleUse" + value 215) + (object Attribute + tool "Visual Basic" + name "MultiUse" + value 219) + (object Attribute + tool "Visual Basic" + name "GlobalMultiUse" + value 220))) + (object Attribute + tool "Visual Basic" + name "OptionBase" + value "0") + (object Attribute + tool "Visual Basic" + name "OptionExplicit" + value TRUE) + (object Attribute + tool "Visual Basic" + name "OptionCompare" + value ("CompareSet" 202)) + (object Attribute + tool "Visual Basic" + name "Creatable" + value ("CreatableSet" 221)) + (object Attribute + tool "Visual Basic" + name "GenerateInitialization" + value FALSE) + (object Attribute + tool "Visual Basic" + name "GenerateTermination" + value FALSE) + (object Attribute + tool "Visual Basic" + name "CollectionClass" + value "Collection") + (object Attribute + tool "Visual Basic" + name "CompareSet" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "None" + value 202) + (object Attribute + tool "Visual Basic" + name "Binary" + value 203) + (object Attribute + tool "Visual Basic" + name "Text" + value 204))))) + (object Attribute + tool "Visual Basic" + name "default__Operation" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "OperationName" + value "$operation") + (object Attribute + tool "Visual Basic" + name "LibraryName" + value "") + (object Attribute + tool "Visual Basic" + name "AliasName" + value "") + (object Attribute + tool "Visual Basic" + name "IsStatic" + value FALSE) + (object Attribute + tool "Visual Basic" + name "EntryCode" + value (value Text "")) + (object Attribute + tool "Visual Basic" + name "ExitCode" + value (value Text "")))) + (object Attribute + tool "Visual Basic" + name "default__Attribute" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "IsConst" + value FALSE) + (object Attribute + tool "Visual Basic" + name "New" + value FALSE) + (object Attribute + tool "Visual Basic" + name "WithEvents" + value FALSE) + (object Attribute + tool "Visual Basic" + name "Subscript" + value "") + (object Attribute + tool "Visual Basic" + name "NameIfUnlabeled" + value "the$supplier") + (object Attribute + tool "Visual Basic" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "Visual Basic" + name "DataMemberName" + value "$relationship") + (object Attribute + tool "Visual Basic" + name "GenerateGetOperation" + value FALSE) + (object Attribute + tool "Visual Basic" + name "GenerateSetOperation" + value FALSE) + (object Attribute + tool "Visual Basic" + name "GenerateLetOperation" + value FALSE))) + (object Attribute + tool "Visual Basic" + name "default__Role" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "New" + value FALSE) + (object Attribute + tool "Visual Basic" + name "WithEvents" + value FALSE) + (object Attribute + tool "Visual Basic" + name "Subscript" + value "") + (object Attribute + tool "Visual Basic" + name "NameIfUnlabeled" + value "the$supplier") + (object Attribute + tool "Visual Basic" + name "GenerateDataMember" + value TRUE) + (object Attribute + tool "Visual Basic" + name "DataMemberName" + value "$relationship") + (object Attribute + tool "Visual Basic" + name "GenerateGetOperation" + value FALSE) + (object Attribute + tool "Visual Basic" + name "GenerateSetOperation" + value FALSE) + (object Attribute + tool "Visual Basic" + name "GenerateLetOperation" + value FALSE))) + (object Attribute + tool "Visual Basic" + name "default__Inherit" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "ImplementsDelegation" + value TRUE))) + (object Attribute + tool "Visual Basic" + name "default__Module-Spec" + value (list Attribute_Set + (object Attribute + tool "Visual Basic" + name "ProjectFile" + value ""))) + (object Attribute + tool "Visual Basic" + name "HiddenTool" + value FALSE) + (object Attribute + tool "VisualStudio" + name "HiddenTool" + value FALSE)) + quid "4362A29901BD")) diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java new file mode 100644 index 0000000000..8099ddd38b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/BestPracticeTests.java @@ -0,0 +1,150 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import java.util.List; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; +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 { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); + Command read = commandGroup.getCommand("all companies"); + DataObject root = read.executeQuery(); + assertEquals(3, root.getList("COMPANY").size()); + + } + + //Read list of companies + public void testReadCompaniesWithDepartments() throws Exception { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); + Command read = commandGroup.getCommand("all companies and departments"); + DataObject root = read.executeQuery(); + DataObject firstCompany = root.getDataObject("COMPANY[1]"); + List departments = firstCompany.getList("departments"); + assertEquals(0, departments.size()); + + } + + public void testddDepartmentToFirstCompany() throws Exception { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); + Command read = commandGroup.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); + + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + apply.execute(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 { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); + Command select = commandGroup.getCommand("all companies and departments"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + // Create a new Company + DataObject company = root.createDataObject("COMPANY"); + company.setString("NAME", "Do-rite Pest Control"); + + // Create a new Department + //Do not set ID or CompanyID since these are generated + DataObject department = root.createDataObject("DEPARTMENT"); + department.setString("NAME", "Do-rite Pest Control"); + department.setString("LOCATION", "The boonies"); + department.setString("NUMBER", "101"); + + // Associate the new department with the new company + company.getList("departments").add(department); + + // Get apply command + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + apply.setConnection(getConnection()); + + // Flush changes + apply.execute(root); + + // Save the id + Integer id = (Integer) company.get("ID"); + + // Verify the change + + select = commandGroup.getCommand("company by id with departments"); + select.setParameterValue("ID", 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 { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); + + Command select = commandGroup.getCommand("company by id with departments"); + Integer idOfNoExistingCompany = new Integer(-1); + select.setParameterValue("ID", idOfNoExistingCompany); + DataObject root = select.executeQuery(); + + //Will fail if there is no property named "COMPANY" + assertEquals(0, root.getList("COMPANY").size()); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java new file mode 100644 index 0000000000..35def7e677 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CUDGeneration.java @@ -0,0 +1,124 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +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 { + + // Read customer with particular ID + Command select = Command.FACTORY + .createCommand("Select * from CUSTOMER where ID = 1"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + DataObject customer = (DataObject) root.get("CUSTOMER[1]"); + + // Modify customer + customer.set("LASTNAME", "Pavick"); + + // Build apply changes command + ApplyChangesCommand apply = Command.FACTORY + .createApplyChangesCommand(getConfig("basicCustomerMappingWithInvalidCUD.xml")); + apply.setConnection(getConnection()); + + // Flush changes + try { + apply.execute(root); + fail("Should fail with invalid SQL. Provided CUD not used!!"); + } catch (RuntimeException e) { + // Everything OK + } + + } + + public void testInsertCUDGeneration() throws Exception { + Command select = Command.FACTORY + .createCommand("Select * from CUSTOMER where ID = 1"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + DataObject customer = root.createDataObject("CUSTOMER"); + customer.setInt("ID", 720); + customer.set("LASTNAME", "foobar"); + customer.set("ADDRESS", "asdfasdf"); + + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection(getConnection()); + apply.execute(root); + + select = Command.FACTORY + .createCommand("select * from CUSTOMER where ID = 720"); + select.setConnection(getConnection()); + root = select.executeQuery(); + + assertEquals(1, root.getList("CUSTOMER").size()); + } + + public void testReadModifyApply() throws Exception { + + // Build the select command to read a specific customer and related + // orders + Command select = Command.FACTORY + .createCommand( + "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", + getConfig("1xM_mapping_no_cud.xml")); + + // Parameterize the command + select.setConnection(getConnection()); + select.setParameterValue("ID", 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"); + + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("1xM_mapping_no_cud.xml")); + apply.setConnection(getConnection()); + + // Flush changes + apply.execute(root); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java new file mode 100644 index 0000000000..dcadd27d2f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CommandGroupTests.java @@ -0,0 +1,165 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * This test + * + */ + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; +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; + +/** + * + * 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 { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomersOrdersConfig.xml")); + commandGroup.setConnection(getConnection()); + + Command read = commandGroup.getCommand("all customers"); + DataObject root = read.executeQuery(); + + assertEquals(5, root.getList("CUSTOMER").size()); + + } + + /** + * Read an order using parm marker + */ + public void testReadWithParmmarker() throws Exception { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml")); + + Command read = commandGroup.getCommand("order by id with ?"); + read.setParameterValue(1, new Integer(1)); + DataObject root = read.executeQuery(); + + assertEquals("recombobulator", root.getString("ANORDER[1]/PRODUCT")); + + } + + /** + * Specify connection properties in config + */ + public void testReadWithConnectionProperties() throws Exception { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml")); + + Command read = commandGroup.getCommand("all customers"); + DataObject root = read.executeQuery(); + + assertEquals(5, root.getList("CUSTOMER").size()); + + } + + /** + * Specify connection properties in config. Add explicit update command + */ + public void testUpdate() throws Exception { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustOrdersConnectionProps.xml")); + + Command read = commandGroup.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 = commandGroup.getCommand("update customer"); + update.setParameterValue("ID", 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 + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomersOrdersConfig.xml")); + commandGroup.setConnection(getConnection()); + + // Read all customers and remember the first one + Command read = commandGroup.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 = commandGroup.getCommand("customer and orders"); + custOrders.setParameterValue("ID", 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"); + ApplyChangesCommand flush = commandGroup.getApplyChangesCommand(); + flush.execute(root); + + // Verify + Command orderByID = commandGroup.getCommand("order by id"); + orderByID.setParameterValue("ID", orderId); + assertEquals("Defibrillator", root.getString("ANORDER[1]/PRODUCT")); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java new file mode 100644 index 0000000000..011f1791e9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompanyTests.java @@ -0,0 +1,105 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import org.apache.tuscany.das.rdb.Command; +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.DatagraphRoot; +import org.apache.tuscany.das.rdb.test.company.DepartmentType; +import org.apache.tuscany.das.rdb.test.company.EmployeeType; +import org.apache.tuscany.das.rdb.test.data.CompanyData; +import org.apache.tuscany.das.rdb.test.data.CompanyDeptData; +import org.apache.tuscany.das.rdb.test.data.DepEmpData; +import org.apache.tuscany.das.rdb.test.data.DepartmentData; +import org.apache.tuscany.das.rdb.test.data.EmployeeData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.TypeHelper; + +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 { + + // Build the select command + Command selectCommand = Command.FACTORY.createCommand("select COMPANY.NAME, " + + "EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, " + + "DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.NUMBER from COMPANY, DEPARTMENT, EMPLOYEE " + + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID", getConfig("companyMapping.xml")); + + // Parameterize the command + selectCommand.setConnection(getConnection()); + + // 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 { + + SDOUtil.registerStaticTypes(CompanyFactory.class); + // Build the select command + Command selectCommand = Command.FACTORY.createCommand("select COMPANY.NAME, " + + "EMPLOYEE.NAME, EMPLOYEE.SN, EMPLOYEE.MANAGER, " + + "DEPARTMENT.NAME, DEPARTMENT.LOCATION, DEPARTMENT.NUMBER from COMPANY, DEPARTMENT, EMPLOYEE " + + "where COMPANY.ID=DEPARTMENT.COMPANYID and DEPARTMENT.ID=EMPLOYEE.DEPARTMENTID", getConfig("companyMappingWithConverters.xml")); + + // Parameterize the command + selectCommand.setConnection(getConnection()); + selectCommand.setDataObjectModel(TypeHelper.INSTANCE.getType(DatagraphRoot.class)); + + // Get the graph + DatagraphRoot root = (DatagraphRoot) selectCommand.executeQuery(); + + + CompanyType company = (CompanyType) root.getCompanies().get(0); + + assertEquals("MegaCorp", company.getName()); + + // Get a department + DepartmentType department = (DepartmentType) company.getDepartments().get(0); + assertEquals("Advanced Technologies", department.getName()); + + EmployeeType employee = (EmployeeType) department.getEmployees().get(0); + + assertEquals("John Jones", employee.getName()); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java new file mode 100644 index 0000000000..7a3ae9b5ed --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CompoundKeyTests.java @@ -0,0 +1,100 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.Key; +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 { + + Command getOrderDetails = Command.FACTORY + .createCommand("Select * from ORDERDETAILS where ORDERID = :ORDERID AND PRODUCTID = :PRODUCTID"); + getOrderDetails.setConnection(getConnection()); + + getOrderDetails.setParameterValue("ORDERID", new Integer(1)); + getOrderDetails.setParameterValue("PRODUCTID", 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 { + + Command getOrderDetails = Command.FACTORY + .createCommand("Select * from ORDERDETAILS where ORDERID = 1 AND PRODUCTID = 1"); + getOrderDetails.setConnection(getConnection()); + 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 + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("OrdersOrderDetailsConfig.xml")); + apply.setConnection(getConnection()); + + // Write + apply.execute(root); + + // Verify + root = getOrderDetails.executeQuery(); + orderDetails = root.getDataObject("ORDERDETAILS[1]"); + assertEquals(0f, orderDetails.getFloat("PRICE"), 0.01); + + } + + public void testReadOrdersAndDetails2() throws Exception { + + Command read = Command.FACTORY + .createCommand("SELECT * FROM ANORDER LEFT JOIN ORDERDETAILS ON ANORDER.ID = ORDERDETAILS.ORDERID ORDER BY ANORDER.ID", getConfig("OrdersOrderDetailsConfig.xml")); + read.setConnection(getConnection()); + + DataObject root = read.executeQuery(); + + DataObject firstOrder = root.getDataObject("ANORDER[1]"); + assertEquals(1, firstOrder.getInt("ID")); + assertEquals(2, firstOrder.getList("ORDERDETAILS").size()); + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java new file mode 100644 index 0000000000..d0f94018cd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ConverterTests.java @@ -0,0 +1,114 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.ResultSetShape; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +/** + * Tests the Converter framwork + */ +public class ConverterTests extends DasTest { + + + protected void setUp() throws Exception { + super.setUp(); + new CustomerData(getAutoConnection()).refresh(); + } + + + protected void tearDown() throws Exception { + super.tearDown(); + } + + private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); + + private static Date kbday; + private static Date tbday; + + static { + try { + kbday = myformat.parse("1957.09.27"); + tbday = myformat.parse("1966.12.20"); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + + + /** + * This tests the use of an arbitrary converter. The column converted is a VARCAHAR. + * ResultSetShape is used to specify that the property will be a SDODataTypes.DATE. + * + * So this example uses a converter that transforms a string column into a date property + * and conversely, a date property back to a string for the underlying column. + * + * The converter returns 1957.09.27 if the column value is "Williams" and 1966.12.20 + * if the value is "Pavick" + * + * On write, the converter returns "Pavick" if the property value is 1966.12.20 + * and "Williams" if the property value is 1957.09.27 + * + */ + public void testArbitraryConverter() throws Exception { + + //Create and initialize command to read customers + Command read = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1", getConfig("CustomerConfigWithConverter.xml")); + read.setConnection(getConnection()); + + String[] columns = { "ID", "LASTNAME", "ADDRESS" }; + String[] tables = { "CUSTOMER", "CUSTOMER", "CUSTOMER" }; + Type[] types = { SDODataTypes.INTEGEROBJECT, SDODataTypes.DATE, SDODataTypes.STRING }; + ResultSetShape shape = new ResultSetShape(tables, columns, types); + read.setResultSetShape(shape); + + //Read + DataObject root = read.executeQuery(); + + //Verify + assertEquals(kbday, root.getDate("CUSTOMER[1]/LASTNAME")); + + //Modify + root.setDate("CUSTOMER[1]/LASTNAME", tbday); + + ApplyChangesCommand write = Command.FACTORY.createApplyChangesCommand(getConfig("CustomerConfigWithConverter.xml")); + write.setConnection(getConnection()); + write.execute(root); + + //Read + root = read.executeQuery(); + + //Verify + assertEquals(tbday, root.getDate("CUSTOMER[1]/LASTNAME")); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java new file mode 100644 index 0000000000..c7aa9cbb6d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CorrectedDefectTests.java @@ -0,0 +1,244 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * These tests attempt to duplicate customer reported errors and then to verify + * any necessary fix. + * + */ + +import java.util.Iterator; +import java.util.Random; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; +import org.apache.tuscany.das.rdb.SDODataTypes; +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 { + + // Read some customers and related orders + Command select = Command.FACTORY.createCommand( + "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID", + getConfig("CustomersOrdersConfig.xml")); + select.setConnection(getConnection()); + + 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 + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("CustomersOrdersConfig.xml")); + apply.setConnection(getConnection()); + + // Flush changes + apply.execute(root); + + // verify cust1 relationship updates + select = Command.FACTORY + .createCommand("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID",getConfig("CustomersOrdersConfig.xml")); + select.setConnection(getConnection()); + select.setParameterValue("ID", 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 (:serverid, :timestamp)"; + + Command insert = Command.FACTORY.createCommand(sql); + insert.setParameterValue("serverid", new Integer(316405209)); + insert.setParameterValue("timestamp", "2005-11-23 19:29:52.636"); + insert.setConnection(getConnection()); + insert.execute(); + + // Verify + Command select = Command.FACTORY.createCommand("Select * from conmgt.serverstatus"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + assertEquals(1, root.getList("SERVERSTATUS").size()); + + } + + public void testWASDefect330118() throws Exception { + + // Create the group and set common connection + CommandGroup commandGroup = CommandGroup.FACTORY + .createCommandGroup(getConfig("CustomersOrdersConfig.xml")); + commandGroup.setConnection(getConnection()); + + // Read all customers and add one + Command read = commandGroup.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(); + + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + apply.execute(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 { + + Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); + insert.setConnection(getConnection()); + insert.setParameterValue("ID", new Integer(10)); + insert.setParameterValue("LASTNAME", null); + insert.setParameterType("LASTNAME", SDODataTypes.STRING); + insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); + insert.execute(); + + // Verify + Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); + select.setConnection(getConnection()); + 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 { + + Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); + insert.setConnection(getConnection()); + insert.setParameterValue("ID", new Integer(10)); + // insert.setParameterValue("LASTNAME", null); + insert.setParameterValue("ADDRESS", "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 { + + Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); + insert.setConnection(getConnection()); + insert.setParameterValue("ID", new Integer(10)); + insert.setParameterValue("LASTNAME", ""); + insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); + insert.execute(); + + // Verify + Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); + select.setConnection(getConnection()); + 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 { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); + + // Read a specific company based on the known ID + Command readCust = commandGroup.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; + } + + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + apply.execute(root); + + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java new file mode 100644 index 0000000000..7a82558de6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/CrudWithChangeHistory.java @@ -0,0 +1,377 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * This provdes the simplest examples that make use of the change history. The assumptions are: + * + * Single type + * Change history utilized + * Dynamic DataObjects + * + * + */ + +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.data.OrderDetailsData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + +public class CrudWithChangeHistory + extends DasTest +{ + + protected void setUp() + throws Exception + { + super.setUp(); + new CustomerData( getAutoConnection() ).refresh(); + new OrderDetailsData( getAutoConnection() ).refresh(); + } + + protected void tearDown() + throws Exception + { + super.tearDown(); + } + + /** + * Read and modify a customer. + * Provide needed Create/Update/Delete statements programatically + */ + public void testReadModifyApply() + throws Exception + { + + //Read customer 1 + Command select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = 1" ); + select.setConnection( getConnection() ); + DataObject root = select.executeQuery(); + + DataObject customer = (DataObject) root.get( "CUSTOMER[1]" ); + + //Modify customer + customer.set( "LASTNAME", "Pavick" ); + + //Build apply changes command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection( getConnection() ); + + //Manually create and add update command + Command update = Command.FACTORY.createCommand( "update CUSTOMER set LASTNAME = :LASTNAME where ID = :ID" ); + update.addParameter( "LASTNAME", SDODataTypes.STRING ); + update.addParameter( "ID", SDODataTypes.INTEGER ); + apply.addUpdateCommand( customer.getType(), update ); + + //Flush changes + apply.execute( 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 + { + + //Read customer 1 + Command select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = 1" ); + select.setConnection( getConnection() ); + DataObject root = select.executeQuery(); + + DataObject customer = (DataObject) root.get( "CUSTOMER[1]" ); + + //Modify customer + customer.set( "LASTNAME", "Pavick" ); + + //Build apply changes command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerMappingWithCUD.xml")); + apply.setConnection( getConnection() ); + + //Flush changes + apply.execute( 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 + { + + //Read customer with particular ID + Command select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = 1" ); + select.setConnection( getConnection() ); + DataObject root = select.executeQuery(); + + DataObject customer = root.getDataObject( "CUSTOMER[1]" ); + + //Modify customer + customer.set( "LASTNAME", "Pavick" ); + + //Build apply changes command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection( getConnection() ); + + //Flush changes + apply.execute( 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 + { + + //Read customer with particular ID + Command select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = 1" ); + select.setConnection( getConnection() ); + DataObject root = select.executeQuery(); + + DataObject customer = (DataObject) root.get( "CUSTOMER[1]" ); + + //Modify customer + customer.set( "LASTNAME", "Pavick" ); + + //Build apply changes command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerMapping.xml")); + apply.setConnection( getConnection() ); + + //Flush changes + apply.execute( root ); + + //Verify the change + root = select.executeQuery(); + assertEquals( "Pavick", root.getDataObject( "CUSTOMER[1]" ).getString( "LASTNAME" ) ); + + } + + /** + * Test ability to handle multiple changes to the graph including Creates/Updates/Deletes + * Employs generated CUD + */ + public void testReadModifyDeleteInsertApply() + throws Exception + { + + //Read some customers + Command select = Command.FACTORY.createCommand( "Select * from CUSTOMER where LASTNAME = 'Williams'" ); + select.setConnection( getConnection() ); + 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 + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerMapping.xml")); + apply.setConnection( getConnection() ); + + //Flush changes + apply.execute( root ); + + //Verify deletes + select = Command.FACTORY.createCommand( "Select * from CUSTOMER where ID = :ID" ); + select.setConnection( getConnection() ); + select.setParameterValue( "ID", new Integer( cust2ID ) ); + root = select.executeQuery(); + assertTrue( root.getList( "CUSTOMER" ).isEmpty() ); + //reparameterize same command + select.setParameterValue( "ID", new Integer( cust3ID ) ); + root = select.executeQuery(); + assertTrue( root.getList( "CUSTOMER" ).isEmpty() ); + + //verify insert + select.setParameterValue( "ID", 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.setParameterValue( "ID", new Integer( cust1ID ) ); + root = select.executeQuery(); + assertEquals( "Pavick", root.getString( "CUSTOMER[1]/LASTNAME" ) ); + + } + + + public void testReadModifyApplyWithAssumedID() throws Exception { + + //Read customer with particular ID + Command select = Command.FACTORY + .createCommand("Select * from CUSTOMER"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + DataObject customer = root.getDataObject("CUSTOMER[1]"); + + //Modify customer + customer.set("LASTNAME", "Pavick"); + + DataObject customerForDelete = root.getDataObject("CUSTOMER[2]"); + String deletedLastName = customerForDelete.getString("LASTNAME"); + customerForDelete.delete(); + + DataObject newCustomer = root.createDataObject("CUSTOMER"); + newCustomer.set("LASTNAME", "NewCustomer"); + newCustomer.setInt("ID", 9000); + + //Build apply changes command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection(getConnection()); + + //Flush changes + apply.execute(root); + + //Verify the change + root = select.executeQuery(); + assertEquals("Pavick", getCustomerByLastName(root, "Pavick").getString("LASTNAME")); + assertEquals("NewCustomer", getCustomerByLastName(root, "NewCustomer").getString("LASTNAME")); + assertNull(getCustomerByLastName(root, deletedLastName)); + + } + + + public void testReadModifyApplyWithAssumedIDFailure() throws Exception { + + Command select = Command.FACTORY + .createCommand("Select * from ORDERDETAILS"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + DataObject od = root.getDataObject("ORDERDETAILS[1]"); + + //Modify customer + od.setInt("PRODUCTID", 72); + + //Build apply changes command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection(getConnection()); + + //Flush changes -- This should fail because Order Details does not have a column that + // we can assume to be an ID + try { + apply.execute(root); + } catch (RuntimeException ex) { + assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config")); + } + + } + + public void testReadModifyApplyWithAssumedIDFailure2() throws Exception { + + Command select = Command.FACTORY + .createCommand("Select * from ORDERDETAILS"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + DataObject od = root.getDataObject("ORDERDETAILS[1]"); + od.delete(); + + //Build apply changes command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection(getConnection()); + + //Flush changes -- This should fail because Order Details does not have a column that + // we can assume to be an ID + try { + apply.execute(root); + } catch (RuntimeException ex) { + assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config")); + } + + } + public void testReadModifyApplyWithAssumedIDFailure3() throws Exception { + + Command select = Command.FACTORY + .createCommand("Select * from ORDERDETAILS"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + DataObject od = root.createDataObject("ORDERDETAILS"); + + //Modify customer + od.setInt("PRODUCTID", 72); + od.setInt("ORDERID", 500); + + //Build apply changes command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection(getConnection()); + + //Flush changes -- This should fail because Order Details does not have a column that + // we can assume to be an ID + try { + apply.execute(root); + } catch (RuntimeException ex) { + assertTrue(ex.getMessage().contains("changed in the DataGraph but is not present in the Config")); + } + + } + private DataObject getCustomerByLastName(DataObject root, String name) { + Iterator i = root.getList("CUSTOMER").iterator(); + while ( i. hasNext()) { + DataObject obj = (DataObject)i.next(); + if (name.equals(obj.getString("LASTNAME"))) + return obj; + } + return null; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java new file mode 100644 index 0000000000..1a2516aa02 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/DefectTests.java @@ -0,0 +1,303 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * These tests attempt to duplicate customer reported errors and then to verify + * any necessary fix. + * + */ + +import java.util.Iterator; +import java.util.Random; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.test.data.CompanyData; +import org.apache.tuscany.das.rdb.test.data.CompanyDeptData; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.data.DepEmpData; +import org.apache.tuscany.das.rdb.test.data.DepartmentData; +import org.apache.tuscany.das.rdb.test.data.EmployeeData; +import org.apache.tuscany.das.rdb.test.data.OrderData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + +public class DefectTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new CustomerData(getAutoConnection()).refresh(); + new OrderData(getAutoConnection()).refresh(); + + new CompanyData(getAutoConnection()).refresh(); + new DepartmentData(getAutoConnection()).refresh(); + new EmployeeData(getAutoConnection()).refresh(); + new CompanyDeptData(getAutoConnection()).refresh(); + new DepEmpData(getAutoConnection()).refresh(); + + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Read a specific customer + */ + public void testDiltonsInsert() throws Exception { + + // String sql = "insert into conmgt.serverstatus (statusid, + // managedserverid, timestamp) values (316405209, 316405209, '2005-11-23 + // 19:29:52.636')"; + String sql = "insert into conmgt.serverstatus (managedserverid, timestamp) values (316405209, '2005-11-23 19:29:52.636')"; + + Command insert = Command.FACTORY.createCommand(sql); + insert.setConnection(getConnection()); + insert.execute(); + + // Verify + Command select = Command.FACTORY + .createCommand("Select * from conmgt.serverstatus where statusid = 316405209"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + assertEquals(1, root.getList("conmgt.serverstatus").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 (:serverid, :timestamp)"; + + Command insert = Command.FACTORY.createCommand(sql); + insert.setParameterValue("serverid", new Integer(316405209)); + insert.setParameterValue("timestamp", "2005-11-23 19:29:52.636"); + insert.setConnection(getConnection()); + insert.execute(); + + // Verify + Command select = Command.FACTORY.createCommand("Select * from conmgt.serverstatus"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + assertEquals(1, root.getList("SERVERSTATUS").size()); + + } + + public void testWASDefect330118() throws Exception { + + // Create the group and set common connection + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomersOrdersConfig.xml")); + commandGroup.setConnection(getConnection()); + + // Read all customers and add one + Command read = commandGroup.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(); + + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + apply.execute(root); + + // Verify + root = read.executeQuery(); + assertEquals(numCustomers, root.getList("CUSTOMER").size()); + + } + + /** + * 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 { + + Command insert = Command.FACTORY + .createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); + insert.setConnection(getConnection()); + insert.setParameterValue("ID", new Integer(10)); + insert.setParameterValue("LASTNAME", "Williams"); + insert.setParameterValue("ADDRESS", null); + insert.execute(); + + // Verify + Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + assertEquals(1, root.getList("CUSTOMER").size()); + assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); + + } + + /** + * Try a workaround using CommandGroup + */ + public void testYingChen12162005Workaraound() throws Exception { + + // Create the group and set common connection + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CustomerConfig.xml")); + commandGroup.setConnection(getConnection()); + + Command insert = commandGroup.getCommand("insert customer"); + insert.setParameterValue("ID", new Integer(10)); + insert.setParameterValue("LASTNAME", "Williams"); + insert.setParameterValue("ADDRESS", null); + insert.execute(); + + // Verify + Command select = commandGroup.getCommand("read customer 10"); + DataObject root = select.executeQuery(); + assertEquals(1, root.getList("CUSTOMER").size()); + assertEquals("5528 Wells Fargo Dr", root.get("CUSTOMER[1]/ADDRESS")); + + } + + + + + /** + * Should be able to explicitly set a parameter to null. But, should require + * that the parameter type is set. + */ + public void testDiltonsNullParameterBug1() throws Exception { + + Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); + insert.setConnection(getConnection()); + insert.setParameterValue("ID", new Integer(10)); + insert.setParameterValue("LASTNAME", null); + insert.setParameterType("LASTNAME", SDODataTypes.STRING); + insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); + insert.execute(); + + //Verify + Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); + select.setConnection(getConnection()); + 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 { + + Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); + insert.setConnection(getConnection()); + insert.setParameterValue("ID", new Integer(10)); +// insert.setParameterValue("LASTNAME", null); + insert.setParameterValue("ADDRESS", "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 { + + Command insert = Command.FACTORY.createCommand("insert into CUSTOMER values (:ID, :LASTNAME, :ADDRESS)"); + insert.setConnection(getConnection()); + insert.setParameterValue("ID", new Integer(10)); + insert.setParameterValue("LASTNAME", ""); + insert.setParameterValue("ADDRESS", "5528 Wells Fargo Dr"); + insert.execute(); + + //Verify + Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 10"); + select.setConnection(getConnection()); + 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 { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); + + //Read a specific company based on the known ID + Command readCust = commandGroup.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; + } + + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + apply.execute(root); + + } + + + + /** + * Test problem with Random + */ + public void testRandomNumber() throws Exception { + + Random generator = new Random(); + int number = generator.nextInt(1000) + 1; + assertTrue(number > 0 & number <= 1000); + + } + + + public void testTablePropertyName() throws Exception { + + } + + + + + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java new file mode 100644 index 0000000000..d52a34c265 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ExceptionTests.java @@ -0,0 +1,149 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; +import org.apache.tuscany.das.rdb.ConfigHelper; +import org.apache.tuscany.das.rdb.test.company.CompanyFactory; +import org.apache.tuscany.das.rdb.test.customer.DataGraphRoot; +import org.apache.tuscany.das.rdb.test.data.BookData; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.data.OrderData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.TypeHelper; + +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(); + + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + public void testMissingConnection() throws Exception { + Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); + try { + readCustomers.executeQuery(); + fail("RuntimeException should be thrown"); + } catch (RuntimeException ex) { + assertEquals("A DASConnection object must be specified before executing the query.", ex.getMessage()); + } + + } + + public void testMissingMapping() throws Exception { + Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); + readCustomers.setConnection(getConnection()); + SDOUtil.registerStaticTypes(CompanyFactory.class); + readCustomers.setDataObjectModel(TypeHelper.INSTANCE.getType(DataGraphRoot.class)); + + 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 { + Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1", getConfig("NonExistingFile.xml")); + fail("Error should be thrown"); + } catch (Error 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 { + CommandGroup.FACTORY.createCommandGroup(getConfig("NonExistingFile.xml")); + fail("Error should be thrown"); + } catch (Error e) { + assertEquals( + "Cannot load configuration from a null InputStream. Possibly caused by an incorrect config xml file name", + e.getMessage()); + } + } + + + /** + * Test nice error message when Conofig does not use Aliased name + * Alis is defined for BOOK -> Book but PK config uses BOOK.BOOK_ID + * + * In this test case, the create is silently never performed!!! + * + * TODO - Uncomment out + */ + public void test_4() throws Exception { + + String statement = "SELECT * FROM BOOK WHERE BOOK.BOOK_ID = :ID"; + + // Create Table config programmatically + ConfigHelper helper = new ConfigHelper(); + helper.addTable("BOOK", "Book"); + helper.addPrimaryKey("BOOK.BOOK_ID"); + + Command select = Command.FACTORY.createCommand(statement, helper.getConfig()); + select.setConnection(getConnection()); + select.setParameterValue("ID", 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); + + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig()); + apply.setConnection(getConnection()); + apply.execute(root); + + //Verify + select.setParameterValue("ID", new Integer(1001)); + root = select.executeQuery(); + //TODO - Uncomment to test TUSCANY-250 +// assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/NAME")); + + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java new file mode 100644 index 0000000000..3cc6b823c0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedCommandTests.java @@ -0,0 +1,93 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.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.customer.DataGraphRoot; +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.setParameterValue("LASTNAME", "Williams"); + + DataObject root = cmd.executeQuery(); + assertEquals(4, root.getList("CUSTOMER").size()); + + } + + public void testReadCustomersStaticTypes() throws Exception { + ReadCustomersStaticTypesCommand cmd = new ReadCustomersStaticTypesCommand(); + cmd.setConnection(getConnection()); + cmd.setParameterValue("LASTNAME", "Williams"); + + DataGraphRoot root = (DataGraphRoot) cmd.executeQuery(); + + List customers = root.getCustomers(); + assertEquals(4, customers.size()); + + Customer cust1 = (Customer) customers.get(0); + assertEquals("Williams", cust1.getLastName()); + + } + + public void testSimpleReadCustomersWithShape() throws Exception { + SimpleReadCustomersWithShapeCommand cmd = new SimpleReadCustomersWithShapeCommand(); + cmd.setConnection(getConnection()); + DataObject root = cmd.executeQuery(); + assertEquals(5, root.getList("CUSTOMER").size()); + } + + public void testReadCustomersOrdersWithShape() throws Exception { + ReadCustomersWithShapeCommand cmd = new ReadCustomersWithShapeCommand(); + cmd.setConnection(getConnection()); + + DataObject root = cmd.executeQuery(); + assertEquals(5, root.getList("CUSTOMER").size()); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java new file mode 100644 index 0000000000..28b9a2f1d8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GeneratedId.java @@ -0,0 +1,294 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * Generated IDs + * + * + */ + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +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 { + + Command insert = Command.FACTORY.createCommand("insert into COMPANY (NAME) values (:NAME)"); + insert.setConnection(getConnection()); + insert.setParameterValue("NAME", "AAA Rental"); + insert.execute(); + + // Verify insert + // Verify + Command select = Command.FACTORY.createCommand("Select ID, NAME from COMPANY"); + select.setConnection(getConnection()); + 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 { + + Command insert = Command.FACTORY.createCommand("insert into COMPANY (NAME) values (:NAME)"); + insert.setConnection(getConnection()); + insert.setParameterValue("NAME", "AAA Rental"); + insert.execute(); + + // insert another using same command + insert.setParameterValue("NAME", "BBB Rental"); + insert.execute(); + + // Verify insert + // Verify + Command select = Command.FACTORY.createCommand("Select ID, NAME from COMPANY"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + assertEquals(5, root.getList("COMPANY").size()); + + } + + // Test ability to retrieve and utilize the generated key + public void testInsert3() throws Exception { + + Command insert = Command.FACTORY.createCommand("insert into COMPANY (NAME) values (:NAME)"); + insert.setConnection(getConnection()); + insert.setParameterValue("NAME", "AAA Rental"); + insert.execute(); + Integer key = (Integer) insert.getParameterValue("generated_key"); + + // Verify insert + Command select = Command.FACTORY.createCommand("Select ID, NAME from COMPANY where ID = :ID"); + select.setConnection(getConnection()); + select.setParameterValue("ID", key); + DataObject root = select.executeQuery(); + assertEquals(key, root.get("COMPANY[1]/ID")); + + } + + // Test ability to propogate generated values back to owning data objects + public void testPropagateIds() throws Exception { + + Command select = Command.FACTORY.createCommand("Select * from COMPANY"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + // Create a new Company + DataObject company = root.createDataObject("COMPANY"); + company.setString("NAME", "Do-rite Pest Control"); + + // Create apply command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("CompanyConfig.xml")); + apply.setConnection(getConnection()); + + // verify pre-condition (id is not there until after flush) + assertNull(company.get("ID")); + + // Flush changes + apply.execute(root); + + // Save the id + Integer id = (Integer) company.get("ID"); + + // Verify the change + select = Command.FACTORY.createCommand("Select * from COMPANY where ID = :ID"); + select.setConnection(getConnection()); + select.setParameterValue("ID", 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 { + + Command select = Command.FACTORY.createCommand("Select * from COMPANY", + getConfig("basicCompanyMapping.xml")); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + // Create a new Company + DataObject company = root.createDataObject("COMPANY"); + company.setString("NAME", "Do-rite Pest Control"); + + // Create apply command + ApplyChangesCommand apply = Command.FACTORY + .createApplyChangesCommand(getConfig("basicCompanyMapping.xml")); + apply.setConnection(getConnection()); + + // verify pre-condition (id is not there until after flush) + assertNull(company.get("ID")); + + // Flush changes + apply.execute(root); + + // Save the id + Integer id = (Integer) company.get("ID"); + + // Verify the change + select = Command.FACTORY.createCommand("Select * from COMPANY where ID = :ID"); + select.setConnection(getConnection()); + select.setParameterValue("ID", 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 { + + String selectCompanys = "SELECT * FROM COMPANY LEFT JOIN DEPARTMENT ON COMPANY.ID = DEPARTMENT.COMPANYID"; + + Command select = Command.FACTORY.createCommand(selectCompanys, + getConfig("basicCompanyDepartmentMapping.xml")); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + // Create a new Company + DataObject company = root.createDataObject("COMPANY"); + company.setString("NAME", "Do-rite Pest Control"); + + // Create a new Department + // Do not set ID or CompanyID since these are generated + // ID INT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), + // COMPANYID INT, EOTM INT + DataObject department = root.createDataObject("DEPARTMENT"); + department.setString("NAME", "Do-rite Pest Control"); + department.setString("LOCATION", "The boonies"); + department.setString("NUMBER", "101"); + + // Associate the new department with the new company + company.getList("departments").add(department); + + // Create apply command + ApplyChangesCommand apply = Command.FACTORY + .createApplyChangesCommand(getConfig("basicCompanyDepartmentMapping.xml")); + apply.setConnection(getConnection()); + + // Flush changes + apply.execute(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 = :ID"; + + select = Command.FACTORY.createCommand(selectString); + select.setConnection(getConnection()); + select.setParameterValue("ID", 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"; + + Command select = Command.FACTORY.createCommand(selectCompanys, + getConfig("basicCompanyDepartmentMapping.xml")); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + // Create a new Company + DataObject company = root.createDataObject("COMPANY"); + company.setString("NAME", "Do-rite Pest Control"); + + // Create a new Department + // Do not set ID or CompanyID since these are generated + // ID INT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), + // COMPANYID INT, EOTM INT + DataObject department = root.createDataObject("DEPARTMENT"); + department.setString("NAME", "Do-rite Pest Control"); + // Do not set this property to force storing NULL to DB + // department.setString("LOCATION", "The boonies"); + department.setString("NUMBER", "101"); + + // Associate the new department with the new company + company.getList("departments").add(department); + + // Create apply command + ApplyChangesCommand apply = Command.FACTORY + .createApplyChangesCommand(getConfig("basicCompanyDepartmentMapping.xml")); + apply.setConnection(getConnection()); + + // Flush changes + apply.execute(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 = :ID"; + + select = Command.FACTORY.createCommand(selectString); + select.setConnection(getConnection()); + select.setParameterValue("ID", 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 { + + Command select = Command.FACTORY.createCommand("Select * from COMPANY"); + select.setConnection(getConnection()); + select.executeQuery(); + + try { + select.getParameterValue("generated_id"); + fail("Should throw Error"); + } catch (RuntimeException e) { + // OK + } + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java new file mode 100644 index 0000000000..1c8faf802f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/GraphMergeTests.java @@ -0,0 +1,154 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import java.util.ArrayList; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.merge.impl.GraphMerger; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.data.OrderData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + + +import commonj.sdo.DataObject; + +public class GraphMergeTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + + new CustomerData(getAutoConnection()).refresh(); + new OrderData(getAutoConnection()).refresh(); + + } + + + public void testSingleTableMerge() throws Exception { + + Command select = Command.FACTORY + .createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where ID <= :ID"); + select.setConnection(getConnection()); + select.setParameterValue("ID", "3"); + DataObject graph1 = select.executeQuery(); + assertEquals(3, graph1.getList("CUSTOMER").size()); + + select.setParameterValue("ID", "5"); + DataObject graph2 = select.executeQuery(); + assertEquals(5, graph2.getList("CUSTOMER").size()); + + GraphMerger merger = new GraphMerger(); + merger.addPrimaryKey("CUSTOMER.ID"); + DataObject mergedGraph = merger.merge(graph1, graph2); + + assertEquals(5, mergedGraph.getList("CUSTOMER").size()); + } + + public void testSingleTableMergeThreeGraphs() throws Exception { + + Command select = Command.FACTORY + .createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where ID <= :ID"); + select.setConnection(getConnection()); + select.setParameterValue("ID", "3"); + DataObject graph1 = select.executeQuery(); + assertEquals(3, graph1.getList("CUSTOMER").size()); + + select.setParameterValue("ID", "4"); + DataObject graph2 = select.executeQuery(); + assertEquals(4, graph2.getList("CUSTOMER").size()); + + select.setParameterValue("ID", "5"); + DataObject graph3 = select.executeQuery(); + assertEquals(5, graph3.getList("CUSTOMER").size()); + + GraphMerger merger = new GraphMerger(); + merger.addPrimaryKey("CUSTOMER.ID"); + ArrayList graphs = new ArrayList(); + graphs.add(graph1); + graphs.add(graph2); + graphs.add(graph3); + DataObject mergedGraph = merger.merge(graphs); + + assertEquals(5, mergedGraph.getList("CUSTOMER").size()); + + } + + + public void testMultiTableMerge2() throws Exception { + //Read some customers and related orders + Command select = Command.FACTORY.createCommand( + "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", getConfig("CustomersOrdersConfig.xml")); + select.setConnection(getConnection()); + + select.setConnection(getConnection()); + select.setParameterValue("ID", new Integer(1)); + DataObject graph1 = select.executeQuery(); + + DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0); + assertEquals(2, customer.getList("orders").size()); + + select.setParameterValue("ID", new Integer(2)); + DataObject graph2 = select.executeQuery(); + DataObject customer2 = (DataObject)graph2.getList("CUSTOMER").get(0); + assertEquals(1, graph2.getList("CUSTOMER").size()); + assertEquals(1, customer2.getList("orders").size()); + assertEquals(2, customer2.getInt("ID")); + + GraphMerger merger = new GraphMerger(); + merger.addPrimaryKey("CUSTOMER.ID"); + merger.addPrimaryKey("ANORDER.ID"); + DataObject mergedGraph = merger.merge(graph1, graph2); + + assertEquals(3, mergedGraph.getList("ANORDER").size()); + assertEquals(2, mergedGraph.getList("CUSTOMER").size()); + + DataObject mergedCustomer = (DataObject) mergedGraph.getList("CUSTOMER").get(1); + assertEquals(2, mergedCustomer.getInt("ID")); + assertEquals(1, mergedCustomer.getList("orders").size()); + DataObject mergedOrder = (DataObject) mergedCustomer.getList("orders").get(0); + assertEquals(4, mergedOrder.getInt("ID")); + + } + + public void testMultiTableAppendSingleTable2() throws Exception { + //Read some customers and related orders + Command select = Command.FACTORY.createCommand( + "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", getConfig("CustomersOrdersConfig.xml")); + select.setConnection(getConnection()); + + select.setConnection(getConnection()); + select.setParameterValue("ID", new Integer(1)); + DataObject graph1 = select.executeQuery(); + + DataObject customer = (DataObject)graph1.getList("CUSTOMER").get(0); + assertEquals(2, customer.getList("orders").size()); + + Command select2 = Command.FACTORY.createCommand("select * from ANORDER"); + select2.setConnection(getConnection()); + DataObject graph2 = select2.executeQuery(); + assertEquals(4, graph2.getList("ANORDER").size()); + + GraphMerger merger = new GraphMerger(); + merger.addPrimaryKey("CUSTOMER.ID"); + merger.addPrimaryKey("ANORDER.ID"); + DataObject mergedGraph = merger.merge(graph1, graph2); + assertEquals(4, mergedGraph.getList("ANORDER").size()); + assertEquals(1, mergedGraph.getList("CUSTOMER").size()); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java new file mode 100644 index 0000000000..7b127e5768 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/NameMappingTests.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * + * + */ + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.data.OrderData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + + +public class NameMappingTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + + new CustomerData(getAutoConnection()).refresh(); + new OrderData(getAutoConnection()).refresh(); + + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Test ability to assign DataObject type and propertyaliases with xml file + */ + public void testRead() throws Exception { + + // Read a customer + Command select = Command.FACTORY.createCommand( + "SELECT * FROM CUSTOMER WHERE CUSTOMER.ID = 1", getConfig("customerMapping.xml")); + select.setConnection(getConnection()); + + DataObject root = select.executeQuery(); + DataObject customer = root.getDataObject("Customer[1]"); + assertEquals(1, customer.getInt("id")); + assertEquals("1212 foobar lane", customer.getString("address")); + assertEquals("Williams", customer.getString("lastname")); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java new file mode 100644 index 0000000000..450e78ded2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OCCTests.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.test.data.BookData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + + +import commonj.sdo.DataObject; + +public class OCCTests extends DasTest { + protected void setUp() throws Exception { + super.setUp(); + + new BookData(getAutoConnection()).refresh(); + } + + + public void testSimpleOCC() throws Exception { + + //Read a book instance + Command select = Command.FACTORY.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1"); + select.setConnection(getConnection()); + 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 = Command.FACTORY + .createCommand("update BOOK set OCC = :OCC where BOOK_ID = 1"); + update.setConnection(getConnection()); + update.setParameterValue("OCC", new Integer(100)); + update.execute(); + + //Try to flush the change + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("BooksConfig.xml")); + apply.setConnection(getConnection()); + + try { + apply.execute(root); + fail("An OCCException should be thrown"); + } catch (RuntimeException ex) { + if ( !ex.getMessage().equals("OCC Exception") ) + throw ex; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java new file mode 100644 index 0000000000..050671e077 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OneToOneRelationshipTests.java @@ -0,0 +1,155 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; +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 { + + CommandGroup commandGroup = CommandGroup.FACTORY + .createCommandGroup(getConfig("CompanyEmployeeConfig.xml")); + + Command read = commandGroup.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 { + + CommandGroup commandGroup = CommandGroup.FACTORY + .createCommandGroup(getConfig("CompanyEmployeeConfig.xml")); + + Command read = commandGroup.getCommand("get named employee with company"); + read.setParameterValue("NAME", "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 { + + CommandGroup commandGroup = CommandGroup.FACTORY + .createCommandGroup(getConfig("CompanyEmployeeConfig.xml")); + + Command read = commandGroup.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 + commandGroup.getApplyChangesCommand().execute(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 { + + CommandGroup commandGroup = CommandGroup.FACTORY + .createCommandGroup(getConfig("CompanyEmployeeConfig.xml")); + + Command read = commandGroup.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 + commandGroup.getApplyChangesCommand().execute(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 { + + CommandGroup commandGroup = CommandGroup.FACTORY + .createCommandGroup(getConfig("CompanyEmployeeConfig.xml")); + + Command read = commandGroup.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 + commandGroup.getApplyChangesCommand().execute(root); + + //Verify + root = read.executeQuery(); + company = root.getDataObject("COMPANY[1]"); + + employee = root.getDataObject("COMPANY[1]/company->employee_opposite"); + + assertEquals("Joe Hotshot", employee.getString("NAME")); + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java new file mode 100644 index 0000000000..1207c769e5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/OperationOrderingTests.java @@ -0,0 +1,85 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.test.data.CityData; +import org.apache.tuscany.das.rdb.test.data.StateData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + +public class OperationOrderingTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + + CityData city = new CityData(getAutoConnection()); + StateData state = new StateData(getAutoConnection()); + + city.doDeletes(); + state.doDeletes(); + state.doInserts(); + city.doInserts(); + + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + public OperationOrderingTests() { + super(); + } + + public void testInsert() throws Exception { + Command select = Command.FACTORY + .createCommand( + "Select * from STATES inner join CITIES on STATES.ID = CITIES.STATE_ID", + getConfig("cityStates.xml")); + select.setConnection(getConnection()); + 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); + + // Create apply command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("cityStates.xml")); + apply.setConnection(getConnection()); + + // Flush changes + apply.execute(root); + + select.setConnection(getConnection()); + root = select.executeQuery(); + assertEquals(numberOfCities + 1, root.getList("CITIES").size()); + assertEquals(numberOfStates + 1, root.getList("STATES").size()); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java new file mode 100644 index 0000000000..250e7673d7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/Paging.java @@ -0,0 +1,108 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + + +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.Pager; +import org.apache.tuscany.das.rdb.impl.PagerImpl; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + + +import commonj.sdo.DataObject; + + + +public class Paging extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new CustomerData(getAutoConnection()).refresh(); + } + + public void testPaging() throws SQLException { + + //Build command to read all customers + Command custCommand = Command.FACTORY.createCommand("select * from CUSTOMER order by ID"); + custCommand.setConnection(getConnection()); + + //Create a pager with the command + Pager pager = new PagerImpl(custCommand, 2); + + //Get and work with first page + DataObject root = pager.next(); + DataObject customer1 = root.getDataObject("CUSTOMER[1]"); + DataObject customer2 = root.getDataObject("CUSTOMER[2]"); + assertEquals(1, customer1.getInt("ID")); + assertEquals(2, customer2.getInt("ID")); + + //Get and work with the second page + root = pager.next(); + customer1 = root.getDataObject("CUSTOMER[1]"); + customer2 = root.getDataObject("CUSTOMER[2]"); + assertEquals(3, customer1.getInt("ID")); + assertEquals(4, customer2.getInt("ID")); + + // First page again + root = pager.previous(); + customer1 = root.getDataObject("CUSTOMER[1]"); + customer2 = root.getDataObject("CUSTOMER[2]"); + assertEquals(1, customer1.getInt("ID")); + assertEquals(2, customer2.getInt("ID")); + + } + + + public void testRandomPage() throws SQLException { + //Build the select command + Command select = Command.FACTORY + .createCommand("select * from CUSTOMER order by ID"); + + //Parameterize the command + select.setConnection(getConnection()); + + //Create a pager + Pager pager = new PagerImpl(select, 2); + + //Get the first page + DataObject root = pager.getPage(1); + DataObject customer1 = root.getDataObject("CUSTOMER[1]"); + DataObject customer2 = root.getDataObject("CUSTOMER[2]"); + assertEquals(1, customer1.getInt("ID")); + assertEquals(2, customer2.getInt("ID")); + + //Get the second page + root = pager.getPage(2); + customer1 = root.getDataObject("CUSTOMER[1]"); + customer2 = root.getDataObject("CUSTOMER[2]"); + assertEquals(3, customer1.getInt("ID")); + assertEquals(4, customer2.getInt("ID")); + + + // Get the first page again + root = pager.getPage(1); + customer1 = root.getDataObject("CUSTOMER[1]"); + customer2 = root.getDataObject("CUSTOMER[2]"); + assertEquals(1, customer1.getInt("ID")); + assertEquals(2, customer2.getInt("ID")); + } + + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java new file mode 100644 index 0000000000..b24dad33d9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PartialUpdateTests.java @@ -0,0 +1,103 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + +public class PartialUpdateTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new CustomerData(getAutoConnection()).refresh(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + public PartialUpdateTests() { + super(); + } + + public void testPartialUpdate() throws SQLException { + Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); + readCustomers.setConnection(getConnection()); + + // Read + DataObject root = readCustomers.executeQuery(); + + DataObject customer = root.getDataObject("CUSTOMER[1]"); + // Verify + assertEquals(1, customer.getInt("ID")); + + Command update = Command.FACTORY.createCommand("update CUSTOMER set LASTNAME = 'modified' where ID = 1"); + update.setConnection(getConnection()); + update.execute(); + + customer.setString("ADDRESS", "main street"); + + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection(getConnection()); + apply.execute(root); + + root = readCustomers.executeQuery(); + + // If partial update was not used, LASTNAME would not be 'modified' + customer = root.getDataObject("CUSTOMER[1]"); + assertEquals(1, customer.getInt("ID")); + assertEquals("modified", customer.getString("LASTNAME")); + assertEquals("main street", customer.getString("ADDRESS")); + } + + public void testPartialInsert() throws SQLException { + Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); + readCustomers.setConnection(getConnection()); + + // Read + DataObject root = readCustomers.executeQuery(); + + // Create a new customer + DataObject newCust = root.createDataObject("CUSTOMER"); + newCust.set("ID", new Integer(100)); + newCust.set("ADDRESS", "5528 Wells Fargo Drive"); + // Purposely do not set lastname to let it default to 'Garfugengheist' + // newCust.set("LASTNAME", "Gerkin" ); + + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection(getConnection()); + apply.execute(root); + + Command readNewCust = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 100"); + readNewCust.setConnection(getConnection()); + root = readNewCust.executeQuery(); + + // If partial insert was not used, LASTNAME would not be + // 'Garfugengheist' + newCust = root.getDataObject("CUSTOMER[1]"); + assertEquals(100, newCust.getInt("ID")); + assertEquals("Garfugengheist", newCust.getString("LASTNAME")); + assertEquals("5528 Wells Fargo Drive", newCust.getString("ADDRESS")); + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java new file mode 100644 index 0000000000..b38b117787 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/PassiveConnectionTests.java @@ -0,0 +1,85 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * Test capability to participate in an extenrlly managed transaction. The + * client is managing the transaction boundary so the DAS will not issue + * commit/rollback + * + */ + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + +public class PassiveConnectionTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new CustomerData(getAutoConnection()).refresh(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Read and modify a customer. Uses a "passive" connection + */ + public void testReadModifyApply() throws Exception { + + // Create and initialize a DAS connection and initialize for externally + // managed transaction boundaries + java.sql.Connection c = getConnection(); + + try { + + // Read customer 1 + Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 1"); + select.setConnection(c); + DataObject root = select.executeQuery(); + + DataObject customer = (DataObject) root.get("CUSTOMER[1]"); + + // Modify customer + customer.set("LASTNAME", "Pavick"); + + // Build apply changes command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection(c, false); + + // Flush changes + apply.execute(root); + + // Verify changes + root = select.executeQuery(); + assertEquals("Pavick", root.getString("CUSTOMER[1]/LASTNAME")); + + // Since the DAS is not managing tx boundaries, I must + } catch (Exception e) { + c.rollback(); + } finally { + c.commit(); + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java new file mode 100644 index 0000000000..d12e1f297b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ProgrammaticConfigTests.java @@ -0,0 +1,157 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.ConfigHelper; +import org.apache.tuscany.das.rdb.test.data.BookData; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.data.OrderData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + +/** + * Tests the Converter framwork + */ +public class ProgrammaticConfigTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new BookData(getAutoConnection()).refresh(); + new CustomerData(getAutoConnection()).refresh(); + new OrderData(getAutoConnection()).refresh(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Simple read followed by a write. This should fail since there is no + * config associaed with the applychanges command + */ + public void test_1() throws Exception { + + // Read a book instance + Command select = Command.FACTORY.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1"); + select.setConnection(getConnection()); + 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 + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection(getConnection()); + + try { + apply.execute(root); + fail("An exception should be thrown since here is no config to identify the primary key"); + } catch (RuntimeException ex) { + // Expected + } + } + + /** + * Simple read followed by a write. Config instance is generated + * programmatically using the ConfigHelper. + */ + public void test_2() throws Exception { + + // Read a book instance + Command select = Command.FACTORY.createCommand("SELECT * FROM BOOK WHERE BOOK_ID = 1"); + select.setConnection(getConnection()); + 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 + // Create config programmatically + ConfigHelper helper = new ConfigHelper(); + helper.addPrimaryKey("BOOK.BOOK_ID"); + + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig()); + apply.setConnection(getConnection()); + + apply.execute(root); + + // Verify + root = select.executeQuery(); + book = root.getDataObject("BOOK[1]"); + assertEquals(2, book.getInt("QUANTITY")); + } + + + /** + * Test ability to read a compound graph + */ + public void test_3() throws Exception { + + String statement = "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1"; + + // Read some customers and related orders + // Create relationship config programmatically + ConfigHelper helper = new ConfigHelper(); + helper.addRelationship("CUSTOMER.ID", "ANORDER.CUSTOMER_ID"); + + Command select = Command.FACTORY.createCommand(statement, helper.getConfig()); + select.setConnection(getConnection()); + + DataObject root = select.executeQuery(); + DataObject customer = root.getDataObject("CUSTOMER[1]"); + + assertEquals(2, customer.getList("ANORDER").size()); + + } + + /** + * Programatically create table config with "property" name + */ + public void test_4() throws Exception { + + String statement = "SELECT * FROM BOOK WHERE BOOK.BOOK_ID = :ID"; + + // Create Table config programmatically + ConfigHelper helper = new ConfigHelper(); + helper.addTable("BOOK", "Book"); + helper.addPrimaryKey("Book.BOOK_ID"); + + Command select = Command.FACTORY.createCommand(statement, helper.getConfig()); + select.setConnection(getConnection()); + select.setParameterValue("ID", 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); + + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(helper.getConfig()); + apply.setConnection(getConnection()); + apply.execute(root); + + //Verify + select.setParameterValue("ID", new Integer(1001)); + root = select.executeQuery(); + assertEquals("Ant Colonies of the Old World", root.getString("Book[1]/NAME")); + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java new file mode 100644 index 0000000000..7a74372551 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ReadDBSchemaTests.java @@ -0,0 +1,62 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * Test the ability to query Database schema(metadata) information using regular DAS APIs + * This is speciic to DB2 + * + */ + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + + +public class ReadDBSchemaTests extends DasTest { + + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + + + public void testReadTableInfo() throws Exception { + + Command select = Command.FACTORY.createCommand("SELECT * from SYSIBM.SYSTABLES WHERE TYPE = 'T'"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + DataObject table = (DataObject)root.get("SYSTABLES[1]"); + + assertEquals('T', table.getChar("TYPE")); + + } + + + + //Utilities + + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java new file mode 100644 index 0000000000..f67001b8b5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RecursiveTests.java @@ -0,0 +1,81 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import java.util.Iterator; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.ResultSetShape; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; +import org.apache.tuscany.das.rdb.test.data.PartData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +public class RecursiveTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new PartData(getAutoConnection()).refresh(); + } + + public void testReadEngineParts() throws Exception { + + //Table definition + //CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT ); + + String threeLevelPartsSQL = "SELECT P1.*, P2.*, P3.* FROM PART AS P1 LEFT JOIN PART AS P2 ON P1.ID = P2.PARENT_ID " + + "LEFT JOIN PART AS P3 on P2.ID = P3.PARENT_ID WHERE P1.ID = 1"; + Command select = Command.FACTORY.createCommand(threeLevelPartsSQL, getConfig("PartsConfig.xml")); + select.setConnection(getConnection()); + + String[] columns = {"ID", "NAME", "QUANTITY", "PARENT_ID", "ID", "NAME", "QUANTITY", "PARENT_ID", "ID", "NAME", "QUANTITY", "PARENT_ID"}; + String[] tables = {"PART", "PART", "PART", "PART", "PART", "PART", "PART", "PART", "PART", "PART", "PART", "PART"}; + Type[] types = {SDODataTypes.INTEGEROBJECT, SDODataTypes.STRING, SDODataTypes.INTEGEROBJECT, SDODataTypes.INTEGEROBJECT, SDODataTypes.INTEGEROBJECT, SDODataTypes.STRING, SDODataTypes.INTEGEROBJECT, SDODataTypes.INTEGEROBJECT, SDODataTypes.INTEGEROBJECT, SDODataTypes.STRING, SDODataTypes.INTEGEROBJECT, SDODataTypes.INTEGEROBJECT}; + ResultSetShape shape = new ResultSetShape(tables, columns, types); + + //Hack until we provide a nicer API + ((ReadCommandImpl)select).setResultSetShape(shape); + + // Need to set the key explicitly. The aggregate of columns not working + // because of null values + DataObject root = select.executeQuery(); + + assertEquals(5, root.getList("PART").size()); + // printList(root.getList("PART")); + DataObject engine = root.getDataObject("PART.0"); + assertEquals("Engine", engine.getString("NAME")); + + assertEquals(3, engine.getList("subparts").size()); + + DataObject piston = null; + Iterator i = engine.getList("subparts").iterator(); + while ( i.hasNext() ) { + DataObject obj = (DataObject)i.next(); + if ( obj.getString("NAME").equals("Piston")) + piston = obj; + } + + assertEquals("Piston", piston.getString("NAME")); + assertEquals(1, piston.getList("subparts").size()); + assertEquals("Piston Ring", piston.getDataObject("subparts.0").getString("NAME")); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java new file mode 100644 index 0000000000..aadcef13f3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/RelationshipTests.java @@ -0,0 +1,121 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * + * + */ + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.data.OrderData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + + +public class RelationshipTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + + new CustomerData(getAutoConnection()).refresh(); + new OrderData(getAutoConnection()).refresh(); + + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Test ability to read a compound graph + */ + public void testRead() throws Exception { + + String statement = "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = 1"; + + // Read some customers and related orders + Command select = Command.FACTORY.createCommand(statement, getConfig("customerOrderRelationshipMapping.xml")); + select.setConnection(getConnection()); + + DataObject root = select.executeQuery(); + DataObject customer = root.getDataObject("CUSTOMER[1]"); + + assertEquals(2, customer.getList("orders").size()); + + } + + /** + * Same as above except uses xml file for relationhip and key information. + * Employs CUD generation. + */ + public void testRelationshipModification2() throws Exception { + + // Read some customers and related orders + Command select = Command.FACTORY + .createCommand( + "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID", getConfig("basicCustomerOrderMapping.xml")); + select.setConnection(getConnection()); + + DataObject root = select.executeQuery(); + + DataObject cust1 = root.getDataObject("CUSTOMER[1]"); + DataObject cust2 = root.getDataObject("CUSTOMER[2]"); + + // Save IDs + Integer cust1ID = (Integer) cust1.get("ID"); + Integer cust2ID = (Integer) cust2.get("ID"); + // save order count + Integer cust1OrderCount = new Integer(cust1.getList("orders").size()); + Integer cust2OrderCount = new Integer(cust2.getList("orders").size()); + + // Move an order to cust1 from cust2 + DataObject order = (DataObject) cust2.getList("orders").get(0); + cust1.getList("orders").add(order); + + // Build apply changes command + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("basicCustomerOrderMapping.xml")); + apply.setConnection(getConnection()); + + // Flush changes + apply.execute(root); + + // verify cust1 relationship updates + select = Command.FACTORY + .createCommand( + "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", + getConfig("basicCustomerOrderMapping.xml")); + select.setConnection(getConnection()); + select.setParameterValue("ID", cust1ID); + + root = select.executeQuery(); + assertEquals(cust1OrderCount.intValue() + 1, root.getList( + "CUSTOMER[1]/orders").size()); + + // verify cust2 relationship updates + select.setParameterValue("ID", cust2ID); + root = select.executeQuery(); + assertEquals(cust2OrderCount.intValue() - 1, root.getList( + "CUSTOMER[1]/orders").size()); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java new file mode 100644 index 0000000000..e8bcfa9720 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/ResultSetShapeTests.java @@ -0,0 +1,105 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.ResultSetShape; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; + +/** + * Test ability to specify format(shape) of the ResultSet. This is necessary + * when the JDBC driver in use does not provide adequate support for + * ResultSetMetadata. Also, we expect that specifying the result set shape will + * increase performance. + * + */ +public class ResultSetShapeTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new CustomerData(getAutoConnection()).refresh(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Read a specific customer + */ + public void testReadSingle() throws Exception { + + // Using literals in the select forces invalid resultset metadata + String sqlString = "Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer"; + String[] columns = { "ID", "LASTNAME", "ADDRESS" }; + String[] tables = { "CUSTOMER", "CUSTOMER", "CUSTOMER" }; + Type[] types = { SDODataTypes.LONG, SDODataTypes.STRING, SDODataTypes.STRING }; + + ResultSetShape shape = new ResultSetShape(tables, columns, types); + + // Create and initialize command to read customers + Command readCustomers = Command.FACTORY.createCommand(sqlString, + getConfig("CustomerConfigWithIDConverter.xml")); + // Specify result shape + readCustomers.setResultSetShape(shape); + + readCustomers.setConnection(getConnection()); + + // Read + DataObject root = readCustomers.executeQuery(); + + // Verify + assertEquals(5, root.getList("CUSTOMER").size()); + assertEquals(99, root.getInt("CUSTOMER[1]/ID")); + assertEquals("Roosevelt", root.getString("CUSTOMER[1]/LASTNAME")); + assertEquals("1600 Pennsylvania Avenue", root.getString("CUSTOMER[1]/ADDRESS")); + + } + + /** + * Read a specific customer This duplicates the previous tests but does not + * provide the shape info. Since the select will not return valid metadata, + * this test is expected to fail + */ + public void testReadSingleVerifyShapeUse() throws Exception { + + // Using literals in the select forces invalid resultset metadata + String sqlString = "Select 99, 'Roosevelt', '1600 Pennsylvania Avenue' from customer"; + + // Create and initialize command to read customers + Command readCustomers = Command.FACTORY.createCommand(sqlString); + readCustomers.setConnection(getConnection()); + + // Read + DataObject root = readCustomers.executeQuery(); + + // Verify + try { + assertEquals(5, root.getList("CUSTOMER").size()); + fail("Should fail since there will be no feature named CUSTOMER"); + } catch (IllegalArgumentException e) { + // OK + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java new file mode 100644 index 0000000000..0089e6b569 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SerializationTests.java @@ -0,0 +1,90 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * This class provides tests for all supported "types". The current plan is to + * use the Data type definitions provided in the SDO 2 specification. We must + * test the ability to use all of these types as well as different mapping from + * thse types to types used in the database. For example, a SDO Data Type + * "STRING", might be staored as a "TIMESTAMP" in DB2. + * + */ + +import org.apache.tuscany.das.rdb.test.data.TypesData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +public class SerializationTests extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new TypesData(getAutoConnection()).refresh(); + } + + /** + * Read various types. + */ + + +public void testReadandSerialize() throws Exception { + /** Currently failing because of TUSCANY-22 + Command select = Command.FACTORY + .createCommand("Select * from TYPETEST where ID = 1"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + DataObject obj = root.getDataObject("TYPETEST[1]"); + + assertTrue(obj.isSet("ID")); + assertTrue(obj.isSet("ATIMESTAMP")); + assertTrue(obj.isSet("ADECIMAL")); + assertTrue(obj.isSet("AFLOAT")); + + //Java serilaization to file + FileOutputStream fos = null; + ObjectOutputStream out = null; + try { + fos = new FileOutputStream("serializedGraph.xml"); + out = new ObjectOutputStream(fos); + out.writeObject(root); + out.flush(); + } finally { + out.close(); + fos.close(); + } + + //Reconstruct the graph + FileInputStream fis = null; + ObjectInputStream in = null; + DataObject root2; + try { + fis = new FileInputStream("serializedGraph.xml"); + in = new ObjectInputStream(fis); + root2 = (DataObject) in.readObject(); + } finally { + in.close(); + fis.close(); + } + + assertEquals(1, root.getInt("TYPETEST[1]/ID")); + assertEquals(TypesData.getTimestamp(), (java.sql.Timestamp)root.get("TYPETEST[1]/ATIMESTAMP")); + assertEquals(1234567.89f, root2.getFloat("TYPETEST[1]/ADECIMAL"), .001); + assertEquals(1234567.89f, root2.getFloat("TYPETEST[1]/AFLOAT"), .001); + + */ + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java new file mode 100644 index 0000000000..11ef87c8bc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/SimplestCrud.java @@ -0,0 +1,256 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * These are the simplest possible uses of the JDBC DAS. In this mode, the + * programming model is not much more than JDBC + * + * The assumptions for these tests are: + * + * Single type + * Client explicitly Read/Create/Update/Delete commands + * No O/R mapping metadata + * SDO change history is not used + * Dynamic DataObjects + * No specified graph model + * + * + */ + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + +import commonj.sdo.DataObject; + + +public class SimplestCrud extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new CustomerData(getAutoConnection()).refresh(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + /** + * Read a specific customer + */ + public void testReadSingle() throws Exception { + + //Create and initialize command to read customers + Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); + readCustomers.setConnection(getConnection()); + + //Read + DataObject root = readCustomers.executeQuery(); + + //Verify + assertEquals(1, root.getInt("CUSTOMER[1]/ID")); + } + + /** + * Read a specific customer + */ + public void testReadSingle2() throws Exception { + + //Create and initialize command to read customers + Command readCustomers = Command.FACTORY.createCommand("select * from CUSTOMER where ID = 1"); + readCustomers.setConnection(getConnection()); + + //Read + DataObject root = readCustomers.executeQuery(); + + DataObject cust = root.getDataObject("CUSTOMER[1]"); + +// int n = (cust.getType().getProperties()).size(); +// for (int i=0; i 0); + + } + + public void testGetNamedCompany() throws Exception { + + Command read = Command.FACTORY.createCommand("{call GETNAMEDCOMPANY(?)}"); + + read.setConnection(getConnection()); + read.setParameterValue(1, "MegaCorp"); + DataObject root = read.executeQuery(); + + assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME")); + + } + + public void testGetNamedCompanyByName() throws Exception { + Command read = Command.FACTORY + .createCommand("{call GETNAMEDCOMPANY(:NAME)}"); + + read.setConnection(getConnection()); + read.setParameterValue("NAME", "MegaCorp"); + DataObject root = read.executeQuery(); + + assertEquals("MegaCorp", root.getString("COMPANY[1]/NAME")); + } + + + // Retreive heirarchy using a stored proc ... new programming model + public void testGetCustomersAndOrder() throws Exception { + + Command read = Command.FACTORY.createCommand("{call getCustomerAndOrders(?)}", getConfig("CustomersOrdersConfig.xml")); + read.setConnection(getConnection()); + read.setParameterValue(1, new Integer(1)); + + DataObject root = read.executeQuery(); + + DataObject customer = (DataObject) root.getList("CUSTOMER").get(0); + assertEquals(2, customer.getList("orders").size()); + + } + + /** + * Call a stored proc requiring an in parameter and producing an out + * parameter and a resultset + * + * This stored proc takes a lastname argument and returns a graph of + * customers with that last name. The number of read customers is returned + * in the out parameter + */ + public void testGetNamedCustomers() throws Exception { + + Command read = Command.FACTORY.createCommand("{call GETNAMEDCUSTOMERS(?,?)}"); + read.setConnection(getConnection()); + read.setParameterValue(1, "Williams"); + read.addParameter(2, Parameter.OUT, SDODataTypes.INTEGER); + DataObject root = read.executeQuery(); + + Integer customersRead = (Integer) read.getParameterValue(2); + + assertEquals(4, customersRead.intValue()); + assertEquals(customersRead.intValue(), root.getList("CUSTOMER").size()); + + } + + //TODO - Resolve issue with programmatic creation of GETNAMEDCUSTOMERS on DB2 and + //re-enable this test + + + // Simplest possible SP write + public void testDelete() throws Exception { + + Command delete = Command.FACTORY.createCommand("{call DELETECUSTOMER(?)}"); + delete.setConnection(getConnection()); + delete.setParameterValue(1, new Integer(1)); + delete.execute(); + + // Verify DELETE + Command select = Command.FACTORY.createCommand("Select * from CUSTOMER where ID = 1"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + assertTrue(root.getList("CUSTOMER").isEmpty()); + + } + +/* // For debug + public void testRawCall() throws Exception { + + Connection c = getConnection(); + CallableStatement cs = c.prepareCall("{call GETNAMEDCUSTOMERS(?,?)}"); + ParameterMetaData pm = cs.getParameterMetaData(); + int count = pm.getParameterCount(); + for (int i = 1; i <= count; i++) { + int mode = pm.getParameterMode(i); + if (mode == ParameterMetaData.parameterModeOut + || mode == ParameterMetaData.parameterModeInOut) + cs.registerOutParameter(i, pm.getParameterType(i)); + } + cs.setString(1, "Williams"); + // cs.registerOutParameter(2,java.sql.Types.INTEGER); + boolean isResultSet = cs.execute(); + System.out.println("Has a result set => " + isResultSet); + ResultSet rs = cs.getResultSet(); + + if (isResultSet) { + System.out.println("Results are: "); + while (rs.next()) { + System.out.println(rs.getObject(2)); + } + } + System.out.println("Count is =>" + cs.getObject(2)); + c.commit(); + } + + // For debug + public void testRawCall2() throws Exception { + + Connection c = getConnection(); + CallableStatement cs = c.prepareCall("{call getCustomerAndOrders(?)}"); + cs.setObject(1, new Integer(1)); + boolean isResultSet = cs.execute(); + System.out.println("call getCustomerAndOrders(?) has a result set => " + + isResultSet); + ResultSet rs = cs.getResultSet(); + + write(rs); + c.commit(); + } + + public void testGetAllOrders() throws Exception { + + System.out.println("all orders"); + Connection c = getConnection(); + PreparedStatement s = c.prepareStatement("select * from anorder"); + write (s.executeQuery()); + c.commit(); + + }*/ + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java new file mode 100644 index 0000000000..7829e69e07 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TopDown.java @@ -0,0 +1,85 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +import java.io.IOException; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +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.DataGraphRoot; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.data.OrderData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.TypeHelper; + +public class TopDown extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + + new CustomerData(getAutoConnection()).refresh(); + new OrderData(getAutoConnection()).refresh(); + + } + + // Uses dynamic SDOs but user provides the model + public void testUserProvidedModelDynamic() throws SQLException, IOException { + + // Build the select command + Command select = Command.FACTORY + .createCommand( + "SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = :ID", + getConfig("1xM_mapping_no_cud.xml")); + + SDOUtil.registerStaticTypes(CustomerFactory.class); + +// Set the object model + select.setDataObjectModel(TypeHelper.INSTANCE.getType(DataGraphRoot.class)); + + + // Parameterize the command + select.setConnection(getConnection()); + select.setParameterValue("ID", new Integer(1)); + + // Get the graph - DataGraphRoot is from the typed package + DataGraphRoot root = (DataGraphRoot) select.executeQuery(); + + // Modify a customer + Customer customer = (Customer) root.getCustomers().get(0); + customer.setLastName("Pavick"); + + // Modify an order + AnOrder order = (AnOrder) customer.getOrders().get(0); + order.setProduct("Kitchen Sink 001"); + + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(getConfig("1xM_mapping_no_cud.xml")); + apply.setConnection(getConnection()); + + // Flush changes + apply.execute((DataObject) root); + + } + + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java new file mode 100644 index 0000000000..e49c5f7630 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/TypeTests.java @@ -0,0 +1,96 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test; + +/* + * This class provides tests for all supported "types". The current plan is to use the Data + * type definitions provided in the SDO 2 specification. We must test the ability to use + * all of these types as well as different mapping from thse types to types used in the + * database. For example, a SDO Data Type "STRING", might be staored as a "TIMESTAMP" in DB2. + * + */ + +import java.sql.Timestamp; +import java.util.Date; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.test.data.TypesData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; + + +import commonj.sdo.DataObject; + + +public class TypeTests extends DasTest { + + + protected void setUp() throws Exception { + super.setUp(); + new TypesData(getAutoConnection()).refresh(); + } + + /** + * Read various types. + */ + public void testRead() throws Exception { + + //Read customer 1 + Command select = Command.FACTORY.createCommand("Select * from TYPETEST where ID = 1"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + DataObject types = (DataObject)root.get("TYPETEST[1]"); + + java.sql.Timestamp ts = (java.sql.Timestamp)types.get("ATIMESTAMP"); + assertEquals(ts, TypesData.getTimestamp()); + + float decimal = types.getFloat("ADECIMAL"); + assertEquals(1234567.89f, decimal, .0001); + + } + + + /** + * Write various types. + * TODO - Need to rethink the Timestamp write. My current thinking id that writes of non-SDO2 defined types + * require a converter + */ +/* public void testWrite() throws Exception { + + //Read customer 1 + Command select = Command.FACTORY.createCommand("Select * from TYPETEST where ID = 1"); + select.setConnection(getConnection()); + DataObject root = select.executeQuery(); + + DataObject types = (DataObject)root.get("TYPETEST[1]"); + Date now = new Date(); + types.set("ATIMESTAMP", now); + + ApplyChangesCommand apply = Command.FACTORY.createApplyChangesCommand(); + apply.setConnection(getConnection()); + apply.addPrimaryKey("TYPETEST.ID"); + apply.execute(root); + + //Verify + root = select.executeQuery(); + java.sql.Timestamp ts = (java.sql.Timestamp)types.get("ATIMESTAMP"); + assertEquals(now, ts); + + }*/ + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java new file mode 100644 index 0000000000..09a6147118 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersByLastnameCommand.java @@ -0,0 +1,54 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.commands; + +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; +import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; + + +public class ReadCustomersByLastnameCommand extends ReadCommandImpl { + + private static final String sqlString = "select * from CUSTOMER where LASTNAME = :LASTNAME"; + private static final Config mapping; + + static { + ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; + mapping = factory.createConfig(); + Table t = factory.createTable(); + Column id = factory.createColumn(); + id.setName("ID"); + id.setPrimaryKey(true); + Column lastname = factory.createColumn(); + lastname.setName("LASTNAME"); + Column address = factory.createColumn(); + address.setName("ADDRESS"); + + t.getColumn().add(id); + t.getColumn().add(lastname); + t.getColumn().add(address); + t.setName("CUSTOMER"); + mapping.getTable().add(t); + } + + public ReadCustomersByLastnameCommand() { + super(sqlString, mapping); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java new file mode 100644 index 0000000000..615ef12dab --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersCommand.java @@ -0,0 +1,55 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.test.commands; + +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; +import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; + + +public class ReadCustomersCommand extends ReadCommandImpl { + + private static final String sqlString = "select * from CUSTOMER"; + private static final Config mapping; + + static { + ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; + mapping = factory.createConfig(); + Table t = factory.createTable(); + Column id = factory.createColumn(); + id.setName("ID"); + id.setPrimaryKey(true); + Column lastname = factory.createColumn(); + lastname.setName("LASTNAME"); + Column address = factory.createColumn(); + address.setName("ADDRESS"); + + t.getColumn().add(id); + t.getColumn().add(lastname); + t.getColumn().add(address); + t.setName("CUSTOMER"); + mapping.getTable().add(t); + } + + public ReadCustomersCommand() { + super(sqlString, mapping); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java new file mode 100644 index 0000000000..c8dcdebb68 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersStaticTypesCommand.java @@ -0,0 +1,62 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.test.commands; + +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; +import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; +import org.apache.tuscany.das.rdb.test.customer.DataGraphRoot; + +import commonj.sdo.helper.TypeHelper; + + +public class ReadCustomersStaticTypesCommand extends ReadCommandImpl { + + private static final String sqlString = "Select ID, LASTNAME, ADDRESS from CUSTOMER where LASTNAME = :LASTNAME"; + private static final Config mapping; + + static { + ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; + mapping = factory.createConfig(); + Table t = factory.createTable(); + Column id = factory.createColumn(); + id.setName("ID"); + id.setPrimaryKey(true); + Column lastname = factory.createColumn(); + lastname.setName("LASTNAME"); + Column address = factory.createColumn(); + address.setName("ADDRESS"); + + t.getColumn().add(id); + t.getColumn().add(lastname); + t.getColumn().add(address); + t.setName("CUSTOMER"); + t.setPropertyName("Customer"); + mapping.getTable().add(t); + } + + public ReadCustomersStaticTypesCommand() { + super(sqlString, mapping); + setDataObjectModel(TypeHelper.INSTANCE.getType(DataGraphRoot.class)); + } + + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java new file mode 100644 index 0000000000..82d8cefbc2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/ReadCustomersWithShapeCommand.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.commands; + +import org.apache.tuscany.das.rdb.ResultSetShape; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; + +import commonj.sdo.Type; + +public class ReadCustomersWithShapeCommand extends ReadCommandImpl { + + // This sql string ensures that we won't have resultset metadata + private static final String sqlString = "Select * from customer union select * from customer"; + + private static final String[] columns = {"ID", "LASTNAME", "ADDRESS"}; + private static final String[] tables = {"CUSTOMER", "CUSTOMER", "CUSTOMER"}; + private static final Type[] types = {SDODataTypes.INT, SDODataTypes.STRING, SDODataTypes.STRING}; + + public ReadCustomersWithShapeCommand() { + super(sqlString); + ResultSetShape shape = new ResultSetShape(tables, columns, types); + setResultSetShape(shape); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java new file mode 100644 index 0000000000..1f45ba317f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/commands/SimpleReadCustomersWithShapeCommand.java @@ -0,0 +1,66 @@ +/** +* +* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.tuscany.das.rdb.test.commands; + +import org.apache.tuscany.das.rdb.ResultSetShape; +import org.apache.tuscany.das.rdb.SDODataTypes; +import org.apache.tuscany.das.rdb.config.Column; +import org.apache.tuscany.das.rdb.config.Config; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.das.rdb.config.Table; +import org.apache.tuscany.das.rdb.config.impl.ConfigFactoryImpl; +import org.apache.tuscany.das.rdb.impl.ReadCommandImpl; + +import commonj.sdo.Type; + +public class SimpleReadCustomersWithShapeCommand extends ReadCommandImpl { + + // This sql string ensures that we won't have resultset metadata + private static final String sqlString = "Select * from customer union select * from customer"; + + private static final String[] columns = {"ID", "LASTNAME", "ADDRESS"}; + private static final String[] tables = {"CUSTOMER", "CUSTOMER", "CUSTOMER"}; + private static final Type[] types = {SDODataTypes.INT, SDODataTypes.STRING, SDODataTypes.STRING}; + + private static final Config mapping; + + static { + ConfigFactory factory = ConfigFactoryImpl.eINSTANCE; + mapping = factory.createConfig(); + Table t = factory.createTable(); + Column id = factory.createColumn(); + id.setName("ID"); + id.setPrimaryKey(true); + Column lastname = factory.createColumn(); + lastname.setName("LASTNAME"); + Column address = factory.createColumn(); + address.setName("ADDRESS"); + + t.getColumn().add(id); + t.getColumn().add(lastname); + t.getColumn().add(address); + t.setName("CUSTOMER"); + mapping.getTable().add(t); + } + + public SimpleReadCustomersWithShapeCommand() { + super(sqlString, mapping); + ResultSetShape shape = new ResultSetShape(tables, columns, types); + setResultSetShape(shape); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyFactory.java new file mode 100644 index 0000000000..a30b607b24 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyFactory.java @@ -0,0 +1,73 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface CompanyFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + CompanyFactory INSTANCE = org.apache.tuscany.das.rdb.test.company.impl.CompanyFactoryImpl.eINSTANCE; + + /** + * Returns a new object of class 'Type'. + * + * + * @return a new object of class 'Type'. + * @generated + */ + CompanyType createCompanyType(); + + /** + * Returns a new object of class 'Datagraph Root'. + * + * + * @return a new object of class 'Datagraph Root'. + * @generated + */ + DatagraphRoot createDatagraphRoot(); + + /** + * Returns a new object of class 'Department Type'. + * + * + * @return a new object of class 'Department Type'. + * @generated + */ + DepartmentType createDepartmentType(); + + /** + * Returns a new object of class 'Employee Type'. + * + * + * @return a new object of class 'Employee Type'. + * @generated + */ + EmployeeType createEmployeeType(); + +} //CompanyFactory diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyType.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyType.java new file mode 100644 index 0000000000..bba21c0661 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/CompanyType.java @@ -0,0 +1,101 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company; + +import java.util.List; + +/** + * + * A representation of the model object 'Type'. + * + * + *

+ * The following features are supported: + *

+ *

+ * + * @generated + */ +public interface CompanyType +{ + /** + * Returns the value of the 'Departments' containment reference list. + * The list contents are of type {@link org.apache.tuscany.das.rdb.test.company.DepartmentType}. + * + *

+ * If the meaning of the 'Departments' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Departments' containment reference list. + * @generated + */ + List getDepartments(); + + /** + * Returns the value of the 'Employee Of The Month' attribute. + * + *

+ * If the meaning of the 'Employee Of The Month' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Employee Of The Month' attribute. + * @see #setEmployeeOfTheMonth(String) + * @generated + */ + String getEmployeeOfTheMonth(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getEmployeeOfTheMonth Employee Of The Month}' attribute. + * + * + * @param value the new value of the 'Employee Of The Month' attribute. + * @see #getEmployeeOfTheMonth() + * @generated + */ + void setEmployeeOfTheMonth(String value); + + /** + * Returns the value of the 'Name' attribute. + * + *

+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // CompanyType diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DatagraphRoot.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DatagraphRoot.java new file mode 100644 index 0000000000..81ae283bbe --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DatagraphRoot.java @@ -0,0 +1,81 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company; + +import java.util.List; + +/** + * + * A representation of the model object 'Datagraph Root'. + * + * + *

+ * The following features are supported: + *

+ *

+ * + * @generated + */ +public interface DatagraphRoot +{ + /** + * Returns the value of the 'Companies' containment reference list. + * The list contents are of type {@link org.apache.tuscany.das.rdb.test.company.CompanyType}. + * + *

+ * If the meaning of the 'Companies' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Companies' containment reference list. + * @generated + */ + List getCompanies(); + + /** + * Returns the value of the 'Departments' containment reference list. + * The list contents are of type {@link org.apache.tuscany.das.rdb.test.company.DepartmentType}. + * + *

+ * If the meaning of the 'Departments' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Departments' containment reference list. + * @generated + */ + List getDepartments(); + + /** + * Returns the value of the 'Employees' containment reference list. + * The list contents are of type {@link org.apache.tuscany.das.rdb.test.company.EmployeeType}. + * + *

+ * If the meaning of the 'Employees' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Employees' containment reference list. + * @generated + */ + List getEmployees(); + +} // DatagraphRoot diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DepartmentType.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DepartmentType.java new file mode 100644 index 0000000000..522779b51d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/DepartmentType.java @@ -0,0 +1,153 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company; + +import java.util.List; + +/** + * + * A representation of the model object 'Department Type'. + * + * + *

+ * The following features are supported: + *

+ *

+ * + * @generated + */ +public interface DepartmentType +{ + /** + * Returns the value of the 'Employees' containment reference list. + * The list contents are of type {@link org.apache.tuscany.das.rdb.test.company.EmployeeType}. + * + *

+ * If the meaning of the 'Employees' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Employees' containment reference list. + * @generated + */ + List getEmployees(); + + /** + * Returns the value of the 'Location' attribute. + * + *

+ * If the meaning of the 'Location' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Location' attribute. + * @see #setLocation(String) + * @generated + */ + String getLocation(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getLocation Location}' attribute. + * + * + * @param value the new value of the 'Location' attribute. + * @see #getLocation() + * @generated + */ + void setLocation(String value); + + /** + * Returns the value of the 'Name' attribute. + * + *

+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Number' attribute. + * + *

+ * If the meaning of the 'Number' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Number' attribute. + * @see #isSetNumber() + * @see #unsetNumber() + * @see #setNumber(int) + * @generated + */ + int getNumber(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber Number}' attribute. + * + * + * @param value the new value of the 'Number' attribute. + * @see #isSetNumber() + * @see #unsetNumber() + * @see #getNumber() + * @generated + */ + void setNumber(int value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber Number}' attribute. + * + * + * @see #isSetNumber() + * @see #getNumber() + * @see #setNumber(int) + * @generated + */ + void unsetNumber(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber Number}' attribute is set. + * + * + * @return whether the value of the 'Number' attribute is set. + * @see #unsetNumber() + * @see #getNumber() + * @see #setNumber(int) + * @generated + */ + boolean isSetNumber(); + +} // DepartmentType diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/EmployeeType.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/EmployeeType.java new file mode 100644 index 0000000000..0e7a18034c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/EmployeeType.java @@ -0,0 +1,137 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company; + + +/** + * + * A representation of the model object 'Employee Type'. + * + * + *

+ * The following features are supported: + *

+ *

+ * + * @generated + */ +public interface EmployeeType +{ + /** + * Returns the value of the 'Manager' attribute. + * + *

+ * If the meaning of the 'Manager' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Manager' attribute. + * @see #isSetManager() + * @see #unsetManager() + * @see #setManager(boolean) + * @generated + */ + boolean isManager(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager Manager}' attribute. + * + * + * @param value the new value of the 'Manager' attribute. + * @see #isSetManager() + * @see #unsetManager() + * @see #isManager() + * @generated + */ + void setManager(boolean value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager Manager}' attribute. + * + * + * @see #isSetManager() + * @see #isManager() + * @see #setManager(boolean) + * @generated + */ + void unsetManager(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager Manager}' attribute is set. + * + * + * @return whether the value of the 'Manager' attribute is set. + * @see #unsetManager() + * @see #isManager() + * @see #setManager(boolean) + * @generated + */ + boolean isSetManager(); + + /** + * Returns the value of the 'Name' attribute. + * + *

+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'SN' attribute. + * + *

+ * If the meaning of the 'SN' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'SN' attribute. + * @see #setSN(String) + * @generated + */ + String getSN(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#getSN SN}' attribute. + * + * + * @param value the new value of the 'SN' attribute. + * @see #getSN() + * @generated + */ + void setSN(String value); + +} // EmployeeType diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyFactoryImpl.java new file mode 100644 index 0000000000..55812441d8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyFactoryImpl.java @@ -0,0 +1,174 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company.impl; + +import org.apache.tuscany.das.rdb.test.company.*; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class CompanyFactoryImpl extends EFactoryImpl implements CompanyFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + public static final CompanyFactoryImpl eINSTANCE = init(); + + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static CompanyFactoryImpl init() + { + try + { + CompanyFactoryImpl theCompanyFactory = (CompanyFactoryImpl)EPackage.Registry.INSTANCE.getEFactory("org.apache.tuscany.das.rdb.test/company.xsd"); + if (theCompanyFactory != null) + { + return theCompanyFactory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new CompanyFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public CompanyFactoryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public EObject create(EClass eClass) + { + switch (eClass.getClassifierID()) + { + case CompanyPackageImpl.COMPANY_TYPE: return (EObject)createCompanyType(); + case CompanyPackageImpl.DATAGRAPH_ROOT: return (EObject)createDatagraphRoot(); + case CompanyPackageImpl.DEPARTMENT_TYPE: return (EObject)createDepartmentType(); + case CompanyPackageImpl.DOCUMENT_ROOT: return (EObject)createDocumentRoot(); + case CompanyPackageImpl.EMPLOYEE_TYPE: return (EObject)createEmployeeType(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public CompanyType createCompanyType() + { + CompanyTypeImpl companyType = new CompanyTypeImpl(); + return companyType; + } + + /** + * + * + * @generated + */ + public DatagraphRoot createDatagraphRoot() + { + DatagraphRootImpl datagraphRoot = new DatagraphRootImpl(); + return datagraphRoot; + } + + /** + * + * + * @generated + */ + public DepartmentType createDepartmentType() + { + DepartmentTypeImpl departmentType = new DepartmentTypeImpl(); + return departmentType; + } + + /** + * + * + * @generated + */ + public EObject createDocumentRoot() + { + EObject documentRoot = super.create(CompanyPackageImpl.Literals.DOCUMENT_ROOT); + return documentRoot; + } + + /** + * + * + * @generated + */ + public EmployeeType createEmployeeType() + { + EmployeeTypeImpl employeeType = new EmployeeTypeImpl(); + return employeeType; + } + + /** + * + * + * @generated + */ + public CompanyPackageImpl getCompanyPackageImpl() + { + return (CompanyPackageImpl)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + public static CompanyPackageImpl getPackage() + { + return CompanyPackageImpl.eINSTANCE; + } + +} //CompanyFactoryImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyPackageImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyPackageImpl.java new file mode 100644 index 0000000000..9a079816fd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyPackageImpl.java @@ -0,0 +1,1258 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company.impl; + +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.DatagraphRoot; +import org.apache.tuscany.das.rdb.test.company.DepartmentType; +import org.apache.tuscany.das.rdb.test.company.EmployeeType; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + * + * + * @see org.apache.tuscany.das.rdb.test.company.CompanyFactory + * @generated + */ +public class CompanyPackageImpl extends EPackageImpl +{ + /** + * The package name. + * + * + * @generated + */ + public static final String eNAME = "company"; + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String eNS_URI = "org.apache.tuscany.das.rdb.test/company.xsd"; + + /** + * The package namespace name. + * + * + * @generated + */ + public static final String eNS_PREFIX = "company"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + public static final CompanyPackageImpl eINSTANCE = org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl.init(); + + /** + * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl Type}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getCompanyType() + * @generated + */ + public static final int COMPANY_TYPE = 0; + + /** + * The feature id for the 'Departments' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int COMPANY_TYPE__DEPARTMENTS = 0; + + /** + * The feature id for the 'Employee Of The Month' attribute. + * + * + * @generated + * @ordered + */ + public static final int COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH = 1; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + public static final int COMPANY_TYPE__NAME = 2; + + /** + * The number of structural features of the 'Type' class. + * + * + * @generated + * @ordered + */ + public static final int COMPANY_TYPE_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl Datagraph Root}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDatagraphRoot() + * @generated + */ + public static final int DATAGRAPH_ROOT = 1; + + /** + * The feature id for the 'Companies' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int DATAGRAPH_ROOT__COMPANIES = 0; + + /** + * The feature id for the 'Departments' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int DATAGRAPH_ROOT__DEPARTMENTS = 1; + + /** + * The feature id for the 'Employees' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int DATAGRAPH_ROOT__EMPLOYEES = 2; + + /** + * The number of structural features of the 'Datagraph Root' class. + * + * + * @generated + * @ordered + */ + public static final int DATAGRAPH_ROOT_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl Department Type}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDepartmentType() + * @generated + */ + public static final int DEPARTMENT_TYPE = 2; + + /** + * The feature id for the 'Employees' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int DEPARTMENT_TYPE__EMPLOYEES = 0; + + /** + * The feature id for the 'Location' attribute. + * + * + * @generated + * @ordered + */ + public static final int DEPARTMENT_TYPE__LOCATION = 1; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + public static final int DEPARTMENT_TYPE__NAME = 2; + + /** + * The feature id for the 'Number' attribute. + * + * + * @generated + * @ordered + */ + public static final int DEPARTMENT_TYPE__NUMBER = 3; + + /** + * The number of structural features of the 'Department Type' class. + * + * + * @generated + * @ordered + */ + public static final int DEPARTMENT_TYPE_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DocumentRootImpl Document Root}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.company.impl.DocumentRootImpl + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDocumentRoot() + * @generated + */ + public static final int DOCUMENT_ROOT = 3; + + /** + * The feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__MIXED = 0; + + /** + * The feature id for the 'XMLNS Prefix Map' map. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__XMLNS_PREFIX_MAP = 1; + + /** + * The feature id for the 'XSI Schema Location' map. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = 2; + + /** + * The feature id for the 'Company' containment reference. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__COMPANY = 3; + + /** + * The number of structural features of the 'Document Root' class. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl Employee Type}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getEmployeeType() + * @generated + */ + public static final int EMPLOYEE_TYPE = 4; + + /** + * The feature id for the 'Manager' attribute. + * + * + * @generated + * @ordered + */ + public static final int EMPLOYEE_TYPE__MANAGER = 0; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + public static final int EMPLOYEE_TYPE__NAME = 1; + + /** + * The feature id for the 'SN' attribute. + * + * + * @generated + * @ordered + */ + public static final int EMPLOYEE_TYPE__SN = 2; + + /** + * The number of structural features of the 'Employee Type' class. + * + * + * @generated + * @ordered + */ + public static final int EMPLOYEE_TYPE_FEATURE_COUNT = 3; + + /** + * + * + * @generated + */ + private EClass companyTypeEClass = null; + + /** + * + * + * @generated + */ + private EClass datagraphRootEClass = null; + + /** + * + * + * @generated + */ + private EClass departmentTypeEClass = null; + + /** + * + * + * @generated + */ + private EClass documentRootEClass = null; + + /** + * + * + * @generated + */ + private EClass employeeTypeEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#eNS_URI + * @see #init() + * @generated + */ + private CompanyPackageImpl() + { + super(eNS_URI, ((EFactory)CompanyFactory.INSTANCE)); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + *

Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + *

Invocation of this method will not affect any packages that have + * already been initialized. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static CompanyPackageImpl init() + { + if (isInited) return (CompanyPackageImpl)EPackage.Registry.INSTANCE.getEPackage(CompanyPackageImpl.eNS_URI); + + // Obtain or create and register package + CompanyPackageImpl theCompanyPackageImpl = (CompanyPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof CompanyPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new CompanyPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + XMLTypePackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theCompanyPackageImpl.createPackageContents(); + + // Initialize created meta-data + theCompanyPackageImpl.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theCompanyPackageImpl.freeze(); + + return theCompanyPackageImpl; + } + + + /** + * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.company.CompanyType Type}'. + * + * + * @return the meta object for class 'Type'. + * @see org.apache.tuscany.das.rdb.test.company.CompanyType + * @generated + */ + public EClass getCompanyType() + { + return companyTypeEClass; + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getDepartments Departments}'. + * + * + * @return the meta object for the containment reference list 'Departments'. + * @see org.apache.tuscany.das.rdb.test.company.CompanyType#getDepartments() + * @see #getCompanyType() + * @generated + */ + public EReference getCompanyType_Departments() + { + return (EReference)companyTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getEmployeeOfTheMonth Employee Of The Month}'. + * + * + * @return the meta object for the attribute 'Employee Of The Month'. + * @see org.apache.tuscany.das.rdb.test.company.CompanyType#getEmployeeOfTheMonth() + * @see #getCompanyType() + * @generated + */ + public EAttribute getCompanyType_EmployeeOfTheMonth() + { + return (EAttribute)companyTypeEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.CompanyType#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.apache.tuscany.das.rdb.test.company.CompanyType#getName() + * @see #getCompanyType() + * @generated + */ + public EAttribute getCompanyType_Name() + { + return (EAttribute)companyTypeEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot Datagraph Root}'. + * + * + * @return the meta object for class 'Datagraph Root'. + * @see org.apache.tuscany.das.rdb.test.company.DatagraphRoot + * @generated + */ + public EClass getDatagraphRoot() + { + return datagraphRootEClass; + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getCompanies Companies}'. + * + * + * @return the meta object for the containment reference list 'Companies'. + * @see org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getCompanies() + * @see #getDatagraphRoot() + * @generated + */ + public EReference getDatagraphRoot_Companies() + { + return (EReference)datagraphRootEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getDepartments Departments}'. + * + * + * @return the meta object for the containment reference list 'Departments'. + * @see org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getDepartments() + * @see #getDatagraphRoot() + * @generated + */ + public EReference getDatagraphRoot_Departments() + { + return (EReference)datagraphRootEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getEmployees Employees}'. + * + * + * @return the meta object for the containment reference list 'Employees'. + * @see org.apache.tuscany.das.rdb.test.company.DatagraphRoot#getEmployees() + * @see #getDatagraphRoot() + * @generated + */ + public EReference getDatagraphRoot_Employees() + { + return (EReference)datagraphRootEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType Department Type}'. + * + * + * @return the meta object for class 'Department Type'. + * @see org.apache.tuscany.das.rdb.test.company.DepartmentType + * @generated + */ + public EClass getDepartmentType() + { + return departmentTypeEClass; + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getEmployees Employees}'. + * + * + * @return the meta object for the containment reference list 'Employees'. + * @see org.apache.tuscany.das.rdb.test.company.DepartmentType#getEmployees() + * @see #getDepartmentType() + * @generated + */ + public EReference getDepartmentType_Employees() + { + return (EReference)departmentTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getLocation Location}'. + * + * + * @return the meta object for the attribute 'Location'. + * @see org.apache.tuscany.das.rdb.test.company.DepartmentType#getLocation() + * @see #getDepartmentType() + * @generated + */ + public EAttribute getDepartmentType_Location() + { + return (EAttribute)departmentTypeEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.apache.tuscany.das.rdb.test.company.DepartmentType#getName() + * @see #getDepartmentType() + * @generated + */ + public EAttribute getDepartmentType_Name() + { + return (EAttribute)departmentTypeEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber Number}'. + * + * + * @return the meta object for the attribute 'Number'. + * @see org.apache.tuscany.das.rdb.test.company.DepartmentType#getNumber() + * @see #getDepartmentType() + * @generated + */ + public EAttribute getDepartmentType_Number() + { + return (EAttribute)departmentTypeEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for class '{@link org.eclipse.emf.ecore.EObject Document Root}'. + * + * + * @return the meta object for class 'Document Root'. + * @see org.eclipse.emf.ecore.EObject + * @generated + */ + public EClass getDocumentRoot() + { + return documentRootEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.eclipse.emf.ecore.EObject#getMixed Mixed}'. + * + * + * @return the meta object for the attribute list 'Mixed'. + * @see org.eclipse.emf.ecore.EObject#getMixed() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_Mixed() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap XMLNS Prefix Map}'. + * + * + * @return the meta object for the map 'XMLNS Prefix Map'. + * @see org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_XMLNSPrefixMap() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXSISchemaLocation XSI Schema Location}'. + * + * + * @return the meta object for the map 'XSI Schema Location'. + * @see org.eclipse.emf.ecore.EObject#getXSISchemaLocation() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_XSISchemaLocation() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.emf.ecore.EObject#getCompany Company}'. + * + * + * @return the meta object for the containment reference 'Company'. + * @see org.eclipse.emf.ecore.EObject#getCompany() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_Company() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType Employee Type}'. + * + * + * @return the meta object for class 'Employee Type'. + * @see org.apache.tuscany.das.rdb.test.company.EmployeeType + * @generated + */ + public EClass getEmployeeType() + { + return employeeTypeEClass; + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager Manager}'. + * + * + * @return the meta object for the attribute 'Manager'. + * @see org.apache.tuscany.das.rdb.test.company.EmployeeType#isManager() + * @see #getEmployeeType() + * @generated + */ + public EAttribute getEmployeeType_Manager() + { + return (EAttribute)employeeTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.apache.tuscany.das.rdb.test.company.EmployeeType#getName() + * @see #getEmployeeType() + * @generated + */ + public EAttribute getEmployeeType_Name() + { + return (EAttribute)employeeTypeEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.company.EmployeeType#getSN SN}'. + * + * + * @return the meta object for the attribute 'SN'. + * @see org.apache.tuscany.das.rdb.test.company.EmployeeType#getSN() + * @see #getEmployeeType() + * @generated + */ + public EAttribute getEmployeeType_SN() + { + return (EAttribute)employeeTypeEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + public CompanyFactory getCompanyFactory() + { + return (CompanyFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + companyTypeEClass = createEClass(COMPANY_TYPE); + createEReference(companyTypeEClass, COMPANY_TYPE__DEPARTMENTS); + createEAttribute(companyTypeEClass, COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH); + createEAttribute(companyTypeEClass, COMPANY_TYPE__NAME); + + datagraphRootEClass = createEClass(DATAGRAPH_ROOT); + createEReference(datagraphRootEClass, DATAGRAPH_ROOT__COMPANIES); + createEReference(datagraphRootEClass, DATAGRAPH_ROOT__DEPARTMENTS); + createEReference(datagraphRootEClass, DATAGRAPH_ROOT__EMPLOYEES); + + departmentTypeEClass = createEClass(DEPARTMENT_TYPE); + createEReference(departmentTypeEClass, DEPARTMENT_TYPE__EMPLOYEES); + createEAttribute(departmentTypeEClass, DEPARTMENT_TYPE__LOCATION); + createEAttribute(departmentTypeEClass, DEPARTMENT_TYPE__NAME); + createEAttribute(departmentTypeEClass, DEPARTMENT_TYPE__NUMBER); + + documentRootEClass = createEClass(DOCUMENT_ROOT); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__MIXED); + createEReference(documentRootEClass, DOCUMENT_ROOT__XMLNS_PREFIX_MAP); + createEReference(documentRootEClass, DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); + createEReference(documentRootEClass, DOCUMENT_ROOT__COMPANY); + + employeeTypeEClass = createEClass(EMPLOYEE_TYPE); + createEAttribute(employeeTypeEClass, EMPLOYEE_TYPE__MANAGER); + createEAttribute(employeeTypeEClass, EMPLOYEE_TYPE__NAME); + createEAttribute(employeeTypeEClass, EMPLOYEE_TYPE__SN); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(companyTypeEClass, CompanyType.class, "CompanyType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getCompanyType_Departments(), this.getDepartmentType(), null, "departments", null, 1, -1, CompanyType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCompanyType_EmployeeOfTheMonth(), theXMLTypePackage.getIDREF(), "employeeOfTheMonth", null, 0, 1, CompanyType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCompanyType_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, CompanyType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(datagraphRootEClass, DatagraphRoot.class, "DatagraphRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getDatagraphRoot_Companies(), this.getCompanyType(), null, "companies", null, 0, -1, DatagraphRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDatagraphRoot_Departments(), this.getDepartmentType(), null, "departments", null, 0, -1, DatagraphRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDatagraphRoot_Employees(), this.getEmployeeType(), null, "employees", null, 0, -1, DatagraphRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(departmentTypeEClass, DepartmentType.class, "DepartmentType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getDepartmentType_Employees(), this.getEmployeeType(), null, "employees", null, 1, -1, DepartmentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDepartmentType_Location(), theXMLTypePackage.getString(), "location", null, 0, 1, DepartmentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDepartmentType_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, DepartmentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDepartmentType_Number(), theXMLTypePackage.getInt(), "number", null, 0, 1, DepartmentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(documentRootEClass, null, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_Company(), this.getCompanyType(), null, "company", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + + initEClass(employeeTypeEClass, EmployeeType.class, "EmployeeType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getEmployeeType_Manager(), theXMLTypePackage.getBoolean(), "manager", null, 0, 1, EmployeeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getEmployeeType_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, EmployeeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getEmployeeType_SN(), theXMLTypePackage.getID(), "sN", null, 0, 1, EmployeeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http:///org/eclipse/emf/ecore/util/ExtendedMetaData + createExtendedMetaDataAnnotations(); + } + + /** + * Initializes the annotations for http:///org/eclipse/emf/ecore/util/ExtendedMetaData. + * + * + * @generated + */ + protected void createExtendedMetaDataAnnotations() + { + String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; + addAnnotation + (companyTypeEClass, + source, + new String[] + { + "name", "CompanyType", + "kind", "elementOnly" + }); + addAnnotation + (getCompanyType_Departments(), + source, + new String[] + { + "kind", "element", + "name", "departments" + }); + addAnnotation + (getCompanyType_EmployeeOfTheMonth(), + source, + new String[] + { + "kind", "attribute", + "name", "employeeOfTheMonth" + }); + addAnnotation + (getCompanyType_Name(), + source, + new String[] + { + "kind", "attribute", + "name", "name" + }); + addAnnotation + (datagraphRootEClass, + source, + new String[] + { + "name", "DatagraphRoot", + "kind", "elementOnly" + }); + addAnnotation + (getDatagraphRoot_Companies(), + source, + new String[] + { + "kind", "element", + "name", "companies" + }); + addAnnotation + (getDatagraphRoot_Departments(), + source, + new String[] + { + "kind", "element", + "name", "departments" + }); + addAnnotation + (getDatagraphRoot_Employees(), + source, + new String[] + { + "kind", "element", + "name", "employees" + }); + addAnnotation + (departmentTypeEClass, + source, + new String[] + { + "name", "DepartmentType", + "kind", "elementOnly" + }); + addAnnotation + (getDepartmentType_Employees(), + source, + new String[] + { + "kind", "element", + "name", "employees" + }); + addAnnotation + (getDepartmentType_Location(), + source, + new String[] + { + "kind", "attribute", + "name", "location" + }); + addAnnotation + (getDepartmentType_Name(), + source, + new String[] + { + "kind", "attribute", + "name", "name" + }); + addAnnotation + (getDepartmentType_Number(), + source, + new String[] + { + "kind", "attribute", + "name", "number" + }); + addAnnotation + (documentRootEClass, + source, + new String[] + { + "name", "", + "kind", "mixed" + }); + addAnnotation + (getDocumentRoot_Mixed(), + source, + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + addAnnotation + (getDocumentRoot_XMLNSPrefixMap(), + source, + new String[] + { + "kind", "attribute", + "name", "xmlns:prefix" + }); + addAnnotation + (getDocumentRoot_XSISchemaLocation(), + source, + new String[] + { + "kind", "attribute", + "name", "xsi:schemaLocation" + }); + addAnnotation + (getDocumentRoot_Company(), + source, + new String[] + { + "kind", "element", + "name", "company", + "namespace", "##targetNamespace" + }); + addAnnotation + (employeeTypeEClass, + source, + new String[] + { + "name", "EmployeeType", + "kind", "empty" + }); + addAnnotation + (getEmployeeType_Manager(), + source, + new String[] + { + "kind", "attribute", + "name", "manager" + }); + addAnnotation + (getEmployeeType_Name(), + source, + new String[] + { + "kind", "attribute", + "name", "name" + }); + addAnnotation + (getEmployeeType_SN(), + source, + new String[] + { + "kind", "attribute", + "name", "SN" + }); + } + + /** + * + * Defines literals for the meta objects that represent + *

+ * + * @generated + */ + public interface Literals + { + /** + * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl Type}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyTypeImpl + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getCompanyType() + * @generated + */ + public static final EClass COMPANY_TYPE = eINSTANCE.getCompanyType(); + + /** + * The meta object literal for the 'Departments' containment reference list feature. + * + * + * @generated + */ + public static final EReference COMPANY_TYPE__DEPARTMENTS = eINSTANCE.getCompanyType_Departments(); + + /** + * The meta object literal for the 'Employee Of The Month' attribute feature. + * + * + * @generated + */ + public static final EAttribute COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH = eINSTANCE.getCompanyType_EmployeeOfTheMonth(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + public static final EAttribute COMPANY_TYPE__NAME = eINSTANCE.getCompanyType_Name(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl Datagraph Root}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.company.impl.DatagraphRootImpl + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDatagraphRoot() + * @generated + */ + public static final EClass DATAGRAPH_ROOT = eINSTANCE.getDatagraphRoot(); + + /** + * The meta object literal for the 'Companies' containment reference list feature. + * + * + * @generated + */ + public static final EReference DATAGRAPH_ROOT__COMPANIES = eINSTANCE.getDatagraphRoot_Companies(); + + /** + * The meta object literal for the 'Departments' containment reference list feature. + * + * + * @generated + */ + public static final EReference DATAGRAPH_ROOT__DEPARTMENTS = eINSTANCE.getDatagraphRoot_Departments(); + + /** + * The meta object literal for the 'Employees' containment reference list feature. + * + * + * @generated + */ + public static final EReference DATAGRAPH_ROOT__EMPLOYEES = eINSTANCE.getDatagraphRoot_Employees(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl Department Type}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.company.impl.DepartmentTypeImpl + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDepartmentType() + * @generated + */ + public static final EClass DEPARTMENT_TYPE = eINSTANCE.getDepartmentType(); + + /** + * The meta object literal for the 'Employees' containment reference list feature. + * + * + * @generated + */ + public static final EReference DEPARTMENT_TYPE__EMPLOYEES = eINSTANCE.getDepartmentType_Employees(); + + /** + * The meta object literal for the 'Location' attribute feature. + * + * + * @generated + */ + public static final EAttribute DEPARTMENT_TYPE__LOCATION = eINSTANCE.getDepartmentType_Location(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + public static final EAttribute DEPARTMENT_TYPE__NAME = eINSTANCE.getDepartmentType_Name(); + + /** + * The meta object literal for the 'Number' attribute feature. + * + * + * @generated + */ + public static final EAttribute DEPARTMENT_TYPE__NUMBER = eINSTANCE.getDepartmentType_Number(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.company.impl.DocumentRootImpl Document Root}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.company.impl.DocumentRootImpl + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getDocumentRoot() + * @generated + */ + public static final EClass DOCUMENT_ROOT = eINSTANCE.getDocumentRoot(); + + /** + * The meta object literal for the 'Mixed' attribute list feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__MIXED = eINSTANCE.getDocumentRoot_Mixed(); + + /** + * The meta object literal for the 'XMLNS Prefix Map' map feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__XMLNS_PREFIX_MAP = eINSTANCE.getDocumentRoot_XMLNSPrefixMap(); + + /** + * The meta object literal for the 'XSI Schema Location' map feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = eINSTANCE.getDocumentRoot_XSISchemaLocation(); + + /** + * The meta object literal for the 'Company' containment reference feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__COMPANY = eINSTANCE.getDocumentRoot_Company(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl Employee Type}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.company.impl.EmployeeTypeImpl + * @see org.apache.tuscany.das.rdb.test.company.impl.CompanyPackageImpl#getEmployeeType() + * @generated + */ + public static final EClass EMPLOYEE_TYPE = eINSTANCE.getEmployeeType(); + + /** + * The meta object literal for the 'Manager' attribute feature. + * + * + * @generated + */ + public static final EAttribute EMPLOYEE_TYPE__MANAGER = eINSTANCE.getEmployeeType_Manager(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + public static final EAttribute EMPLOYEE_TYPE__NAME = eINSTANCE.getEmployeeType_Name(); + + /** + * The meta object literal for the 'SN' attribute feature. + * + * + * @generated + */ + public static final EAttribute EMPLOYEE_TYPE__SN = eINSTANCE.getEmployeeType_SN(); + + } + +} //CompanyPackageImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyTypeImpl.java new file mode 100644 index 0000000000..76caa0bcdc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/CompanyTypeImpl.java @@ -0,0 +1,303 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company.impl; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.das.rdb.test.company.CompanyType; +import org.apache.tuscany.das.rdb.test.company.DepartmentType; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Type'. + * + *

+ * The following features are implemented: + *

+ *

+ * + * @generated + */ +public class CompanyTypeImpl extends DataObjectImpl implements CompanyType +{ + /** + * The cached value of the '{@link #getDepartments() Departments}' containment reference list. + * + * + * @see #getDepartments() + * @generated + * @ordered + */ + protected EList departments = null; + + /** + * The default value of the '{@link #getEmployeeOfTheMonth() Employee Of The Month}' attribute. + * + * + * @see #getEmployeeOfTheMonth() + * @generated + * @ordered + */ + protected static final String EMPLOYEE_OF_THE_MONTH_EDEFAULT = null; + + /** + * The cached value of the '{@link #getEmployeeOfTheMonth() Employee Of The Month}' attribute. + * + * + * @see #getEmployeeOfTheMonth() + * @generated + * @ordered + */ + protected String employeeOfTheMonth = EMPLOYEE_OF_THE_MONTH_EDEFAULT; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * + * + * @generated + */ + protected CompanyTypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return CompanyPackageImpl.Literals.COMPANY_TYPE; + } + + /** + * + * + * @generated + */ + public List getDepartments() + { + if (departments == null) + { + departments = new EObjectContainmentEList(DepartmentType.class, this, CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS); + } + return departments; + } + + /** + * + * + * @generated + */ + public String getEmployeeOfTheMonth() + { + return employeeOfTheMonth; + } + + /** + * + * + * @generated + */ + public void setEmployeeOfTheMonth(String newEmployeeOfTheMonth) + { + String oldEmployeeOfTheMonth = employeeOfTheMonth; + employeeOfTheMonth = newEmployeeOfTheMonth; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH, oldEmployeeOfTheMonth, employeeOfTheMonth)); + } + + /** + * + * + * @generated + */ + public String getName() + { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) + { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.COMPANY_TYPE__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS: + return ((InternalEList)getDepartments()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS: + return getDepartments(); + case CompanyPackageImpl.COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH: + return getEmployeeOfTheMonth(); + case CompanyPackageImpl.COMPANY_TYPE__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS: + getDepartments().clear(); + getDepartments().addAll((Collection)newValue); + return; + case CompanyPackageImpl.COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH: + setEmployeeOfTheMonth((String)newValue); + return; + case CompanyPackageImpl.COMPANY_TYPE__NAME: + setName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS: + getDepartments().clear(); + return; + case CompanyPackageImpl.COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH: + setEmployeeOfTheMonth(EMPLOYEE_OF_THE_MONTH_EDEFAULT); + return; + case CompanyPackageImpl.COMPANY_TYPE__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case CompanyPackageImpl.COMPANY_TYPE__DEPARTMENTS: + return departments != null && !departments.isEmpty(); + case CompanyPackageImpl.COMPANY_TYPE__EMPLOYEE_OF_THE_MONTH: + return EMPLOYEE_OF_THE_MONTH_EDEFAULT == null ? employeeOfTheMonth != null : !EMPLOYEE_OF_THE_MONTH_EDEFAULT.equals(employeeOfTheMonth); + case CompanyPackageImpl.COMPANY_TYPE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (employeeOfTheMonth: "); + result.append(employeeOfTheMonth); + result.append(", name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //CompanyTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DatagraphRootImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DatagraphRootImpl.java new file mode 100644 index 0000000000..cde59e98ed --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DatagraphRootImpl.java @@ -0,0 +1,252 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company.impl; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.das.rdb.test.company.CompanyType; +import org.apache.tuscany.das.rdb.test.company.DatagraphRoot; +import org.apache.tuscany.das.rdb.test.company.DepartmentType; +import org.apache.tuscany.das.rdb.test.company.EmployeeType; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Datagraph Root'. + * + *

+ * The following features are implemented: + *

+ *

+ * + * @generated + */ +public class DatagraphRootImpl extends DataObjectImpl implements DatagraphRoot +{ + /** + * The cached value of the '{@link #getCompanies() Companies}' containment reference list. + * + * + * @see #getCompanies() + * @generated + * @ordered + */ + protected EList companies = null; + + /** + * The cached value of the '{@link #getDepartments() Departments}' containment reference list. + * + * + * @see #getDepartments() + * @generated + * @ordered + */ + protected EList departments = null; + + /** + * The cached value of the '{@link #getEmployees() Employees}' containment reference list. + * + * + * @see #getEmployees() + * @generated + * @ordered + */ + protected EList employees = null; + + /** + * + * + * @generated + */ + protected DatagraphRootImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return CompanyPackageImpl.Literals.DATAGRAPH_ROOT; + } + + /** + * + * + * @generated + */ + public List getCompanies() + { + if (companies == null) + { + companies = new EObjectContainmentEList(CompanyType.class, this, CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES); + } + return companies; + } + + /** + * + * + * @generated + */ + public List getDepartments() + { + if (departments == null) + { + departments = new EObjectContainmentEList(DepartmentType.class, this, CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS); + } + return departments; + } + + /** + * + * + * @generated + */ + public List getEmployees() + { + if (employees == null) + { + employees = new EObjectContainmentEList(EmployeeType.class, this, CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES); + } + return employees; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES: + return ((InternalEList)getCompanies()).basicRemove(otherEnd, msgs); + case CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS: + return ((InternalEList)getDepartments()).basicRemove(otherEnd, msgs); + case CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES: + return ((InternalEList)getEmployees()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES: + return getCompanies(); + case CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS: + return getDepartments(); + case CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES: + return getEmployees(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES: + getCompanies().clear(); + getCompanies().addAll((Collection)newValue); + return; + case CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS: + getDepartments().clear(); + getDepartments().addAll((Collection)newValue); + return; + case CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES: + getEmployees().clear(); + getEmployees().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES: + getCompanies().clear(); + return; + case CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS: + getDepartments().clear(); + return; + case CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES: + getEmployees().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case CompanyPackageImpl.DATAGRAPH_ROOT__COMPANIES: + return companies != null && !companies.isEmpty(); + case CompanyPackageImpl.DATAGRAPH_ROOT__DEPARTMENTS: + return departments != null && !departments.isEmpty(); + case CompanyPackageImpl.DATAGRAPH_ROOT__EMPLOYEES: + return employees != null && !employees.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //DatagraphRootImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DepartmentTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DepartmentTypeImpl.java new file mode 100644 index 0000000000..9ceb2d8da7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/DepartmentTypeImpl.java @@ -0,0 +1,395 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company.impl; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.das.rdb.test.company.DepartmentType; +import org.apache.tuscany.das.rdb.test.company.EmployeeType; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Department Type'. + * + *

+ * The following features are implemented: + *

+ *

+ * + * @generated + */ +public class DepartmentTypeImpl extends DataObjectImpl implements DepartmentType +{ + /** + * The cached value of the '{@link #getEmployees() Employees}' containment reference list. + * + * + * @see #getEmployees() + * @generated + * @ordered + */ + protected EList employees = null; + + /** + * The default value of the '{@link #getLocation() Location}' attribute. + * + * + * @see #getLocation() + * @generated + * @ordered + */ + protected static final String LOCATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLocation() Location}' attribute. + * + * + * @see #getLocation() + * @generated + * @ordered + */ + protected String location = LOCATION_EDEFAULT; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The default value of the '{@link #getNumber() Number}' attribute. + * + * + * @see #getNumber() + * @generated + * @ordered + */ + protected static final int NUMBER_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getNumber() Number}' attribute. + * + * + * @see #getNumber() + * @generated + * @ordered + */ + protected int number = NUMBER_EDEFAULT; + + /** + * This is true if the Number attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean numberESet = false; + + /** + * + * + * @generated + */ + protected DepartmentTypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return CompanyPackageImpl.Literals.DEPARTMENT_TYPE; + } + + /** + * + * + * @generated + */ + public List getEmployees() + { + if (employees == null) + { + employees = new EObjectContainmentEList(EmployeeType.class, this, CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES); + } + return employees; + } + + /** + * + * + * @generated + */ + public String getLocation() + { + return location; + } + + /** + * + * + * @generated + */ + public void setLocation(String newLocation) + { + String oldLocation = location; + location = newLocation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.DEPARTMENT_TYPE__LOCATION, oldLocation, location)); + } + + /** + * + * + * @generated + */ + public String getName() + { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) + { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.DEPARTMENT_TYPE__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public int getNumber() + { + return number; + } + + /** + * + * + * @generated + */ + public void setNumber(int newNumber) + { + int oldNumber = number; + number = newNumber; + boolean oldNumberESet = numberESet; + numberESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER, oldNumber, number, !oldNumberESet)); + } + + /** + * + * + * @generated + */ + public void unsetNumber() + { + int oldNumber = number; + boolean oldNumberESet = numberESet; + number = NUMBER_EDEFAULT; + numberESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER, oldNumber, NUMBER_EDEFAULT, oldNumberESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetNumber() + { + return numberESet; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES: + return ((InternalEList)getEmployees()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES: + return getEmployees(); + case CompanyPackageImpl.DEPARTMENT_TYPE__LOCATION: + return getLocation(); + case CompanyPackageImpl.DEPARTMENT_TYPE__NAME: + return getName(); + case CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER: + return new Integer(getNumber()); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES: + getEmployees().clear(); + getEmployees().addAll((Collection)newValue); + return; + case CompanyPackageImpl.DEPARTMENT_TYPE__LOCATION: + setLocation((String)newValue); + return; + case CompanyPackageImpl.DEPARTMENT_TYPE__NAME: + setName((String)newValue); + return; + case CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER: + setNumber(((Integer)newValue).intValue()); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES: + getEmployees().clear(); + return; + case CompanyPackageImpl.DEPARTMENT_TYPE__LOCATION: + setLocation(LOCATION_EDEFAULT); + return; + case CompanyPackageImpl.DEPARTMENT_TYPE__NAME: + setName(NAME_EDEFAULT); + return; + case CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER: + unsetNumber(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case CompanyPackageImpl.DEPARTMENT_TYPE__EMPLOYEES: + return employees != null && !employees.isEmpty(); + case CompanyPackageImpl.DEPARTMENT_TYPE__LOCATION: + return LOCATION_EDEFAULT == null ? location != null : !LOCATION_EDEFAULT.equals(location); + case CompanyPackageImpl.DEPARTMENT_TYPE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case CompanyPackageImpl.DEPARTMENT_TYPE__NUMBER: + return isSetNumber(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (location: "); + result.append(location); + result.append(", name: "); + result.append(name); + result.append(", number: "); + if (numberESet) result.append(number); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //DepartmentTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/EmployeeTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/EmployeeTypeImpl.java new file mode 100644 index 0000000000..39d0e6b876 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/company/impl/EmployeeTypeImpl.java @@ -0,0 +1,333 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.company.impl; + +import org.apache.tuscany.das.rdb.test.company.EmployeeType; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +/** + * + * An implementation of the model object 'Employee Type'. + * + *

+ * The following features are implemented: + *

+ *

+ * + * @generated + */ +public class EmployeeTypeImpl extends DataObjectImpl implements EmployeeType +{ + /** + * The default value of the '{@link #isManager() Manager}' attribute. + * + * + * @see #isManager() + * @generated + * @ordered + */ + protected static final boolean MANAGER_EDEFAULT = false; + + /** + * The cached value of the '{@link #isManager() Manager}' attribute. + * + * + * @see #isManager() + * @generated + * @ordered + */ + protected boolean manager = MANAGER_EDEFAULT; + + /** + * This is true if the Manager attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean managerESet = false; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The default value of the '{@link #getSN() SN}' attribute. + * + * + * @see #getSN() + * @generated + * @ordered + */ + protected static final String SN_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSN() SN}' attribute. + * + * + * @see #getSN() + * @generated + * @ordered + */ + protected String sN = SN_EDEFAULT; + + /** + * + * + * @generated + */ + protected EmployeeTypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return CompanyPackageImpl.Literals.EMPLOYEE_TYPE; + } + + /** + * + * + * @generated + */ + public boolean isManager() + { + return manager; + } + + /** + * + * + * @generated + */ + public void setManager(boolean newManager) + { + boolean oldManager = manager; + manager = newManager; + boolean oldManagerESet = managerESet; + managerESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER, oldManager, manager, !oldManagerESet)); + } + + /** + * + * + * @generated + */ + public void unsetManager() + { + boolean oldManager = manager; + boolean oldManagerESet = managerESet; + manager = MANAGER_EDEFAULT; + managerESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER, oldManager, MANAGER_EDEFAULT, oldManagerESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetManager() + { + return managerESet; + } + + /** + * + * + * @generated + */ + public String getName() + { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) + { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.EMPLOYEE_TYPE__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public String getSN() + { + return sN; + } + + /** + * + * + * @generated + */ + public void setSN(String newSN) + { + String oldSN = sN; + sN = newSN; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CompanyPackageImpl.EMPLOYEE_TYPE__SN, oldSN, sN)); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER: + return isManager() ? Boolean.TRUE : Boolean.FALSE; + case CompanyPackageImpl.EMPLOYEE_TYPE__NAME: + return getName(); + case CompanyPackageImpl.EMPLOYEE_TYPE__SN: + return getSN(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER: + setManager(((Boolean)newValue).booleanValue()); + return; + case CompanyPackageImpl.EMPLOYEE_TYPE__NAME: + setName((String)newValue); + return; + case CompanyPackageImpl.EMPLOYEE_TYPE__SN: + setSN((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER: + unsetManager(); + return; + case CompanyPackageImpl.EMPLOYEE_TYPE__NAME: + setName(NAME_EDEFAULT); + return; + case CompanyPackageImpl.EMPLOYEE_TYPE__SN: + setSN(SN_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case CompanyPackageImpl.EMPLOYEE_TYPE__MANAGER: + return isSetManager(); + case CompanyPackageImpl.EMPLOYEE_TYPE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case CompanyPackageImpl.EMPLOYEE_TYPE__SN: + return SN_EDEFAULT == null ? sN != null : !SN_EDEFAULT.equals(sN); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (manager: "); + if (managerESet) result.append(manager); else result.append(""); + result.append(", name: "); + result.append(name); + result.append(", sN: "); + result.append(sN); + result.append(')'); + return result.toString(); + } + +} //EmployeeTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/AnOrder.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/AnOrder.java new file mode 100644 index 0000000000..1cbc53c1ab --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/AnOrder.java @@ -0,0 +1,216 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.customer; + + +/** + * + * A representation of the model object 'An Order'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getID ID}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getProduct Product}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity Quantity}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID Customer ID}
  • + *
+ *

+ * + * @generated + */ +public interface AnOrder +{ + /** + * Returns the value of the 'ID' attribute. + * + *

+ * If the meaning of the 'ID' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'ID' attribute. + * @see #isSetID() + * @see #unsetID() + * @see #setID(int) + * @generated + */ + int getID(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getID ID}' attribute. + * + * + * @param value the new value of the 'ID' attribute. + * @see #isSetID() + * @see #unsetID() + * @see #getID() + * @generated + */ + void setID(int value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getID ID}' attribute. + * + * + * @see #isSetID() + * @see #getID() + * @see #setID(int) + * @generated + */ + void unsetID(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getID ID}' attribute is set. + * + * + * @return whether the value of the 'ID' attribute is set. + * @see #unsetID() + * @see #getID() + * @see #setID(int) + * @generated + */ + boolean isSetID(); + + /** + * Returns the value of the 'Product' attribute. + * + *

+ * If the meaning of the 'Product' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Product' attribute. + * @see #setProduct(String) + * @generated + */ + String getProduct(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getProduct Product}' attribute. + * + * + * @param value the new value of the 'Product' attribute. + * @see #getProduct() + * @generated + */ + void setProduct(String value); + + /** + * Returns the value of the 'Quantity' attribute. + * + *

+ * If the meaning of the 'Quantity' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Quantity' attribute. + * @see #isSetQuantity() + * @see #unsetQuantity() + * @see #setQuantity(int) + * @generated + */ + int getQuantity(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity Quantity}' attribute. + * + * + * @param value the new value of the 'Quantity' attribute. + * @see #isSetQuantity() + * @see #unsetQuantity() + * @see #getQuantity() + * @generated + */ + void setQuantity(int value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity Quantity}' attribute. + * + * + * @see #isSetQuantity() + * @see #getQuantity() + * @see #setQuantity(int) + * @generated + */ + void unsetQuantity(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity Quantity}' attribute is set. + * + * + * @return whether the value of the 'Quantity' attribute is set. + * @see #unsetQuantity() + * @see #getQuantity() + * @see #setQuantity(int) + * @generated + */ + boolean isSetQuantity(); + + /** + * Returns the value of the 'Customer ID' attribute. + * + *

+ * If the meaning of the 'Customer ID' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Customer ID' attribute. + * @see #isSetCustomerID() + * @see #unsetCustomerID() + * @see #setCustomerID(int) + * @generated + */ + int getCustomerID(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID Customer ID}' attribute. + * + * + * @param value the new value of the 'Customer ID' attribute. + * @see #isSetCustomerID() + * @see #unsetCustomerID() + * @see #getCustomerID() + * @generated + */ + void setCustomerID(int value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID Customer ID}' attribute. + * + * + * @see #isSetCustomerID() + * @see #getCustomerID() + * @see #setCustomerID(int) + * @generated + */ + void unsetCustomerID(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID Customer ID}' attribute is set. + * + * + * @return whether the value of the 'Customer ID' attribute is set. + * @see #unsetCustomerID() + * @see #getCustomerID() + * @see #setCustomerID(int) + * @generated + */ + boolean isSetCustomerID(); + +} // AnOrder diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/Customer.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/Customer.java new file mode 100644 index 0000000000..5f6e71f153 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/Customer.java @@ -0,0 +1,153 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.customer; + +import java.util.List; + +/** + * + * A representation of the model object 'Customer'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.das.rdb.test.customer.Customer#getID ID}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.Customer#getLastName Last Name}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.Customer#getAddress Address}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.Customer#getOrders Orders}
  • + *
+ *

+ * + * @generated + */ +public interface Customer +{ + /** + * Returns the value of the 'ID' attribute. + * + *

+ * If the meaning of the 'ID' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'ID' attribute. + * @see #isSetID() + * @see #unsetID() + * @see #setID(int) + * @generated + */ + int getID(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getID ID}' attribute. + * + * + * @param value the new value of the 'ID' attribute. + * @see #isSetID() + * @see #unsetID() + * @see #getID() + * @generated + */ + void setID(int value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getID ID}' attribute. + * + * + * @see #isSetID() + * @see #getID() + * @see #setID(int) + * @generated + */ + void unsetID(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getID ID}' attribute is set. + * + * + * @return whether the value of the 'ID' attribute is set. + * @see #unsetID() + * @see #getID() + * @see #setID(int) + * @generated + */ + boolean isSetID(); + + /** + * Returns the value of the 'Last Name' attribute. + * + *

+ * If the meaning of the 'Last Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Last Name' attribute. + * @see #setLastName(String) + * @generated + */ + String getLastName(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getLastName Last Name}' attribute. + * + * + * @param value the new value of the 'Last Name' attribute. + * @see #getLastName() + * @generated + */ + void setLastName(String value); + + /** + * Returns the value of the 'Address' attribute. + * + *

+ * If the meaning of the 'Address' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Address' attribute. + * @see #setAddress(String) + * @generated + */ + String getAddress(); + + /** + * Sets the value of the '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getAddress Address}' attribute. + * + * + * @param value the new value of the 'Address' attribute. + * @see #getAddress() + * @generated + */ + void setAddress(String value); + + /** + * Returns the value of the 'Orders' containment reference list. + * The list contents are of type {@link org.apache.tuscany.das.rdb.test.customer.AnOrder}. + * + *

+ * If the meaning of the 'Orders' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Orders' containment reference list. + * @generated + */ + List getOrders(); + +} // Customer diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/CustomerFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/CustomerFactory.java new file mode 100644 index 0000000000..67f8c2eca6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/CustomerFactory.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.customer; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface CustomerFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + CustomerFactory INSTANCE = org.apache.tuscany.das.rdb.test.customer.impl.CustomerFactoryImpl.eINSTANCE; + + /** + * Returns a new object of class 'An Order'. + * + * + * @return a new object of class 'An Order'. + * @generated + */ + AnOrder createAnOrder(); + + /** + * Returns a new object of class 'Customer'. + * + * + * @return a new object of class 'Customer'. + * @generated + */ + Customer createCustomer(); + + /** + * Returns a new object of class 'Data Graph Root'. + * + * + * @return a new object of class 'Data Graph Root'. + * @generated + */ + DataGraphRoot createDataGraphRoot(); + +} //CustomerFactory diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/DataGraphRoot.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/DataGraphRoot.java new file mode 100644 index 0000000000..eeb9d8a9bb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/DataGraphRoot.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.customer; + +import java.util.List; + +/** + * + * A representation of the model object 'Data Graph Root'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getCustomers Customers}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getOrders Orders}
  • + *
+ *

+ * + * @generated + */ +public interface DataGraphRoot +{ + /** + * Returns the value of the 'Customers' containment reference list. + * The list contents are of type {@link org.apache.tuscany.das.rdb.test.customer.Customer}. + * + *

+ * If the meaning of the 'Customers' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Customers' containment reference list. + * @generated + */ + List getCustomers(); + + /** + * Returns the value of the 'Orders' containment reference list. + * The list contents are of type {@link org.apache.tuscany.das.rdb.test.customer.AnOrder}. + * + *

+ * If the meaning of the 'Orders' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Orders' containment reference list. + * @generated + */ + List getOrders(); + +} // DataGraphRoot diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/AnOrderImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/AnOrderImpl.java new file mode 100644 index 0000000000..c4117be1c7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/AnOrderImpl.java @@ -0,0 +1,461 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.customer.impl; + +import org.apache.tuscany.das.rdb.test.customer.AnOrder; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +/** + * + * An implementation of the model object 'An Order'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl#getID ID}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl#getProduct Product}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl#getQuantity Quantity}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl#getCustomerID Customer ID}
  • + *
+ *

+ * + * @generated + */ +public class AnOrderImpl extends DataObjectImpl implements AnOrder +{ + /** + * The default value of the '{@link #getID() ID}' attribute. + * + * + * @see #getID() + * @generated + * @ordered + */ + protected static final int ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getID() ID}' attribute. + * + * + * @see #getID() + * @generated + * @ordered + */ + protected int iD = ID_EDEFAULT; + + /** + * This is true if the ID attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean iDESet = false; + + /** + * The default value of the '{@link #getProduct() Product}' attribute. + * + * + * @see #getProduct() + * @generated + * @ordered + */ + protected static final String PRODUCT_EDEFAULT = null; + + /** + * The cached value of the '{@link #getProduct() Product}' attribute. + * + * + * @see #getProduct() + * @generated + * @ordered + */ + protected String product = PRODUCT_EDEFAULT; + + /** + * The default value of the '{@link #getQuantity() Quantity}' attribute. + * + * + * @see #getQuantity() + * @generated + * @ordered + */ + protected static final int QUANTITY_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getQuantity() Quantity}' attribute. + * + * + * @see #getQuantity() + * @generated + * @ordered + */ + protected int quantity = QUANTITY_EDEFAULT; + + /** + * This is true if the Quantity attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean quantityESet = false; + + /** + * The default value of the '{@link #getCustomerID() Customer ID}' attribute. + * + * + * @see #getCustomerID() + * @generated + * @ordered + */ + protected static final int CUSTOMER_ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getCustomerID() Customer ID}' attribute. + * + * + * @see #getCustomerID() + * @generated + * @ordered + */ + protected int customerID = CUSTOMER_ID_EDEFAULT; + + /** + * This is true if the Customer ID attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean customerIDESet = false; + + /** + * + * + * @generated + */ + protected AnOrderImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return CustomerPackageImpl.Literals.AN_ORDER; + } + + /** + * + * + * @generated + */ + public int getID() + { + return iD; + } + + /** + * + * + * @generated + */ + public void setID(int newID) + { + int oldID = iD; + iD = newID; + boolean oldIDESet = iDESet; + iDESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.AN_ORDER__ID, oldID, iD, !oldIDESet)); + } + + /** + * + * + * @generated + */ + public void unsetID() + { + int oldID = iD; + boolean oldIDESet = iDESet; + iD = ID_EDEFAULT; + iDESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CustomerPackageImpl.AN_ORDER__ID, oldID, ID_EDEFAULT, oldIDESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetID() + { + return iDESet; + } + + /** + * + * + * @generated + */ + public String getProduct() + { + return product; + } + + /** + * + * + * @generated + */ + public void setProduct(String newProduct) + { + String oldProduct = product; + product = newProduct; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.AN_ORDER__PRODUCT, oldProduct, product)); + } + + /** + * + * + * @generated + */ + public int getQuantity() + { + return quantity; + } + + /** + * + * + * @generated + */ + public void setQuantity(int newQuantity) + { + int oldQuantity = quantity; + quantity = newQuantity; + boolean oldQuantityESet = quantityESet; + quantityESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.AN_ORDER__QUANTITY, oldQuantity, quantity, !oldQuantityESet)); + } + + /** + * + * + * @generated + */ + public void unsetQuantity() + { + int oldQuantity = quantity; + boolean oldQuantityESet = quantityESet; + quantity = QUANTITY_EDEFAULT; + quantityESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CustomerPackageImpl.AN_ORDER__QUANTITY, oldQuantity, QUANTITY_EDEFAULT, oldQuantityESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetQuantity() + { + return quantityESet; + } + + /** + * + * + * @generated + */ + public int getCustomerID() + { + return customerID; + } + + /** + * + * + * @generated + */ + public void setCustomerID(int newCustomerID) + { + int oldCustomerID = customerID; + customerID = newCustomerID; + boolean oldCustomerIDESet = customerIDESet; + customerIDESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.AN_ORDER__CUSTOMER_ID, oldCustomerID, customerID, !oldCustomerIDESet)); + } + + /** + * + * + * @generated + */ + public void unsetCustomerID() + { + int oldCustomerID = customerID; + boolean oldCustomerIDESet = customerIDESet; + customerID = CUSTOMER_ID_EDEFAULT; + customerIDESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CustomerPackageImpl.AN_ORDER__CUSTOMER_ID, oldCustomerID, CUSTOMER_ID_EDEFAULT, oldCustomerIDESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetCustomerID() + { + return customerIDESet; + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case CustomerPackageImpl.AN_ORDER__ID: + return new Integer(getID()); + case CustomerPackageImpl.AN_ORDER__PRODUCT: + return getProduct(); + case CustomerPackageImpl.AN_ORDER__QUANTITY: + return new Integer(getQuantity()); + case CustomerPackageImpl.AN_ORDER__CUSTOMER_ID: + return new Integer(getCustomerID()); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case CustomerPackageImpl.AN_ORDER__ID: + setID(((Integer)newValue).intValue()); + return; + case CustomerPackageImpl.AN_ORDER__PRODUCT: + setProduct((String)newValue); + return; + case CustomerPackageImpl.AN_ORDER__QUANTITY: + setQuantity(((Integer)newValue).intValue()); + return; + case CustomerPackageImpl.AN_ORDER__CUSTOMER_ID: + setCustomerID(((Integer)newValue).intValue()); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case CustomerPackageImpl.AN_ORDER__ID: + unsetID(); + return; + case CustomerPackageImpl.AN_ORDER__PRODUCT: + setProduct(PRODUCT_EDEFAULT); + return; + case CustomerPackageImpl.AN_ORDER__QUANTITY: + unsetQuantity(); + return; + case CustomerPackageImpl.AN_ORDER__CUSTOMER_ID: + unsetCustomerID(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case CustomerPackageImpl.AN_ORDER__ID: + return isSetID(); + case CustomerPackageImpl.AN_ORDER__PRODUCT: + return PRODUCT_EDEFAULT == null ? product != null : !PRODUCT_EDEFAULT.equals(product); + case CustomerPackageImpl.AN_ORDER__QUANTITY: + return isSetQuantity(); + case CustomerPackageImpl.AN_ORDER__CUSTOMER_ID: + return isSetCustomerID(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (iD: "); + if (iDESet) result.append(iD); else result.append(""); + result.append(", product: "); + result.append(product); + result.append(", quantity: "); + if (quantityESet) result.append(quantity); else result.append(""); + result.append(", customerID: "); + if (customerIDESet) result.append(customerID); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //AnOrderImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerFactoryImpl.java new file mode 100644 index 0000000000..00b1ede09c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerFactoryImpl.java @@ -0,0 +1,150 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.customer.impl; + +import org.apache.tuscany.das.rdb.test.customer.*; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class CustomerFactoryImpl extends EFactoryImpl implements CustomerFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + public static final CustomerFactoryImpl eINSTANCE = init(); + + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static CustomerFactoryImpl init() + { + try + { + CustomerFactoryImpl theCustomerFactory = (CustomerFactoryImpl)EPackage.Registry.INSTANCE.getEFactory("http:///org.apache.tuscany.das.rdb.test/customer.xsd"); + if (theCustomerFactory != null) + { + return theCustomerFactory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new CustomerFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public CustomerFactoryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public EObject create(EClass eClass) + { + switch (eClass.getClassifierID()) + { + case CustomerPackageImpl.AN_ORDER: return (EObject)createAnOrder(); + case CustomerPackageImpl.CUSTOMER: return (EObject)createCustomer(); + case CustomerPackageImpl.DATA_GRAPH_ROOT: return (EObject)createDataGraphRoot(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public AnOrder createAnOrder() + { + AnOrderImpl anOrder = new AnOrderImpl(); + return anOrder; + } + + /** + * + * + * @generated + */ + public Customer createCustomer() + { + CustomerImpl customer = new CustomerImpl(); + return customer; + } + + /** + * + * + * @generated + */ + public DataGraphRoot createDataGraphRoot() + { + DataGraphRootImpl dataGraphRoot = new DataGraphRootImpl(); + return dataGraphRoot; + } + + /** + * + * + * @generated + */ + public CustomerPackageImpl getCustomerPackageImpl() + { + return (CustomerPackageImpl)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + public static CustomerPackageImpl getPackage() + { + return CustomerPackageImpl.eINSTANCE; + } + +} //CustomerFactoryImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerImpl.java new file mode 100644 index 0000000000..02be07ac41 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerImpl.java @@ -0,0 +1,395 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.customer.impl; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.das.rdb.test.customer.AnOrder; +import org.apache.tuscany.das.rdb.test.customer.Customer; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Customer'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl#getID ID}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl#getLastName Last Name}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl#getAddress Address}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl#getOrders Orders}
  • + *
+ *

+ * + * @generated + */ +public class CustomerImpl extends DataObjectImpl implements Customer +{ + /** + * The default value of the '{@link #getID() ID}' attribute. + * + * + * @see #getID() + * @generated + * @ordered + */ + protected static final int ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getID() ID}' attribute. + * + * + * @see #getID() + * @generated + * @ordered + */ + protected int iD = ID_EDEFAULT; + + /** + * This is true if the ID attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean iDESet = false; + + /** + * The default value of the '{@link #getLastName() Last Name}' attribute. + * + * + * @see #getLastName() + * @generated + * @ordered + */ + protected static final String LAST_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLastName() Last Name}' attribute. + * + * + * @see #getLastName() + * @generated + * @ordered + */ + protected String lastName = LAST_NAME_EDEFAULT; + + /** + * The default value of the '{@link #getAddress() Address}' attribute. + * + * + * @see #getAddress() + * @generated + * @ordered + */ + protected static final String ADDRESS_EDEFAULT = null; + + /** + * The cached value of the '{@link #getAddress() Address}' attribute. + * + * + * @see #getAddress() + * @generated + * @ordered + */ + protected String address = ADDRESS_EDEFAULT; + + /** + * The cached value of the '{@link #getOrders() Orders}' containment reference list. + * + * + * @see #getOrders() + * @generated + * @ordered + */ + protected EList orders = null; + + /** + * + * + * @generated + */ + protected CustomerImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return CustomerPackageImpl.Literals.CUSTOMER; + } + + /** + * + * + * @generated + */ + public int getID() + { + return iD; + } + + /** + * + * + * @generated + */ + public void setID(int newID) + { + int oldID = iD; + iD = newID; + boolean oldIDESet = iDESet; + iDESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.CUSTOMER__ID, oldID, iD, !oldIDESet)); + } + + /** + * + * + * @generated + */ + public void unsetID() + { + int oldID = iD; + boolean oldIDESet = iDESet; + iD = ID_EDEFAULT; + iDESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CustomerPackageImpl.CUSTOMER__ID, oldID, ID_EDEFAULT, oldIDESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetID() + { + return iDESet; + } + + /** + * + * + * @generated + */ + public String getLastName() + { + return lastName; + } + + /** + * + * + * @generated + */ + public void setLastName(String newLastName) + { + String oldLastName = lastName; + lastName = newLastName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.CUSTOMER__LAST_NAME, oldLastName, lastName)); + } + + /** + * + * + * @generated + */ + public String getAddress() + { + return address; + } + + /** + * + * + * @generated + */ + public void setAddress(String newAddress) + { + String oldAddress = address; + address = newAddress; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CustomerPackageImpl.CUSTOMER__ADDRESS, oldAddress, address)); + } + + /** + * + * + * @generated + */ + public List getOrders() + { + if (orders == null) + { + orders = new EObjectContainmentEList(AnOrder.class, this, CustomerPackageImpl.CUSTOMER__ORDERS); + } + return orders; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case CustomerPackageImpl.CUSTOMER__ORDERS: + return ((InternalEList)getOrders()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case CustomerPackageImpl.CUSTOMER__ID: + return new Integer(getID()); + case CustomerPackageImpl.CUSTOMER__LAST_NAME: + return getLastName(); + case CustomerPackageImpl.CUSTOMER__ADDRESS: + return getAddress(); + case CustomerPackageImpl.CUSTOMER__ORDERS: + return getOrders(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case CustomerPackageImpl.CUSTOMER__ID: + setID(((Integer)newValue).intValue()); + return; + case CustomerPackageImpl.CUSTOMER__LAST_NAME: + setLastName((String)newValue); + return; + case CustomerPackageImpl.CUSTOMER__ADDRESS: + setAddress((String)newValue); + return; + case CustomerPackageImpl.CUSTOMER__ORDERS: + getOrders().clear(); + getOrders().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case CustomerPackageImpl.CUSTOMER__ID: + unsetID(); + return; + case CustomerPackageImpl.CUSTOMER__LAST_NAME: + setLastName(LAST_NAME_EDEFAULT); + return; + case CustomerPackageImpl.CUSTOMER__ADDRESS: + setAddress(ADDRESS_EDEFAULT); + return; + case CustomerPackageImpl.CUSTOMER__ORDERS: + getOrders().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case CustomerPackageImpl.CUSTOMER__ID: + return isSetID(); + case CustomerPackageImpl.CUSTOMER__LAST_NAME: + return LAST_NAME_EDEFAULT == null ? lastName != null : !LAST_NAME_EDEFAULT.equals(lastName); + case CustomerPackageImpl.CUSTOMER__ADDRESS: + return ADDRESS_EDEFAULT == null ? address != null : !ADDRESS_EDEFAULT.equals(address); + case CustomerPackageImpl.CUSTOMER__ORDERS: + return orders != null && !orders.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (iD: "); + if (iDESet) result.append(iD); else result.append(""); + result.append(", lastName: "); + result.append(lastName); + result.append(", address: "); + result.append(address); + result.append(')'); + return result.toString(); + } + +} //CustomerImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerPackageImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerPackageImpl.java new file mode 100644 index 0000000000..ca33c06814 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/CustomerPackageImpl.java @@ -0,0 +1,847 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.customer.impl; + +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.DataGraphRoot; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.apache.tuscany.das.rdb.test.customer.CustomerFactory + * @generated + */ +public class CustomerPackageImpl extends EPackageImpl +{ + /** + * The package name. + * + * + * @generated + */ + public static final String eNAME = "customer"; + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String eNS_URI = "http:///org.apache.tuscany.das.rdb.test/customer.xsd"; + + /** + * The package namespace name. + * + * + * @generated + */ + public static final String eNS_PREFIX = "customer"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + public static final CustomerPackageImpl eINSTANCE = org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl.init(); + + /** + * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl An Order}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl + * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getAnOrder() + * @generated + */ + public static final int AN_ORDER = 0; + + /** + * The feature id for the 'ID' attribute. + * + * + * @generated + * @ordered + */ + public static final int AN_ORDER__ID = 0; + + /** + * The feature id for the 'Product' attribute. + * + * + * @generated + * @ordered + */ + public static final int AN_ORDER__PRODUCT = 1; + + /** + * The feature id for the 'Quantity' attribute. + * + * + * @generated + * @ordered + */ + public static final int AN_ORDER__QUANTITY = 2; + + /** + * The feature id for the 'Customer ID' attribute. + * + * + * @generated + * @ordered + */ + public static final int AN_ORDER__CUSTOMER_ID = 3; + + /** + * The number of structural features of the 'An Order' class. + * + * + * @generated + * @ordered + */ + public static final int AN_ORDER_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl Customer}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl + * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getCustomer() + * @generated + */ + public static final int CUSTOMER = 1; + + /** + * The feature id for the 'ID' attribute. + * + * + * @generated + * @ordered + */ + public static final int CUSTOMER__ID = 0; + + /** + * The feature id for the 'Last Name' attribute. + * + * + * @generated + * @ordered + */ + public static final int CUSTOMER__LAST_NAME = 1; + + /** + * The feature id for the 'Address' attribute. + * + * + * @generated + * @ordered + */ + public static final int CUSTOMER__ADDRESS = 2; + + /** + * The feature id for the 'Orders' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int CUSTOMER__ORDERS = 3; + + /** + * The number of structural features of the 'Customer' class. + * + * + * @generated + * @ordered + */ + public static final int CUSTOMER_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl Data Graph Root}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl + * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getDataGraphRoot() + * @generated + */ + public static final int DATA_GRAPH_ROOT = 2; + + /** + * The feature id for the 'Customers' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int DATA_GRAPH_ROOT__CUSTOMERS = 0; + + /** + * The feature id for the 'Orders' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int DATA_GRAPH_ROOT__ORDERS = 1; + + /** + * The number of structural features of the 'Data Graph Root' class. + * + * + * @generated + * @ordered + */ + public static final int DATA_GRAPH_ROOT_FEATURE_COUNT = 2; + + /** + * + * + * @generated + */ + private EClass anOrderEClass = null; + + /** + * + * + * @generated + */ + private EClass customerEClass = null; + + /** + * + * + * @generated + */ + private EClass dataGraphRootEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#eNS_URI + * @see #init() + * @generated + */ + private CustomerPackageImpl() + { + super(eNS_URI, ((EFactory)CustomerFactory.INSTANCE)); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + *

Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + *

Invocation of this method will not affect any packages that have + * already been initialized. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static CustomerPackageImpl init() + { + if (isInited) return (CustomerPackageImpl)EPackage.Registry.INSTANCE.getEPackage(CustomerPackageImpl.eNS_URI); + + // Obtain or create and register package + CustomerPackageImpl theCustomerPackageImpl = (CustomerPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof CustomerPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new CustomerPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + XMLTypePackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theCustomerPackageImpl.createPackageContents(); + + // Initialize created meta-data + theCustomerPackageImpl.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theCustomerPackageImpl.freeze(); + + return theCustomerPackageImpl; + } + + + /** + * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder An Order}'. + * + * + * @return the meta object for class 'An Order'. + * @see org.apache.tuscany.das.rdb.test.customer.AnOrder + * @generated + */ + public EClass getAnOrder() + { + return anOrderEClass; + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getID ID}'. + * + * + * @return the meta object for the attribute 'ID'. + * @see org.apache.tuscany.das.rdb.test.customer.AnOrder#getID() + * @see #getAnOrder() + * @generated + */ + public EAttribute getAnOrder_ID() + { + return (EAttribute)anOrderEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getProduct Product}'. + * + * + * @return the meta object for the attribute 'Product'. + * @see org.apache.tuscany.das.rdb.test.customer.AnOrder#getProduct() + * @see #getAnOrder() + * @generated + */ + public EAttribute getAnOrder_Product() + { + return (EAttribute)anOrderEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity Quantity}'. + * + * + * @return the meta object for the attribute 'Quantity'. + * @see org.apache.tuscany.das.rdb.test.customer.AnOrder#getQuantity() + * @see #getAnOrder() + * @generated + */ + public EAttribute getAnOrder_Quantity() + { + return (EAttribute)anOrderEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID Customer ID}'. + * + * + * @return the meta object for the attribute 'Customer ID'. + * @see org.apache.tuscany.das.rdb.test.customer.AnOrder#getCustomerID() + * @see #getAnOrder() + * @generated + */ + public EAttribute getAnOrder_CustomerID() + { + return (EAttribute)anOrderEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.customer.Customer Customer}'. + * + * + * @return the meta object for class 'Customer'. + * @see org.apache.tuscany.das.rdb.test.customer.Customer + * @generated + */ + public EClass getCustomer() + { + return customerEClass; + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getID ID}'. + * + * + * @return the meta object for the attribute 'ID'. + * @see org.apache.tuscany.das.rdb.test.customer.Customer#getID() + * @see #getCustomer() + * @generated + */ + public EAttribute getCustomer_ID() + { + return (EAttribute)customerEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getLastName Last Name}'. + * + * + * @return the meta object for the attribute 'Last Name'. + * @see org.apache.tuscany.das.rdb.test.customer.Customer#getLastName() + * @see #getCustomer() + * @generated + */ + public EAttribute getCustomer_LastName() + { + return (EAttribute)customerEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getAddress Address}'. + * + * + * @return the meta object for the attribute 'Address'. + * @see org.apache.tuscany.das.rdb.test.customer.Customer#getAddress() + * @see #getCustomer() + * @generated + */ + public EAttribute getCustomer_Address() + { + return (EAttribute)customerEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.customer.Customer#getOrders Orders}'. + * + * + * @return the meta object for the containment reference list 'Orders'. + * @see org.apache.tuscany.das.rdb.test.customer.Customer#getOrders() + * @see #getCustomer() + * @generated + */ + public EReference getCustomer_Orders() + { + return (EReference)customerEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.das.rdb.test.customer.DataGraphRoot Data Graph Root}'. + * + * + * @return the meta object for class 'Data Graph Root'. + * @see org.apache.tuscany.das.rdb.test.customer.DataGraphRoot + * @generated + */ + public EClass getDataGraphRoot() + { + return dataGraphRootEClass; + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getCustomers Customers}'. + * + * + * @return the meta object for the containment reference list 'Customers'. + * @see org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getCustomers() + * @see #getDataGraphRoot() + * @generated + */ + public EReference getDataGraphRoot_Customers() + { + return (EReference)dataGraphRootEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getOrders Orders}'. + * + * + * @return the meta object for the containment reference list 'Orders'. + * @see org.apache.tuscany.das.rdb.test.customer.DataGraphRoot#getOrders() + * @see #getDataGraphRoot() + * @generated + */ + public EReference getDataGraphRoot_Orders() + { + return (EReference)dataGraphRootEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + public CustomerFactory getCustomerFactory() + { + return (CustomerFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + anOrderEClass = createEClass(AN_ORDER); + createEAttribute(anOrderEClass, AN_ORDER__ID); + createEAttribute(anOrderEClass, AN_ORDER__PRODUCT); + createEAttribute(anOrderEClass, AN_ORDER__QUANTITY); + createEAttribute(anOrderEClass, AN_ORDER__CUSTOMER_ID); + + customerEClass = createEClass(CUSTOMER); + createEAttribute(customerEClass, CUSTOMER__ID); + createEAttribute(customerEClass, CUSTOMER__LAST_NAME); + createEAttribute(customerEClass, CUSTOMER__ADDRESS); + createEReference(customerEClass, CUSTOMER__ORDERS); + + dataGraphRootEClass = createEClass(DATA_GRAPH_ROOT); + createEReference(dataGraphRootEClass, DATA_GRAPH_ROOT__CUSTOMERS); + createEReference(dataGraphRootEClass, DATA_GRAPH_ROOT__ORDERS); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(anOrderEClass, AnOrder.class, "AnOrder", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getAnOrder_ID(), theXMLTypePackage.getInt(), "iD", null, 1, 1, AnOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getAnOrder_Product(), theXMLTypePackage.getString(), "product", null, 1, 1, AnOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getAnOrder_Quantity(), theXMLTypePackage.getInt(), "quantity", null, 1, 1, AnOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getAnOrder_CustomerID(), theXMLTypePackage.getInt(), "customerID", null, 1, 1, AnOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(customerEClass, Customer.class, "Customer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getCustomer_ID(), theXMLTypePackage.getInt(), "iD", null, 1, 1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCustomer_LastName(), theXMLTypePackage.getString(), "lastName", null, 1, 1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCustomer_Address(), theXMLTypePackage.getString(), "address", null, 1, 1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getCustomer_Orders(), this.getAnOrder(), null, "orders", null, 1, -1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(dataGraphRootEClass, DataGraphRoot.class, "DataGraphRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getDataGraphRoot_Customers(), this.getCustomer(), null, "customers", null, 0, -1, DataGraphRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDataGraphRoot_Orders(), this.getAnOrder(), null, "orders", null, 0, -1, DataGraphRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http:///org/eclipse/emf/ecore/util/ExtendedMetaData + createExtendedMetaDataAnnotations(); + } + + /** + * Initializes the annotations for http:///org/eclipse/emf/ecore/util/ExtendedMetaData. + * + * + * @generated + */ + protected void createExtendedMetaDataAnnotations() + { + String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; + addAnnotation + (anOrderEClass, + source, + new String[] + { + "name", "AnOrder", + "kind", "elementOnly" + }); + addAnnotation + (getAnOrder_ID(), + source, + new String[] + { + "kind", "element", + "name", "ID" + }); + addAnnotation + (getAnOrder_Product(), + source, + new String[] + { + "kind", "element", + "name", "Product" + }); + addAnnotation + (getAnOrder_Quantity(), + source, + new String[] + { + "kind", "element", + "name", "Quantity" + }); + addAnnotation + (getAnOrder_CustomerID(), + source, + new String[] + { + "kind", "element", + "name", "Customer_ID" + }); + addAnnotation + (customerEClass, + source, + new String[] + { + "name", "Customer", + "kind", "elementOnly" + }); + addAnnotation + (getCustomer_ID(), + source, + new String[] + { + "kind", "element", + "name", "ID" + }); + addAnnotation + (getCustomer_LastName(), + source, + new String[] + { + "kind", "element", + "name", "lastName" + }); + addAnnotation + (getCustomer_Address(), + source, + new String[] + { + "kind", "element", + "name", "address" + }); + addAnnotation + (getCustomer_Orders(), + source, + new String[] + { + "kind", "element", + "name", "orders" + }); + addAnnotation + (dataGraphRootEClass, + source, + new String[] + { + "name", "DataGraphRoot", + "kind", "elementOnly" + }); + addAnnotation + (getDataGraphRoot_Customers(), + source, + new String[] + { + "kind", "element", + "name", "customers" + }); + addAnnotation + (getDataGraphRoot_Orders(), + source, + new String[] + { + "kind", "element", + "name", "orders" + }); + } + + /** + * + * Defines literals for the meta objects that represent + *

    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + public interface Literals + { + /** + * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl An Order}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.customer.impl.AnOrderImpl + * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getAnOrder() + * @generated + */ + public static final EClass AN_ORDER = eINSTANCE.getAnOrder(); + + /** + * The meta object literal for the 'ID' attribute feature. + * + * + * @generated + */ + public static final EAttribute AN_ORDER__ID = eINSTANCE.getAnOrder_ID(); + + /** + * The meta object literal for the 'Product' attribute feature. + * + * + * @generated + */ + public static final EAttribute AN_ORDER__PRODUCT = eINSTANCE.getAnOrder_Product(); + + /** + * The meta object literal for the 'Quantity' attribute feature. + * + * + * @generated + */ + public static final EAttribute AN_ORDER__QUANTITY = eINSTANCE.getAnOrder_Quantity(); + + /** + * The meta object literal for the 'Customer ID' attribute feature. + * + * + * @generated + */ + public static final EAttribute AN_ORDER__CUSTOMER_ID = eINSTANCE.getAnOrder_CustomerID(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl Customer}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerImpl + * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getCustomer() + * @generated + */ + public static final EClass CUSTOMER = eINSTANCE.getCustomer(); + + /** + * The meta object literal for the 'ID' attribute feature. + * + * + * @generated + */ + public static final EAttribute CUSTOMER__ID = eINSTANCE.getCustomer_ID(); + + /** + * The meta object literal for the 'Last Name' attribute feature. + * + * + * @generated + */ + public static final EAttribute CUSTOMER__LAST_NAME = eINSTANCE.getCustomer_LastName(); + + /** + * The meta object literal for the 'Address' attribute feature. + * + * + * @generated + */ + public static final EAttribute CUSTOMER__ADDRESS = eINSTANCE.getCustomer_Address(); + + /** + * The meta object literal for the 'Orders' containment reference list feature. + * + * + * @generated + */ + public static final EReference CUSTOMER__ORDERS = eINSTANCE.getCustomer_Orders(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl Data Graph Root}' class. + * + * + * @see org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl + * @see org.apache.tuscany.das.rdb.test.customer.impl.CustomerPackageImpl#getDataGraphRoot() + * @generated + */ + public static final EClass DATA_GRAPH_ROOT = eINSTANCE.getDataGraphRoot(); + + /** + * The meta object literal for the 'Customers' containment reference list feature. + * + * + * @generated + */ + public static final EReference DATA_GRAPH_ROOT__CUSTOMERS = eINSTANCE.getDataGraphRoot_Customers(); + + /** + * The meta object literal for the 'Orders' containment reference list feature. + * + * + * @generated + */ + public static final EReference DATA_GRAPH_ROOT__ORDERS = eINSTANCE.getDataGraphRoot_Orders(); + + } + +} //CustomerPackageImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/DataGraphRootImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/DataGraphRootImpl.java new file mode 100644 index 0000000000..30fc8181a2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/customer/impl/DataGraphRootImpl.java @@ -0,0 +1,213 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.customer.impl; + +import java.util.Collection; +import java.util.List; + +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.DataGraphRoot; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Data Graph Root'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl#getCustomers Customers}
  • + *
  • {@link org.apache.tuscany.das.rdb.test.customer.impl.DataGraphRootImpl#getOrders Orders}
  • + *
+ *

+ * + * @generated + */ +public class DataGraphRootImpl extends DataObjectImpl implements DataGraphRoot +{ + /** + * The cached value of the '{@link #getCustomers() Customers}' containment reference list. + * + * + * @see #getCustomers() + * @generated + * @ordered + */ + protected EList customers = null; + + /** + * The cached value of the '{@link #getOrders() Orders}' containment reference list. + * + * + * @see #getOrders() + * @generated + * @ordered + */ + protected EList orders = null; + + /** + * + * + * @generated + */ + protected DataGraphRootImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return CustomerPackageImpl.Literals.DATA_GRAPH_ROOT; + } + + /** + * + * + * @generated + */ + public List getCustomers() + { + if (customers == null) + { + customers = new EObjectContainmentEList(Customer.class, this, CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS); + } + return customers; + } + + /** + * + * + * @generated + */ + public List getOrders() + { + if (orders == null) + { + orders = new EObjectContainmentEList(AnOrder.class, this, CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS); + } + return orders; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS: + return ((InternalEList)getCustomers()).basicRemove(otherEnd, msgs); + case CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS: + return ((InternalEList)getOrders()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS: + return getCustomers(); + case CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS: + return getOrders(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS: + getCustomers().clear(); + getCustomers().addAll((Collection)newValue); + return; + case CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS: + getOrders().clear(); + getOrders().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS: + getCustomers().clear(); + return; + case CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS: + getOrders().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case CustomerPackageImpl.DATA_GRAPH_ROOT__CUSTOMERS: + return customers != null && !customers.isEmpty(); + case CustomerPackageImpl.DATA_GRAPH_ROOT__ORDERS: + return orders != null && !orders.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //DataGraphRootImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java new file mode 100644 index 0000000000..e696c8dd6b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/BookData.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + + +public class BookData extends TestDataWithExplicitColumns { + + //CREATE TABLE BOOK (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), AUTHOR VARCHAR(30), QUANTITY INT, OCC INTEGER) + + private static int[] bookTypes = {Types.INTEGER, Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.INTEGER}; + + private static Object[][] bookData = { + { new Integer(1), "The Brothers Karamazov", "Fyodor Dostoevsky", new Integer(5), new Integer(17) }, + { new Integer(2), "Cat in the Hat", "Doctor Seuss", new Integer(10), new Integer(1) }}; + + private static String[] bookColumns = { "BOOK_ID", "NAME", "AUTHOR", "QUANTITY", "OCC"}; + + public BookData(Connection connection) { + super(connection, bookData, bookColumns, bookTypes); + } + + public String getTableName() { + return "BOOK"; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java new file mode 100644 index 0000000000..0ebbd6c5af --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CityData.java @@ -0,0 +1,54 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + + +public class CityData extends TestData { + + private static Object[][] cityData = { + {new Integer(1), "Lizard Lick", "1"}, + {new Integer(2), "Morrisville", "1"}, + {new Integer(3), "Breckenridge", "2"}, + {new Integer(4), "Barstow", "3"}, + {new Integer(5), "Sacramento", "3"} + + }; + + public CityData(Connection c) { + super(c, cityData); + } + + public String getTableName() { + return "CITIES"; + } + + public void doDeletes() throws SQLException { + deleteRowsFromTable(); + + } + + public void doInserts() throws SQLException { + insertRows(); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java new file mode 100644 index 0000000000..9c49004ba5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyData.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + + +public class CompanyData extends TestDataWithExplicitColumns { + + //CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ,NAME VARCHAR(30)) + + private static int[] columnTypes = {Types.VARCHAR}; + + private static Object[][] companyData = { { "ACME Publishing" }, + { "Do-rite plumbing" }, + { "MegaCorp" } }; + + private static String[] companyColumns = { "NAME" }; + + public CompanyData(Connection connection) { + super(connection, companyData, companyColumns, columnTypes); + } + + public String getTableName() { + return "COMPANY"; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java new file mode 100644 index 0000000000..66d0c25369 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyDeptData.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.RelationshipData; + + +public class CompanyDeptData extends RelationshipData { + + public static Object[][] data = { + {"MegaCorp", "Advanced Technologies"} + }; + + public CompanyDeptData(Connection c) { + super(c, data); + } + + protected String getParentRetrievalStatement() { + return "select id from company where name = ?"; + } + + protected String getChildUpdateStatement() { + return "update department set companyid = ? where department.name = ?"; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java new file mode 100644 index 0000000000..300bf57260 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CompanyEmpData.java @@ -0,0 +1,44 @@ + +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.RelationshipData; + + +public class CompanyEmpData extends RelationshipData { + + public static Object[][] data = { + {"Mary Smith", "ACME Publishing" }, + {"Jane Doe", "Do-rite plumbing"}, + {"Al Smith", "MegaCorp"}}; + + public CompanyEmpData(Connection c) { + super(c, data); + } + + protected String getParentRetrievalStatement() { + return "select employee.id from employee where employee.name = ?"; + } + + protected String getChildUpdateStatement() { + return "update company set company.eotmid = ? where company.name = ?"; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java new file mode 100644 index 0000000000..149bcfc71b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/CustomerData.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + + +public class CustomerData extends TestData { + + private static Object[][] customerData = { + {new Integer(1), "Williams", "1212 foobar lane"}, + {new Integer(2), "Daniel", "156 Brentfield Loop"}, + {new Integer(3), "Williams", "456 penny lane"}, + {new Integer(4), "Williams", "5000 pineville"}, + {new Integer(5), "Williams", "100000 firefly lane"} + }; + + public CustomerData(Connection connection) { + super(connection, customerData); + } + + + public String getTableName() { + return "CUSTOMER"; + } + + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java new file mode 100644 index 0000000000..fbd9cf7cab --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepEmpData.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.RelationshipData; + + +public class DepEmpData extends RelationshipData { + + private static Object[][] data = { + {"Advanced Technologies", "John Jones"}, + {"Advanced Technologies", "Jane Doe"}, + {"Advanced Technologies", "Al Smith"} + }; + + + public DepEmpData(Connection c) { + super(c, data); + } + + protected String getParentRetrievalStatement() { + return "select department.id from department where department.name = ?"; + } + + protected String getChildUpdateStatement() { + return "update employee set employee.departmentid = ? where employee.name = ?"; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java new file mode 100644 index 0000000000..d3c10affdd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/DepartmentData.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + + +public class DepartmentData extends TestDataWithExplicitColumns { + + private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR}; + + private static Object[][] deptData = { { "Advanced Technologies", "NY", "123" } }; + + private static String[] deptColumns = { "NAME", "LOCATION", "NUMBER" }; + + public DepartmentData(Connection connection) { + super(connection, deptData, deptColumns, columnTypes); + } + + public String getTableName() { + return "DEPARTMENT"; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java new file mode 100644 index 0000000000..f9dffc9360 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/EmployeeData.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + + +public class EmployeeData extends TestDataWithExplicitColumns { + + private static int[] columnTypes = {Types.VARCHAR, Types.VARCHAR, Types.SMALLINT}; + + private static Object[][] employeeData = { + { "John Jones", "E0001", new Boolean(false) }, + { "Mary Smith", "E0002", new Boolean(true)}, + { "Jane Doe", "E0003", new Boolean(false)}, + { "Al Smith", "E0004", new Boolean(true) } }; + + private static String[] employeeColumns = { "NAME", "SN", "MANAGER" }; + + public EmployeeData(Connection connection) { + super(connection, employeeData, employeeColumns, columnTypes); + } + + public String getTableName() { + return "EMPLOYEE"; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java new file mode 100644 index 0000000000..e6a52204f8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderData.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + + +public class OrderData extends TestData { + + + public static Object[][] orderData = { + {new Integer(1), "recombobulator", new Integer(47), new Integer(1)}, + {new Integer(2), "wrench", new Integer(17), new Integer(3)}, + {new Integer(3), "pliers", new Integer(500), new Integer(1)}, + {new Integer(4), "Tooth Paste", new Integer(12), new Integer(2)} + }; + + public OrderData(Connection c) { + super(c, orderData); + } + + public String getTableName() { + return "ANORDER"; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java new file mode 100644 index 0000000000..9193f7c6d5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/OrderDetailsData.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + + +public class OrderDetailsData extends TestData { + + //CREATE TABLE ORDERDETAILS (ORDERID INT NOT NULL, PRODUCTID INT NOT NULL, PRICE FLOAT, PRIMARY KEY (ORDERID, PRODUCTID)) + + public static Object[][] orderDetailsData = { + {new Integer(1), new Integer(1), new Float(1.1)}, + {new Integer(1), new Integer(2), new Float(1.2)}, + {new Integer(2), new Integer(1), new Float(2.1)}, + {new Integer(2), new Integer(2), new Float(2.2)} + }; + + public OrderDetailsData(Connection c) { + super(c, orderDetailsData); + } + + public String getTableName() { + return "ORDERDETAILS"; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java new file mode 100644 index 0000000000..dd78b1be35 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/PartData.java @@ -0,0 +1,52 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Types; + +import org.apache.tuscany.das.rdb.test.framework.TestDataWithExplicitColumns; + + +public class PartData extends TestDataWithExplicitColumns { + + + //CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT ) + + private static String[] partColumns = { "ID" , "NAME", "QUANTITY", "PARENT_ID"}; + + private static int[] columnTypes = {Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.INTEGER}; + + private static Object[][] partData = { + {new Integer(1), "Engine", new Integer(1), null}, + {new Integer(2), "Block", new Integer(1), new Integer(1)}, + {new Integer(3), "Cam Shaft", new Integer(2), new Integer(1)}, + {new Integer(4), "Piston", new Integer(8), new Integer(1)}, + {new Integer(5), "Piston Ring", new Integer(2), new Integer(4)} + }; + + public PartData(Connection connection) { + super(connection, partData, partColumns, columnTypes); + } + + public String getTableName() { + return "PART"; + } + +} + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java new file mode 100644 index 0000000000..0c6d41d096 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/StateData.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + + +public class StateData extends TestData { + + public StateData(Connection c) { + super(c, stateData); + } + + public String getTableName() { + return "STATES"; + } + + private static Object[][] stateData = { + {new Integer(1), "NC"}, + {new Integer(2), "CO"}, + {new Integer(3), "CA"} + }; + + public void doDeletes() throws SQLException { + deleteRowsFromTable(); + } + + public void doInserts() throws SQLException { + insertRows(); + + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java new file mode 100644 index 0000000000..1097b07cc5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/data/TypesData.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.data; + +import java.sql.Connection; +import java.sql.Timestamp; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.apache.tuscany.das.rdb.test.framework.TestData; + + +public class TypesData extends TestData { + + private static DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:ss:mm.SSS"); + private static Timestamp timestamp = getTimestamp(); + + private static Object[][] customerData = { + {new Integer(1), timestamp, new Float(1234567.89), new Float(1234567.89)} + }; + + public TypesData(Connection connection) { + super(connection, customerData); + } + + public String getTableName() { + return "TYPETEST"; + } + + + //Utilities + private static Date getDate() { + + try { + return dateFormat.parse("1966-12-20 00:00:00.0"); + } catch (ParseException e) { + throw new RuntimeException(e); + } + + } + + public static Timestamp getTimestamp() { + + return new Timestamp(getDate().getTime()); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java new file mode 100644 index 0000000000..75df028490 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DB2Setup.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.framework; + +import junit.framework.Test; + +public class DB2Setup extends DatabaseSetup { + + public DB2Setup(Test test) { + super(test); + } + + protected void initConnectionProtocol() { + + platformName = "DB2"; + driverName = "com.ibm.db2.jcc.DB2Driver"; + databaseURL = "jdbc:db2:DASTEST"; + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java new file mode 100644 index 0000000000..c4e75d20a8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DasTest.java @@ -0,0 +1,155 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.framework; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.util.Iterator; +import java.util.List; + +import junit.framework.TestCase; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; + +/** + * + */ +public class DasTest extends TestCase { + + public static Connection connection = null; + private boolean usingDefaultSetup = false; + + /** + * Tears down the fixture, for example, close a network connection. This + * method is called after a test is executed. + */ + protected void tearDown() throws Exception { +// if (usingDefaultSetup) +// connection = null; + } + + protected Connection getAutoConnection() throws SQLException { + + Connection c = primGetConnection(); + c.setAutoCommit(true); + return connection; + + } + + protected Connection getConnection() throws SQLException { + + Connection c = primGetConnection(); + c.setAutoCommit(false); + return connection; + } + + /** + * This provides the default connection for runing single test cases on a + * chosen platform. + */ + private Connection primGetConnection() { + if (connection == null) + defaultSetup(); + return connection; + } + + + + /** + * This is a bit of a hack since it counts on constructor initialization of the + * DatabaseSet up class and also calls its setUp method directly. This is a misuse + * of this JUnit TestSetup subclass . + * + * TODO - refactor to avoid this hackiness ... could move this logic to its own + * class that is then invoked by DatabaseSetUp + */ + private void defaultSetup() { + + usingDefaultSetup = true; + +// DatabaseSetup setUp = new DB2Setup(this); + DatabaseSetup setUp = new DerbySetup(this); + try { + setUp.setUp(); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } + + + //Utilities + protected InputStream getConfig(String fileName) throws FileNotFoundException { + return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); + } + + protected void write(String label, ResultSet rs) throws IOException, SQLException { + + ResultSetMetaData md = rs.getMetaData(); + int count = md.getColumnCount(); + System.out.println("Contents of ResultSet from " + label); + for (int i = 1; i <= count; i++) { + System.out.print("\t"); + System.out.println (md.getColumnLabel(i)); + } + System.out.println(""); + while (rs.next()) { + for (int i = 1; i <= count; i++) { + System.out.print("\t"); + System.out.print(rs.getString(i)); + } + System.out.println("\t"); + } + System.out.println("done"); + } + + + protected void printList(List data) { + Iterator i = data.iterator(); + while ( i.hasNext()) { + System.out.println(); + DataObject obj = (DataObject) i.next(); + Iterator props = obj.getType().getProperties().iterator(); + while ( props.hasNext()) { + Property p = (Property) props.next(); + if ( p.isMany() ) { + System.out.print("[ " + p.getName() + " ] "); + Iterator children = obj.getList(p).iterator(); + while ( children.hasNext()) { + DataObject child = (DataObject) children.next(); + System.out.print("[ " + child.get("ID") + " ]"); + } + System.out.println(); + } else if ( !p.getType().isDataType()) { + DataObject child = obj.getDataObject(p); + if ( child != null ) + System.out.println("[ " + p.getName() + " ] " + "[ " + child.get("ID") + " ]"); + } else { + System.out.println("[ " + p.getName() + " ] " + obj.get(p)); + } + } + } + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java new file mode 100644 index 0000000000..f0c5223cf0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DatabaseSetup.java @@ -0,0 +1,238 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.framework; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; + +import junit.extensions.TestSetup; +import junit.framework.Test; + +public class DatabaseSetup extends TestSetup { + + protected String platformName = "Not initialized"; + + protected String driverName = "Not initialized"; + + protected String databaseURL = "Not initialized"; + + private Connection connection; + + protected Statement s; + + public DatabaseSetup(Test test) { + super(test); + initConnectionProtocol(); + initConnection(); + DasTest.connection = connection; + } + + protected void initConnectionProtocol() { + // Subclasses provide implementation + } + + private void initConnection() { + + try { + + Class.forName(driverName).newInstance(); + connection = DriverManager.getConnection(databaseURL); + connection.setAutoCommit(false); + + } catch (Exception e) { + if (e instanceof SQLException) + ((SQLException) e).getNextException().printStackTrace(); + throw new RuntimeException(e); + } + + } + + protected void setUp() throws Exception { + + System.out.println("Setting up for " + platformName + " run"); + + s = connection.createStatement(); + + try { + dropTables(); + dropProcedures(); + createTables(); + createProcedures(); + connection.commit(); + } catch (SQLException e) { + connection.rollback(); + } + + } + + protected void tearDown() throws Exception { + + System.out.println("Ending " + platformName + " run"); + connection.close(); + + } + + private void dropTables() { + +// System.out.println("Dropping tables"); + + String[] statements = { + + "DROP TABLE CUSTOMER", "DROP TABLE ANORDER", "DROP TABLE ORDERDETAILS", "DROP TABLE ITEM", + "DROP TABLE COMPANY", "DROP TABLE EMPLOYEE", "DROP TABLE DEPARTMENT", "DROP TABLE BOOK", + "DROP TABLE PART", "DROP TABLE TYPETEST", "DROP TABLE CITIES", "DROP TABLE STATES", + "DROP TABLE conmgt.SERVERSTATUS" + + }; + + for (int i = 0; i < statements.length; i++) { + try { + s.execute(statements[i]); + } catch (SQLException e) { + // If the table does not exist then ignore the exception on drop + if (!e.getMessage().contains("does not exist")) + throw new RuntimeException(e); + } + } + } + + protected void dropProcedures() { + +// System.out.println("Dropping procedures"); + + String[] statements = { + + "DROP PROCEDURE GETALLCOMPANIES", "DROP PROCEDURE DELETECUSTOMER", "DROP PROCEDURE GETNAMEDCOMPANY", + "DROP PROCEDURE GETCUSTOMERANDORDERS", "DROP PROCEDURE GETNAMEDCUSTOMERS" + + }; + + for (int i = 0; i < statements.length; i++) { + try { + s.execute(statements[i]); + } catch (SQLException e) { + // If the proc does not exist then ignore the exception on drop + if (!e.getMessage().contains("does not exist")) + throw new RuntimeException(e); + } + } + } + + private void createTables() { + +// System.out.println("Creating tables"); + + try { + + s.execute(getCreateCustomer()); + s.execute(getCreateAnOrder()); + s.execute(getCreateOrderDetails()); + s.execute(getCreateItem()); + s.execute(getCreateCompany()); + s.execute(getCreateEmployee()); + s.execute(getCreateDepartment()); + s.execute(getCreateBook()); + s.execute(getCreatePart()); + s.execute(getCreateTypeTest()); + s.execute(getCreateStates()); + s.execute(getCreateCities()); + s.execute(getCreateServerStatus()); + + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + protected void createProcedures() { + +// System.out.println("Creating procedures"); + try { + + s.execute("CREATE PROCEDURE GETALLCOMPANIES() PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getAllCompanies'"); + s.execute("CREATE PROCEDURE DELETECUSTOMER(theId int) PARAMETER STYLE JAVA LANGUAGE JAVA MODIFIES SQL DATA EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.deleteCustomer'"); + s.execute("CREATE PROCEDURE GETNAMEDCOMPANY(theName VARCHAR(100)) PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getNamedCompany'"); + s.execute("CREATE PROCEDURE GETCUSTOMERANDORDERS(theID INTEGER) PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getCustomerAndOrders'"); + s.execute("CREATE PROCEDURE GETNAMEDCUSTOMERS(theName VARCHAR(100), OUT theCount INTEGER) PARAMETER STYLE JAVA LANGUAGE JAVA READS SQL DATA DYNAMIC RESULT SETS 1 EXTERNAL NAME 'org.apache.tuscany.das.rdb.test.framework.JavaStoredProcs.getNamedCustomers'"); + // TODO - "GETNAMEDCUSTOMERS" is failing on DB2 with SQLCODE: 42723. Need to investigate + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + // + // This section povides methods that return strings for table creation. + // Platform-specific sublcasses + // can override these as necessary + // + + protected String getCreateCustomer() { + return "CREATE TABLE CUSTOMER (ID INT PRIMARY KEY NOT NULL, LASTNAME VARCHAR(30) DEFAULT 'Garfugengheist', ADDRESS VARCHAR(30))"; + } + + protected String getCreateAnOrder() { + return "CREATE TABLE ANORDER (ID INT PRIMARY KEY NOT NULL, PRODUCT VARCHAR(30), QUANTITY INT, CUSTOMER_ID INT)"; + } + + protected String getCreateOrderDetails() { + return "CREATE TABLE ORDERDETAILS (ORDERID INT NOT NULL, PRODUCTID INT NOT NULL, PRICE FLOAT, PRIMARY KEY (ORDERID, PRODUCTID))"; + } + + protected String getCreateItem() { + return "CREATE TABLE ITEM (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(30))"; + } + + protected String getCreateCompany() { + return "CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY ,NAME VARCHAR(30), EOTMID INT)"; + } + + protected String getCreateEmployee() { + return "CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME VARCHAR(30), SN VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)"; + } + + protected String getCreateDepartment() { + return "CREATE TABLE DEPARTMENT (ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), COMPANYID INT)"; + } + + protected String getCreateBook() { + return "CREATE TABLE BOOK (BOOK_ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), AUTHOR VARCHAR(30), QUANTITY INT, OCC INTEGER)"; + } + + protected String getCreatePart() { + return "CREATE TABLE PART (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), QUANTITY INT, PARENT_ID INT )"; + } + + protected String getCreateTypeTest() { + return "CREATE TABLE TYPETEST (ID INT PRIMARY KEY NOT NULL, ATIMESTAMP TIMESTAMP, ADECIMAL DECIMAL(9,2), AFLOAT FLOAT)"; + } + + protected String getCreateStates() { + return "CREATE TABLE STATES (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(2))"; + } + + protected String getCreateCities() { + return "CREATE TABLE CITIES (ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), STATE_ID INT, CONSTRAINT FK1 FOREIGN KEY (STATE_ID) REFERENCES STATES (ID) ON DELETE NO ACTION ON UPDATE NO ACTION)"; + } + + protected String getCreateServerStatus() { + + return "CREATE TABLE CONMGT.SERVERSTATUS (STATUSID INTEGER PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1 ,INCREMENT BY 1), MANAGEDSERVERID INTEGER NOT NULL, TIMESTAMP TIMESTAMP NOT NULL)"; + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java new file mode 100644 index 0000000000..082b1ec50a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/DerbySetup.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.framework; + +import java.util.Properties; + +import junit.framework.Test; + +public class DerbySetup extends DatabaseSetup { + + public DerbySetup(Test test) { + super(test); + } + + protected void initConnectionProtocol() { + + //Set the derby property to explicitly specify the database location relative + //from current directory to "target" + Properties p = System.getProperties(); + p.put("derby.system.home", "target"); + + platformName = "Derby"; + driverName = "org.apache.derby.jdbc.EmbeddedDriver"; + databaseURL = "jdbc:derby:dastest; create = true"; + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java new file mode 100644 index 0000000000..cd314e0fce --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/JavaStoredProcs.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.framework; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * Stored Procedures for DB2 and Derby SP tests + * + */ +public class JavaStoredProcs { + + public static void getAllCompanies(ResultSet[] results) throws SQLException { + + Connection conn = DriverManager.getConnection("jdbc:default:connection"); + PreparedStatement ps = conn.prepareStatement("SELECT * FROM COMPANY"); + results[0] = ps.executeQuery(); + } + + public static void deleteCustomer(int theId) throws SQLException { + + Connection conn = DriverManager.getConnection("jdbc:default:connection"); + PreparedStatement ps = conn.prepareStatement("DELETE FROM CUSTOMER WHERE ID = ?"); + ps.setInt(1, theId); + ps.execute(); + + } + + public static void getNamedCompany(String theName, ResultSet[] results) throws SQLException { + + Connection conn = DriverManager.getConnection("jdbc:default:connection"); + PreparedStatement ps = conn.prepareStatement("SELECT * FROM COMPANY WHERE NAME = ?"); + ps.setString(1, theName); + results[0] = ps.executeQuery(); + } + + public static void getCustomerAndOrders(int theId, ResultSet[] results) throws SQLException { + + Connection conn = DriverManager.getConnection("jdbc:default:connection"); + PreparedStatement ps = conn + .prepareStatement("SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = ?"); + ps.setInt(1, theId); + results[0] = ps.executeQuery(); + } + + public static void getNamedCustomers(String theName, int[] outCount, ResultSet[] results) throws SQLException { + + Connection conn = DriverManager.getConnection("jdbc:default:connection"); + PreparedStatement ps = conn.prepareStatement("SELECT * FROM CUSTOMER WHERE LASTNAME = ?"); + ps.setString(1, theName); + results[0] = ps.executeQuery(); + + ps = conn.prepareStatement("SELECT COUNT(*) FROM CUSTOMER WHERE LASTNAME = ?"); + ps.setString(1, theName); + + ResultSet rs = ps.executeQuery(); + rs.next(); + outCount[0] = rs.getInt(1); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java new file mode 100644 index 0000000000..b3616882f4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/MySQLSetup.java @@ -0,0 +1,96 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.framework; + +import java.sql.SQLException; + + +import junit.framework.Test; + +public class MySQLSetup extends DatabaseSetup { + + public MySQLSetup(Test test) { + super(test); + } + + protected void initConnectionProtocol() { + + platformName = "MySQL"; + driverName = "com.mysql.jdbc.Driver"; + databaseURL = "jdbc:mysql:///dastest?user=dastester&password=dastester"; + + } + + + protected void createProcedures () { + + String createGetAllCompanies = + "CREATE PROCEDURE `dastest`.`GETALLCOMPANIES` () "+ + " SELECT * FROM COMPANY "; + + + String createDeleteCustomer = + "CREATE PROCEDURE `dastest`.`DELETECUSTOMER` (theId INT) " + + " DELETE FROM CUSTOMER WHERE ID = theId "; + + + String createGetNamedCustomers = + "CREATE PROCEDURE `dastest`.`GETNAMEDCUSTOMERS`(IN thename VARCHAR(30), OUT theCount INTEGER ) " + + " BEGIN " + + " SELECT * FROM CUSTOMER AS CUSTOMER WHERE LASTNAME = theName; " + + " SET theCount = (SELECT COUNT(*) FROM CUSTOMER WHERE LASTNAME = theName); " + + " END "; + + String createGetCustomerAndOrders = + " CREATE PROCEDURE `dastest`.`GETCUSTOMERANDORDERS` (theId INT) " + + " SELECT * FROM CUSTOMER LEFT JOIN ANORDER ON CUSTOMER.ID = ANORDER.CUSTOMER_ID WHERE CUSTOMER.ID = theId "; + + + String createGetNamedCompany = + " CREATE PROCEDURE `dastest`.`GETNAMEDCOMPANY` (theName VARCHAR(100)) " + + " SELECT * FROM COMPANY WHERE NAME = theName"; + + System.out.println("Creating procedures"); + try { + + s.execute(createGetAllCompanies); + s.execute(createDeleteCustomer); + s.execute(createGetNamedCompany); + s.execute(createGetCustomerAndOrders); +// s.execute(createGetNamedCustomers); +//TODO - add this back after DB2 problem is resolved + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + + //Overrides for table creation + protected String getCreateCompany() { + return "CREATE TABLE COMPANY (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30))"; + } + protected String getCreateEmployee() { + return "CREATE TABLE EMPLOYEE (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30), SN VARCHAR(10), MANAGER SMALLINT, DEPARTMENTID INT)"; + } + protected String getCreateDepartment() { + return "CREATE TABLE DEPARTMENT (ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NAME VARCHAR(30), LOCATION VARCHAR(30), NUMBER VARCHAR(10), COMPANYID INT, EOTM INT)"; + } + protected String getCreateTypeTest() { + return "CREATE TABLE TYPETEST (ID INT PRIMARY KEY NOT NULL, ATIMESTAMP DATETIME, ADECIMAL DECIMAL(9,2), AFLOAT FLOAT)"; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java new file mode 100644 index 0000000000..330320656e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/RelationshipData.java @@ -0,0 +1,81 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.framework; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public abstract class RelationshipData { + protected Object[][] data; + private int currentRow = -1; + protected Connection connection; + + + public RelationshipData(Connection c, Object[][] inputData) { + this.connection = c; + this.data = inputData; + } + + public int size() { + return data[0].length; + } + + public int numberOfRows() { + return data.length; + } + + public boolean next() { + ++currentRow; + if ( currentRow < numberOfRows() ) + return true; + else + return false; + } + + + public void refresh() throws SQLException { + updateRelationships(); + } + + protected abstract String getParentRetrievalStatement(); + protected abstract String getChildUpdateStatement(); + + + protected void updateRelationships() throws SQLException { + // { MegaCorp, Advanced Technologies } + // select company.id from company where company.name = ? + PreparedStatement retrieveParent = connection.prepareStatement(getParentRetrievalStatement()); + // update department set department.companyid = ? where department.name = ? + PreparedStatement updateChild = connection.prepareStatement(getChildUpdateStatement()); + + while ( next() ) { + retrieveParent.setObject(1, data[currentRow][0]); + retrieveParent.execute(); + ResultSet rs = retrieveParent.getResultSet(); + rs.next(); + Object parentID = rs.getObject(1); + retrieveParent.clearParameters(); + + updateChild.setObject(1, parentID); + updateChild.setObject(2, data[currentRow][1]); + updateChild.execute(); + updateChild.clearParameters(); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java new file mode 100644 index 0000000000..686433bfc8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestData.java @@ -0,0 +1,87 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.framework; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public abstract class TestData { + + protected Object[][] data; + private int currentRow = -1; + protected Connection connection; + + + public TestData(Connection c, Object[][] customerData) { + this.connection = c; + this.data = customerData; + } + + public int size() { + return data[0].length; + } + + public int numberOfRows() { + return data.length; + } + + public boolean next() { + ++currentRow; + if ( currentRow < numberOfRows() ) + return true; + else + return false; + } + + public abstract String getTableName(); + + + public Object getObject(int i) { + return data[currentRow][i-1]; + } + + public void refresh() throws SQLException { + deleteRowsFromTable(); + insertRows(); + } + + protected void deleteRowsFromTable() throws SQLException { + PreparedStatement ps = connection.prepareStatement("delete from " + getTableName()); + ps.execute(); + } + + protected void insertRows() throws SQLException { + StringBuffer sql = new StringBuffer(); + sql.append("insert into "); + sql.append(getTableName()); + sql.append(" values ("); + for ( int i=1; i < size(); i++) { + sql.append("?,"); + } + sql.append("?)"); + PreparedStatement ps = connection.prepareStatement(sql.toString()); + + while ( next() ) { + for ( int i=1; i <= size(); i++ ) { + ps.setObject(i, getObject(i)); + } + ps.execute(); + ps.clearParameters(); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java new file mode 100644 index 0000000000..8ded99af9b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/framework/TestDataWithExplicitColumns.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.framework; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +import org.apache.tuscany.das.rdb.util.DebugUtil; + + +public abstract class TestDataWithExplicitColumns extends TestData { + + protected String[] columns; + protected int[] sqlTypes; + + private static boolean debug = false; + + public TestDataWithExplicitColumns(Connection c, Object[][] data, + String[] columns, int[] sqlTypes) { + super(c, data); + this.columns = columns; + this.sqlTypes = sqlTypes; + } + + private String getColumn(int i) { + return columns[i - 1]; + } + + private int getSqlType(int i) { + return (sqlTypes[i - 1]); + } + + // Create an insert statement of the following form ... + // "INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....)" + // This is necessary for tables with a generated column since the PK value is not provided + protected void insertRows() throws SQLException { + StringBuffer sql = new StringBuffer(); + sql.append("insert into "); + sql.append(getTableName()); + + sql.append(" ("); + for (int i = 1; i <= size(); i++) { + sql.append(getColumn(i)); + if ( i < size() ) + sql.append(','); + } + sql.append(" )"); + + sql.append(" values ("); + for (int i = 1; i < size(); i++) { + sql.append("?,"); + } + sql.append("?)"); + + DebugUtil.debugln(getClass(), debug, sql.toString()); + PreparedStatement ps = connection.prepareStatement(sql.toString()); + + while (next()) { + for (int i = 1; i <= size(); i++) { + ps.setObject(i, getObject(i), getSqlType(i)); + } + ps.execute(); + ps.clearParameters(); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java new file mode 100644 index 0000000000..e25d2c4c95 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/IntegerToBooleanConverter.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.mappings; + +import org.apache.tuscany.das.rdb.Converter; + +public class IntegerToBooleanConverter implements Converter { + + public IntegerToBooleanConverter() { + super(); + } + + public Object getPropertyValue(Object columnData) { + Integer value = (Integer) columnData; + return value.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE; + } + + public Object getColumnValue(Object propertyData) { + Boolean value = (Boolean) propertyData; + if ( value.booleanValue()) + return new Integer(1); + else + return new Integer(0); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java new file mode 100644 index 0000000000..7c164bd675 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/SillyDateStringConverter.java @@ -0,0 +1,73 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.mappings; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.apache.tuscany.das.rdb.Converter; + + +public class SillyDateStringConverter implements Converter { + + public SillyDateStringConverter() { + super(); + } + + private static DateFormat myformat = new SimpleDateFormat("yyyy.MM.dd"); + + private static Date kbday; + + private static Date tbday; + + static { + try { + kbday = myformat.parse("1957.09.27"); + tbday = myformat.parse("1966.12.20"); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + public Object getPropertyValue(Object columnData) { + + if (columnData.equals("Williams")) + return kbday; + + if (columnData.equals("Pavick")) + return tbday; + + throw new IllegalArgumentException(); + + } + + public Object getColumnValue(Object propertyData) { + + if (propertyData.equals(kbday)) + return "Williams"; + + if (propertyData.equals(tbday)) + return "Pavick"; + + throw new IllegalArgumentException(); + + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java new file mode 100644 index 0000000000..8ff57aef6d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToIntegerConverter.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.mappings; + +import org.apache.tuscany.das.rdb.Converter; + +public class StringToIntegerConverter implements Converter { + + public StringToIntegerConverter() { + super(); + } + + public Object getPropertyValue(Object columnData) { + // System.out.println("Converting object.. " + columnData); + + return new Integer(columnData.toString()); + } + + public Object getColumnValue(Object columnData) { + return columnData.toString(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java new file mode 100644 index 0000000000..74a5e2917f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/mappings/StringToLongConverter.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.mappings; + +import org.apache.tuscany.das.rdb.Converter; + +public class StringToLongConverter implements Converter { + + public StringToLongConverter() { + super(); + } + + public Object getPropertyValue(Object columnData) { + return new Long(columnData.toString()); + } + + public Object getColumnValue(Object columnData) { + return columnData.toString(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java new file mode 100644 index 0000000000..53941ad489 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllCommonTests.java @@ -0,0 +1,98 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.suites; + +import org.apache.tuscany.das.rdb.test.BestPracticeTests; +import org.apache.tuscany.das.rdb.test.CUDGeneration; +import org.apache.tuscany.das.rdb.test.CompanyTests; +import org.apache.tuscany.das.rdb.test.CompoundKeyTests; +import org.apache.tuscany.das.rdb.test.ConverterTests; +import org.apache.tuscany.das.rdb.test.CorrectedDefectTests; +import org.apache.tuscany.das.rdb.test.CrudWithChangeHistory; +import org.apache.tuscany.das.rdb.test.ExceptionTests; +import org.apache.tuscany.das.rdb.test.GeneratedCommandTests; +import org.apache.tuscany.das.rdb.test.GeneratedId; +import org.apache.tuscany.das.rdb.test.GraphMergeTests; +import org.apache.tuscany.das.rdb.test.NameMappingTests; +import org.apache.tuscany.das.rdb.test.OCCTests; +import org.apache.tuscany.das.rdb.test.OneToOneRelationshipTests; +import org.apache.tuscany.das.rdb.test.OperationOrderingTests; +import org.apache.tuscany.das.rdb.test.Paging; +import org.apache.tuscany.das.rdb.test.PartialUpdateTests; +import org.apache.tuscany.das.rdb.test.PassiveConnectionTests; +import org.apache.tuscany.das.rdb.test.ProgrammaticConfigTests; +import org.apache.tuscany.das.rdb.test.RecursiveTests; +import org.apache.tuscany.das.rdb.test.RelationshipTests; +import org.apache.tuscany.das.rdb.test.ResultSetShapeTests; +import org.apache.tuscany.das.rdb.test.SerializationTests; +import org.apache.tuscany.das.rdb.test.SimplestCrud; +import org.apache.tuscany.das.rdb.test.StoredProcs; +import org.apache.tuscany.das.rdb.test.TopDown; +import org.apache.tuscany.das.rdb.test.TypeTests; +import org.apache.tuscany.das.rdb.test.CommandGroupTests; +import org.apache.tuscany.das.rdb.test.typed.SimplestStaticCrud; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllCommonTests { + + public static Test suite() { + TestSuite suite = new TestSuite("All platform-common DAS tests"); + //$JUnit-BEGIN$ + + suite.addTest(new TestSuite (SimplestCrud.class)); + suite.addTest(new TestSuite (CrudWithChangeHistory.class)); + suite.addTest(new TestSuite (SimplestStaticCrud.class)); + suite.addTest(new TestSuite (Paging.class)); + suite.addTest(new TestSuite (GeneratedId.class)); + + suite.addTest(new TestSuite (StoredProcs.class)); + suite.addTest(new TestSuite (CUDGeneration.class)); + suite.addTest(new TestSuite (TopDown.class)); + suite.addTest(new TestSuite (OCCTests.class)); + suite.addTest(new TestSuite (RecursiveTests.class)); + + suite.addTest(new TestSuite (GraphMergeTests.class)); + suite.addTest(new TestSuite (CompoundKeyTests.class)); + suite.addTest(new TestSuite (RelationshipTests.class)); + suite.addTest(new TestSuite (NameMappingTests.class)); + suite.addTest(new TestSuite (GeneratedCommandTests.class)); + + suite.addTest(new TestSuite (CompanyTests.class)); + suite.addTest(new TestSuite (ResultSetShapeTests.class)); + suite.addTest(new TestSuite (TypeTests.class)); + suite.addTest(new TestSuite (OperationOrderingTests.class)); + suite.addTest(new TestSuite (ConverterTests.class)); + + suite.addTest(new TestSuite (PartialUpdateTests.class)); + suite.addTest(new TestSuite (ExceptionTests.class)); + suite.addTest(new TestSuite (PassiveConnectionTests.class)); + suite.addTest(new TestSuite (SerializationTests.class)); + + suite.addTest(new TestSuite (CommandGroupTests.class)); + suite.addTest(new TestSuite (BestPracticeTests.class)); + suite.addTest(new TestSuite (CorrectedDefectTests.class)); + suite.addTest(new TestSuite (OneToOneRelationshipTests.class)); + + suite.addTest(new TestSuite (ProgrammaticConfigTests.class)); + + //$JUnit-END$ + return suite; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java new file mode 100644 index 0000000000..a5fcb5eba0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDB2.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.suites; + +import org.apache.tuscany.das.rdb.test.ReadDBSchemaTests; +import org.apache.tuscany.das.rdb.test.framework.DB2Setup; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsDB2 { + + + public static Test suite() { + + TestSuite suite = new TestSuite(); + suite.addTest(AllCommonTests.suite()); + suite.addTest(new TestSuite (ReadDBSchemaTests.class)); + + TestSuite suite2 = new TestSuite("All DAS tests on DB2"); + suite2.addTest(new DB2Setup(suite)); + return suite2; + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java new file mode 100644 index 0000000000..8af82f0114 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsDerby.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.suites; + +import org.apache.tuscany.das.rdb.test.framework.DerbySetup; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsDerby extends TestSuite { + + + public static Test suite() { + + TestSuite suite = new TestSuite("All DAS tests on Derby"); + suite.addTest(new DerbySetup(AllCommonTests.suite())); + return suite; + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java new file mode 100644 index 0000000000..2b862eba8c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/suites/AllTestsMySQL.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.suites; + +import org.apache.tuscany.das.rdb.test.framework.MySQLSetup; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsMySQL { + + + public static Test suite() { + + TestSuite suite = new TestSuite("All DAS tests on MySQL"); + suite.addTest(new MySQLSetup(AllCommonTests.suite())); + return suite; + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java new file mode 100644 index 0000000000..f8baca2cb8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/java/org/apache/tuscany/das/rdb/test/typed/SimplestStaticCrud.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.das.rdb.test.typed; + +import java.io.InputStream; +import java.util.Collection; + +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.test.customer.CustomerFactory; +import org.apache.tuscany.das.rdb.test.customer.DataGraphRoot; +import org.apache.tuscany.das.rdb.test.data.CustomerData; +import org.apache.tuscany.das.rdb.test.framework.DasTest; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.helper.TypeHelper; + + +/** + */ +public class SimplestStaticCrud extends DasTest { + + protected void setUp() throws Exception { + super.setUp(); + new CustomerData(getAutoConnection()).refresh(); + } + + public void testRead() throws Exception { + SDOUtil.registerStaticTypes(CustomerFactory.class); + InputStream mapping = getClass().getClassLoader().getResourceAsStream("basicStaticCustomer.xml"); + Command select = Command.FACTORY.createCommand("Select ID, LASTNAME, ADDRESS from CUSTOMER where LASTNAME = :LASTNAME",mapping); + select.setConnection(getConnection()); + select.setParameterValue("LASTNAME", "Williams"); + TypeHelper helper = TypeHelper.INSTANCE; + + select.setDataObjectModel(helper.getType(DataGraphRoot.class)); + + DataGraphRoot root = (DataGraphRoot) select.executeQuery(); + + Collection customers = root.getCustomers(); + assertEquals(4, customers.size()); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/1xM_mapping_no_cud.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/1xM_mapping_no_cud.xml new file mode 100644 index 0000000000..cb30e67f6e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/1xM_mapping_no_cud.xml @@ -0,0 +1,33 @@ + + + + + + +
+ + + + +
+ + + + + +
+ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/BooksConfig.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/BooksConfig.xml new file mode 100644 index 0000000000..b7e938ec9f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/BooksConfig.xml @@ -0,0 +1,24 @@ + + + + + + + +
+ +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CompanyConfig.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CompanyConfig.xml new file mode 100644 index 0000000000..5ed35f4fd3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CompanyConfig.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CompanyEmployeeConfig.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CompanyEmployeeConfig.xml new file mode 100644 index 0000000000..2dbac17522 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CompanyEmployeeConfig.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + +
+ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustOrdersConnectionProps.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustOrdersConnectionProps.xml new file mode 100644 index 0000000000..2d1fd5d20d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustOrdersConnectionProps.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomerConfigWithConverter.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomerConfigWithConverter.xml new file mode 100644 index 0000000000..24fce847de --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomerConfigWithConverter.xml @@ -0,0 +1,24 @@ + + + + + + + +
+ +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml new file mode 100644 index 0000000000..68a4eeca07 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomerConfigWithIDConverter.xml @@ -0,0 +1,23 @@ + + + + + + +
+ +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomersOrdersConfig.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomersOrdersConfig.xml new file mode 100644 index 0000000000..5146bcaab1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/CustomersOrdersConfig.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml new file mode 100644 index 0000000000..356226747f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/OrdersOrderDetailsConfig.xml @@ -0,0 +1,30 @@ + + + + + + + +
+ + + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/PartsConfig.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/PartsConfig.xml new file mode 100644 index 0000000000..06375dabef --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/PartsConfig.xml @@ -0,0 +1,27 @@ + + + + + + +
+ + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml new file mode 100644 index 0000000000..205d0d68b6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCompanyDepartmentMapping.xml @@ -0,0 +1,36 @@ + + + + + + + +
+ + + + + + + +
+ + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCompanyMapping.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCompanyMapping.xml new file mode 100644 index 0000000000..885ad383ca --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCompanyMapping.xml @@ -0,0 +1,22 @@ + + + + + + +
+
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMapping.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMapping.xml new file mode 100644 index 0000000000..203a6333ac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMapping.xml @@ -0,0 +1,25 @@ + + + + + + + + +
+ +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml new file mode 100644 index 0000000000..8bfd146504 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMappingWithCUD.xml @@ -0,0 +1,28 @@ + + + + + + + + +
+ +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml new file mode 100644 index 0000000000..189286c91c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerMappingWithInvalidCUD.xml @@ -0,0 +1,28 @@ + + + + + + + + +
+ +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerOrderMapping.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerOrderMapping.xml new file mode 100644 index 0000000000..507ce8d5e5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicCustomerOrderMapping.xml @@ -0,0 +1,32 @@ + + + + + + +
+ + + +
+ + + + + +
+ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicStaticCustomer.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicStaticCustomer.xml new file mode 100644 index 0000000000..1d01b284ae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/basicStaticCustomer.xml @@ -0,0 +1,25 @@ + + + + + + + + +
+ +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/cityStates.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/cityStates.xml new file mode 100644 index 0000000000..63d86aafac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/cityStates.xml @@ -0,0 +1,37 @@ + + + + + + + +
+ + + + + + + +
+ + + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.ecore b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.ecore new file mode 100644 index 0000000000..888acdf1c3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.ecore @@ -0,0 +1,130 @@ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + +
+
+ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+
+ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + +
+
+ + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.genmodel b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.genmodel new file mode 100644 index 0000000000..0b89c2c0c8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.genmodel @@ -0,0 +1,38 @@ + + + company.xsd + http://www.eclipse.org/emf/2003/SDO + EMF_COMMONJ_SDO=org.eclipse.emf.commonj.sdo + EMF_ECORE_SDO=org.eclipse.emf.ecore.sdo + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.xsd b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.xsd new file mode 100644 index 0000000000..62004bc584 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/company.xsd @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/companyMapping.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/companyMapping.xml new file mode 100644 index 0000000000..12b55d06f6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/companyMapping.xml @@ -0,0 +1,39 @@ + + + + + + +
+ + + +
+ + + +
+ + + + + + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/companyMappingWithConverters.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/companyMappingWithConverters.xml new file mode 100644 index 0000000000..2888a495d6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/companyMappingWithConverters.xml @@ -0,0 +1,41 @@ + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.ecore b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.ecore new file mode 100644 index 0000000000..74786d8af4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.ecore @@ -0,0 +1,96 @@ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + + +
+
+ + + +
+
+ + + + +
+
+ + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.genmodel b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.genmodel new file mode 100644 index 0000000000..8c1cd53e57 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.genmodel @@ -0,0 +1,32 @@ + + + customer.xsd + http://www.eclipse.org/emf/2003/SDO + EMF_COMMONJ_SDO=org.eclipse.emf.commonj.sdo + EMF_ECORE_SDO=org.eclipse.emf.ecore.sdo + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.xsd b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.xsd new file mode 100644 index 0000000000..c9e37ddd89 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customer.xsd @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customerMapping.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customerMapping.xml new file mode 100644 index 0000000000..f72f4cf1b1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customerMapping.xml @@ -0,0 +1,25 @@ + + + + + + + + +
+ +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml new file mode 100644 index 0000000000..14b6302e72 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/das/rdb/src/test/resources/customerOrderRelationshipMapping.xml @@ -0,0 +1,31 @@ + + + + + + +
+ + +
+ + + + + +
+ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/BUILDING.txt b/sca-java-1.x/tags/java-M1-20060522/java/distribution/BUILDING.txt new file mode 100644 index 0000000000..4164dd9a78 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/BUILDING.txt @@ -0,0 +1,5 @@ +To create the Tuscany distribution, you just simply run: + +build-dist.bat +or +build-dist.sh diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/axis2-overlay/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/axis2-overlay/pom.xml new file mode 100644 index 0000000000..86dd740c59 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/axis2-overlay/pom.xml @@ -0,0 +1,88 @@ + + + + + org.apache.tuscany + tuscany-distribution + incubating-M1 + + 4.0.0 + tuscany-distribution-axis2-overlay + jar + Tuscany Distribution Project - Axis2 Overlay + incubating-M1 + + + + org.apache.tuscany.sca.bindings + tuscany-binding-axis2 + ${pom.version} + + + org.apache.tuscany + tuscany-core + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + tuscany-axis2-${project.version} + + + true + + + + + + manifest-jar + package + + jar + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.0.1 + + + overlay + package + + directory + + + + + + src/main/assembly/bin.xml + + tuscany + ${basedir}/../target + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/axis2-overlay/src/main/assembly/bin.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/axis2-overlay/src/main/assembly/bin.xml new file mode 100644 index 0000000000..97dcfea287 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/axis2-overlay/src/main/assembly/bin.xml @@ -0,0 +1,38 @@ + + + + dist + + dir + + false + + + axis2-overlay/target + lib/axis2 + + tuscany-axis2-incubating-M1.jar + + + + + + lib/axis2 + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/build-dist.bat b/sca-java-1.x/tags/java-M1-20060522/java/distribution/build-dist.bat new file mode 100644 index 0000000000..c4d0b4b7fe --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/build-dist.bat @@ -0,0 +1,33 @@ +@REM ---------------------------------------------------------------------------- +@REM Copyright 2006 The Apache Software Foundation. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM ---------------------------------------------------------------------------- +@REM +@setlocal +@echo off + +SET CUR_DIR=%cd% +cd /d "%~dp0.." +SET TUSCANY_HOME=%cd% +cd /d "%CUR_DIR%" +echo Building Tuscany ... +cd /d "%TUSCANY_HOME%" +call mvn -Dtuscany.home=%TUSCANY_HOME% %1 clean install -Dmaven.test.skip=true +if ERRORLEVEL 1 goto error +cd /d "%TUSCANY_HOME%/distribution" +echo Creating Tuscany distribution ... +call mvn %1 clean install +:error +cd /d "%CUR_DIR%" +@endlocal diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/build-dist.sh b/sca-java-1.x/tags/java-M1-20060522/java/distribution/build-dist.sh new file mode 100755 index 0000000000..f23fd378d2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/build-dist.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Copyright 2006 The Apache Software Foundation. +# +# 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. +# ---------------------------------------------------------------------------- + +# Copyright (c) 2001-2002 The Apache Software Foundation. All rights +# reserved. +# +CUR_DIR=`pwd` +cd .. +TUSCANY_HOME=`pwd` +echo Building Tuscany ... +echo $TUSCANY_HOME +mvn -Dtuscany.home=$TUSCANY_HOME $1 clean install -Dmaven.test.skip=true +if [ $? -eq 0 ] +then +cd $CUR_DIR +echo Creating Tuscany distribution ... +mvn $1 clean install +fi + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/buildDistribution.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/buildDistribution.xml new file mode 100644 index 0000000000..0c7d15435b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/buildDistribution.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/celtix-overlay/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/celtix-overlay/pom.xml new file mode 100644 index 0000000000..6c999bb89a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/celtix-overlay/pom.xml @@ -0,0 +1,88 @@ + + + + + org.apache.tuscany + tuscany-distribution + incubating-M1 + + 4.0.0 + tuscany-distribution-celtix-overlay + jar + Tuscany Distribution Project - Celtix Overlay + incubating-M1 + + + + org.apache.tuscany.sca.bindings + tuscany-binding-celtix + ${pom.version} + + + org.apache.tuscany + tuscany-core + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + tuscany-celtix-${project.version} + + + true + + + + + + manifest-jar + package + + jar + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.0.1 + + + overlay + package + + directory + + + + + + src/main/assembly/bin.xml + + tuscany + ${basedir}/../target + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/celtix-overlay/src/main/assembly/bin.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/celtix-overlay/src/main/assembly/bin.xml new file mode 100644 index 0000000000..0f1fcb967f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/celtix-overlay/src/main/assembly/bin.xml @@ -0,0 +1,39 @@ + + + + dist + + dir + + false + + + celtix-overlay/target + lib/celtix + + tuscany-celtix-incubating-M1.jar + + + + + + lib/celtix + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/pom.xml new file mode 100644 index 0000000000..172f1e5494 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/pom.xml @@ -0,0 +1,39 @@ + + + + + org.apache.tuscany + tuscany-project + incubating-M1 + + 4.0.0 + tuscany-distribution + pom + Tuscany Distribution Project + incubating-M1 + + + axis2-overlay + celtix-overlay + tuscany-core-overlay + tuscany-tools-overlay + tuscany-samples + tomcat-overlay + tuscany-polish + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/configureTomcat.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/configureTomcat.xml new file mode 100644 index 0000000000..32407b4e88 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/configureTomcat.xml @@ -0,0 +1,425 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/context.xsl b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/context.xsl new file mode 100644 index 0000000000..3224d15dae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/context.xsl @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/datasource.xsl b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/datasource.xsl new file mode 100644 index 0000000000..ad473e317c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/datasource.xsl @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + Global Datasource for Derby dastest database + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/pom.xml new file mode 100644 index 0000000000..bbb8acc81d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/pom.xml @@ -0,0 +1,121 @@ + + + + + org.apache.tuscany + tuscany-distribution + incubating-M1 + + 4.0.0 + tuscany-distribution-tomcat-overlay + pom + Tuscany Distribution Project - Tomcat Overlay + incubating-M1 + + + + + + + maven-antrun-plugin + + + ant + ant-trax + 1.6.5 + + + + + + create-tomcat + install + + + + + + + + + + run + + + + clean-tomcat + clean + + + + + + + + + run + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/server.xsl b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/server.xsl new file mode 100644 index 0000000000..7f3deb8107 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tomcat-overlay/server.xsl @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + org.apache.tuscany.tomcat.TuscanyHost + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-core-overlay/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-core-overlay/pom.xml new file mode 100644 index 0000000000..bb76b3b5ef --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-core-overlay/pom.xml @@ -0,0 +1,113 @@ + + + + + org.apache.tuscany + tuscany-distribution + incubating-M1 + + 4.0.0 + tuscany-distribution-tuscany-core-overlay + pom + Tuscany Distribution Project - Tuscany Core Overlay + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + + + org.apache.tuscany.databinding + tuscany-databinding-sdo + ${pom.version} + + + org.apache.tuscany.sca.bindings + tuscany-binding-jsonrpc + ${pom.version} + + + org.apache.tuscany.sca.containers + tuscany-container-rhino + ${pom.version} + + + org.apache.tuscany.sca.bindings + tuscany-binding-axis2 + + + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + + + org.apache.tuscany.das + tuscany-das-rdb + ${pom.version} + + + + + + org.apache.maven.plugins + maven-jar-plugin + + tuscany-runtime-${project.version} + + + true + + + + + + manifest-jar + package + + jar + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.0.1 + + + overlay + package + + directory + + + + + + src/main/assembly/bin.xml + + tuscany + ${basedir}/../target + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-core-overlay/src/main/assembly/bin.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-core-overlay/src/main/assembly/bin.xml new file mode 100644 index 0000000000..6bc4113627 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-core-overlay/src/main/assembly/bin.xml @@ -0,0 +1,38 @@ + + + + dist + + dir + + false + + + tuscany-core-overlay/target + lib + + tuscany-runtime-incubating-M1.jar + + + + + + lib + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-polish/fixupJars.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-polish/fixupJars.xml new file mode 100644 index 0000000000..8142364b78 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-polish/fixupJars.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-polish/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-polish/pom.xml new file mode 100644 index 0000000000..48340a3af0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-polish/pom.xml @@ -0,0 +1,110 @@ + + + + + org.apache.tuscany + tuscany-distribution + incubating-M1 + + 4.0.0 + tuscany-distribution-tuscany-polish + pom + Tuscany Distribution Project - Tuscany Polish + incubating-M1 + + + + + + + maven-antrun-plugin + + + ant + ant-trax + 1.6.5 + + + + + + fixup-jars + install + + + + + + + + + run + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-samples/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-samples/pom.xml new file mode 100644 index 0000000000..bbf04e3f6a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-samples/pom.xml @@ -0,0 +1,56 @@ + + + + + org.apache.tuscany + tuscany-distribution + incubating-M1 + + 4.0.0 + tuscany-distribution-tuscany-samples + pom + Tuscany Distribution Project - Tuscany Samples Overlay + incubating-M1 + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.0.1 + + + overlay + package + + directory + + + + + + + src/main/assembly/bin.xml + + tuscany + ${basedir}/../target + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-samples/src/main/assembly/bin.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-samples/src/main/assembly/bin.xml new file mode 100644 index 0000000000..c65e791ddd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-samples/src/main/assembly/bin.xml @@ -0,0 +1,88 @@ + + + + dist + + dir + + false + + + ../sampleapps + sampleapps + + **/src/test/**/* + **/src/test + **/target + **/target/**/* + **/target/site/**/* + **/build + **/build/**/* + **/.settings/**/* + **/.classpath + **/.project + **/.wtpmodules + **/surefire* + **/cobertura.ser + **/bin/* + **/var/journal + **/build.out* + + + + ../sampleapps + sampleapps + + **/target/*.jar + **/target/*.war + + + + + ../samples + samples + + **/src/test/**/* + **/src/test + **/target/**/* + **/target + **/target/site/**/* + **/build + **/build/**/* + **/.settings + **/.settings/**/* + **/.classpath + **/.project + **/.wtpmodules + **/surefire* + **/cobertura.ser + **/bin/* + **/var/journal + **/build.out* + + + + ../samples + samples + + **/target/*.jar + **/target/*.war + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-tools-overlay/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-tools-overlay/pom.xml new file mode 100644 index 0000000000..b9c95b9c83 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-tools-overlay/pom.xml @@ -0,0 +1,104 @@ + + + + + org.apache.tuscany + tuscany-distribution + incubating-M1 + + 4.0.0 + tuscany-distribution-tuscany-tools-overlay + pom + Tuscany Distribution Project - Tuscany Tools Overlay + incubating-M1 + + + + org.apache.tuscany + tuscany-sca-tools + ${pom.version} + + + org.apache.tuscany + tuscany-sdo-tools + ${pom.version} + + + org.apache.tuscany.sca.plugins + tuscany-plugin-wsdl2java + ${pom.version} + + + org.apache.tuscany.sca.plugins + tuscany-plugin-java2wsdl + ${pom.version} + + + org.apache.tuscany + tuscany-sdo-plugin + ${pom.version} + + + + + + org.apache.maven.plugins + maven-jar-plugin + + tuscany-tools-${project.version} + + + true + + + + + + manifest-jar + package + + jar + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.0.1 + + + overlay + package + + directory + + + + + + + src/main/assembly/bin.xml + + tuscany + ${basedir}/../target + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-tools-overlay/src/main/assembly/bin.xml b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-tools-overlay/src/main/assembly/bin.xml new file mode 100644 index 0000000000..90694fb5b2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/distribution/tuscany-tools-overlay/src/main/assembly/bin.xml @@ -0,0 +1,38 @@ + + + + dist + + dir + + false + + + tuscany-tools-overlay/target + lib/tools + + tuscany-tools-incubating-M1.jar + + + + + + lib/tools + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/etc/svn-ignores b/sca-java-1.x/tags/java-M1-20060522/java/etc/svn-ignores new file mode 100644 index 0000000000..82b73a9ec6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/etc/svn-ignores @@ -0,0 +1,13 @@ +target +*.iws +*.ipr +*.iml +.project +.classpath +maven.log +velocity.log* +junit*.properties +.settings +.deployables +.wtpmodules + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/etc/tuscany-eclipse-codestyle.xml b/sca-java-1.x/tags/java-M1-20060522/java/etc/tuscany-eclipse-codestyle.xml new file mode 100644 index 0000000000..55b40f256a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/etc/tuscany-eclipse-codestyle.xml @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/etc/tuscany-idea-codestyle.xml b/sca-java-1.x/tags/java-M1-20060522/java/etc/tuscany-idea-codestyle.xml new file mode 100644 index 0000000000..f6c0920bd7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/etc/tuscany-idea-codestyle.xml @@ -0,0 +1,19 @@ + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-base.css b/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-base.css new file mode 100644 index 0000000000..313328b126 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-base.css @@ -0,0 +1,147 @@ +body { + margin: 0px; + padding: 0px; +} +img { + border:none; +} +table { + padding:0px; + width: 100%; + margin-left: -2px; + margin-right: -2px; +} +acronym { + cursor: help; + border-bottom: 1px dotted #feb; +} +table.bodyTable th, table.bodyTable td { + padding: 2px 4px 2px 4px; + vertical-align: top; +} +div.clear{ + clear:both; + visibility: hidden; +} +div.clear hr{ + display: none; +} +#bannerLeft, #bannerRight { + font-size: xx-large; + font-weight: bold; +} +#bannerLeft img, #bannerRight img { + margin: 0px; +} +.xleft, #bannerLeft img { + float:left; + text-shadow: #7CFC00; +} +.xright, #bannerRight img { + float:right; + text-shadow: #7CFC00; +} +#banner { + padding: 0px; +} +#banner img { + border: none; +} +#breadcrumbs { + padding: 3px 10px 3px 10px; +} +#leftColumn { + width: 150px; + float:left; +} +#bodyColumn { + margin-right: 1.5em; + margin-left: 177px; +} +#legend { + padding: 8px 0 8px 0; +} +#navcolumn { + padding: 8px 4px 0 8px; +} +#navcolumn h5 { + margin: 0; + padding: 0; + font-size: small; +} +#navcolumn ul { + margin: 0; + padding: 0; + font-size: small; +} +#navcolumn li { + list-style-type: none; + background-image: none; + background-repeat: no-repeat; + background-position: 0 0.4em; + padding-left: 16px; + list-style-position: ouside; + line-height: 1.2em; + font-size: smaller; +} +#navcolumn li.expanded { + background-image: url(../images/expanded.gif); +} +#navcolumn li.collapsed { + background-image: url(../images/collapsed.gif); +} +#poweredBy { + text-align: center; +} +#navcolumn img { + margin-top: 10px; + margin-bottom: 3px; +} +#poweredBy img { + display:block; + margin: 20px 0 20px 17px; + border: 1px solid black; + width: 90px; + height: 30px; +} +#search img { + margin: 0px; + display: block; +} +#search #q, #search #btnG { + border: 1px solid #999; + margin-bottom:10px; +} +#search form { + margin: 0px; +} +#lastPublished { + font-size: x-small; +} +.navSection { + margin-bottom: 2px; + padding: 8px; +} +.navSectionHead { + font-weight: bold; + font-size: x-small; +} +.section { + padding: 4px; +} +#footer { + padding: 3px 10px 3px 10px; + font-size: x-small; +} +#breadcrumbs { + font-size: x-small; + margin: 0pt; +} +.source { + padding: 12px; + margin: 1em 7px 1em 7px; +} +.source pre { + margin: 0px; + padding: 0px; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-classic.css b/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-classic.css new file mode 100644 index 0000000000..3e53c313ef --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-classic.css @@ -0,0 +1,881 @@ +body { + background: #fff; + color: #000; + padding: 0px 0px 10px 0px; + } + +.contentBox h2 { + color: #fff; + background-color: #036; + } + +.contentBox h3 { + color: #fff; + background-color: #888; + } + +.a td { + background: #ddd; + color: #000; + } + +.b td { + background: #efefef; + color: #000; + } + +.contentBox th { + background-color: #bbb; + color: #fff; + } + +div#banner { + border-top: 1px solid #369; + border-bottom: 1px solid #003; + } + +#banner, #banner td { + background: #036; + color: #fff; + } +#banner { + border-bottom: 1px solid #fff; +} + +#leftColumn { + background: #eee; + color: #000; + border-right: 1px solid #aaa; + border-bottom: 1px solid #aaa; + border-top: 1px solid #fff; +} + +#navcolumn { +/* bad for IE + background: #eee; +*/ + color: #000; + border-right: none; + border-bottom: none; + border-top: none; + } + +#breadcrumbs { + background-color: #ddd; + color: #000; + border-top: 1px solid #fff; + border-bottom: 1px solid #aaa; + } + +.source { + background-color: #fff; + color: #000; + border-right: 1px solid #888; + border-left: 1px solid #888; + border-top: 1px solid #888; + border-bottom: 1px solid #888; + margin-right: 7px; + margin-left: 7px; + margin-top: 1em; + } + +.source pre { + margin-right: 7px; + margin-left: 7px; + } + +a[name]:hover, #leftColumn a[name]:hover { + color: inherit !important; + } + +a:link, #breadcrumbs a:visited, #navcolumn a:visited, .contentBox a:visited, .tasknav a:visited { + color: blue; + } + +a:active, a:hover, #leftColumn a:active, #leftColumn a:hover { + color: #f30 !important; + } + +a:link.selfref, a:visited.selfref { + color: #555 !important; + } + +#legend li.externalLink { + background: url(../images/external-classic.png) left top no-repeat; + padding-left: 18px; +} +a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover { + background: url(../images/external-classic.png) right center no-repeat; + padding-right: 18px; +} + +#legend li.newWindow { + background: url(../images/newwindow-classic.png) left top no-repeat; + padding-left: 18px; +} +a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover { + background: url(../images/newwindow-classic.png) right center no-repeat; + padding-right: 18px; +} + +h2, h3 { + margin-top: 1em; + margin-bottom: 0; + } + +img.handle { + border: 0; + padding-right: 2px; +} + +#navcolumn div div { + background-image: none; + background-repeat: no-repeat; +} + +#navcolumn div div { + padding-left: 10px; +} +/* $Id: maven-classic.css 170922 2005-05-19 13:19:44Z brett $ + + This file defines basic default formatting for HTML conforming to Tigris application style. To extend or override these rules for your instance, edit inst.css instead of this file. */ + +/* colors, backgrounds, borders, link indication */ +.contentBox h2, .contentBox h3, .tabs td, .tabs th, .functnbar { + background-image: url(../images/nw_maj_rond.gif); + background-repeat: no-repeat; +} + +.functnbar, .functnbar2 { + background-color: #aaa; +} + +.functnbar2, .functnbar3 { + background-color: #aaa; + background-image: url(../images/sw_maj_rond.gif); + background-repeat: no-repeat; + background-position: bottom left; +} + +.functnbar3 { + background-color: #ddd; + background-image: url(../images/sw_med_rond.gif); +} + +.functnbar, .functnbar2, .functnbar3 { + color: #000; +} + +.functnbar a, .functnbar2 a, .functnbar3 a { + color: #000; + text-decoration: underline; +} + +#navcolumn .body div, body.docs #toc li li { + background-image: url(../images/strich.gif); + background-repeat: no-repeat; + background-position: .5em .5em; +} + +#searchbox .body div, #navcolumn .body .heading { + background-image: none; +} + +a:link.selfref, a:visited.selfref { + text-decoration: none; +} + +#leftColumn a, #breadcrumbs a { + text-decoration: none; +} + +/* Unsure of this. TODO */ +.contentBox h2 a:link, .contentBox h2 a:visited, .contentBox h3 a:link, .contentBox h3 a:visited { + color: #fff !important; + text-decoration: underline; +} + +table, th, td { + border: none; +} + +div.colbar { + background: #eee; + border-color: #999 #EEE #EEE #999; + border-width: 1px; + border-style: solid; +} + +.toolgroup { + background: #efefef; +} + +.toolgroup .label { + border-bottom: 1px solid #666; + border-right: 1px solid #666; + background: #ddd; + color: #555; +} + +.toolgroup .body { + border-right: 1px solid #aaa; + border-bottom: 1px solid #aaa; +} + +#main { + border-top: 1px solid #999; +} + +#rightcol div.www, #rightcol div.help { + border: 1px solid #ddd; +} + +body.docs div.docs { + background-color: #fff; + border-left: 1px solid #ddd; + border-top: 1px solid #ddd; +} + +#helptext .label { + background-image: url(../images/icon_help_sml.gif); + background-repeat: no-repeat; + background-position: 97%; +} + +body.docs { + background: #eee url(../images/help_logo.gif) top right no-repeat !important; +} + +.docs h2, .docs h3 { + border-top: solid 1px #000; +} + +#apphead h2 em { + color: #777; +} + +.tabs th { + border-right: 1px solid #333; + background-color: #ddd; + color: #fff; + border-left: 1px solid #fff; +} + +.tabs td { + background-color: #999; + border-bottom: 1px solid #fff; + border-right: 1px solid #fff; + border-left: 1px solid #fff; +} + +.tabs { + border-bottom: 6px #ddd solid; +} + +.tabs th, .tabs th a:link, .tabs th a:visited { + color: #555; +} + +.tabs td, .tabs td a:link, .tabs td a:visited { + color: #fff; +} + +.tabs a { + text-decoration: none; +} + +.axial th { + background-color: #ddd; + color: black; +} + +.alert { + background-color: #ff9; +} + +.expandedwaste { + background: url(../images/icon_arrowwaste2_sml.gif) no-repeat; +} + +.collapsedwaste { + background: url(../images/icon_arrowwaste1_sml.gif) no-repeat; +} + +.filebrowse .expanded, .filebrowse-alt .expanded { + background-image: url(../images/icon_arrowfolderopen2_sml.gif); + background-repeat: no-repeat; +} + +.filebrowse .collapsed, .filebrowse-alt .collapsed { + background-image: url(../images/icon_arrowfolderclosed1_sml.gif); + background-repeat: no-repeat; +} + +.filebrowse .leafnode, .filebrowse-alt .leafnode { + background-image: url(../images/icon_folder_sml.gif); + background-repeat: no-repeat; +} + +.filebrowse .leaf, .filebrowse-alt .leaf { + background-image: url(../images/icon_doc_sml.gif); + background-repeat: no-repeat; +} + +.sortup { + background: url(../images/icon_sortup.gif) no-repeat; +} + +.sortdown { + background: url(../images/icon_sortdown.gif) no-repeat; +} + +.collapsedwaste { + background: url(../images/icon_arrowwaste1_sml.gif) no-repeat; +} + +body .grid td { + border-top: 1px solid #ccc; + border-left: 1px solid #ccc; + background-color: transparent; +} + +.confirm { + color: #090; +} + +.info { + color: #069; +} + +.errormessage, .warningmessage, .donemessage, .infomessage { + border-top: 5px solid #900; + border-left: 1px solid #900; + background-image: url(../images/icon_error_lrg.gif); + background-repeat: no-repeat; + background-position: 5px 1.33em; +} + +.warningmessage { + background-image: url(../images/icon_warning_lrg.gif); + border-color: #c60; +} + +.donemessage { + background-image: url(../images/icon_success_lrg.gif); + border-color: #090; +} + +.infomessage { + background-image: url(../images/icon_info_lrg.gif); + border-color: #069; +} + +.docinfo { + background: url(../images/icon_doc_lrg.gif) no-repeat; +} + +.dirinfo { + background: url(../images/icon_folder_lrg.gif) no-repeat; +} + +.memberinfo { + background: url(../images/icon_members_lrg.gif) no-repeat; +} + +.usergroupinfo { + background: url(../images/icon_usergroups_lrg.gif) no-repeat; +} + +.errormark, .warningmark, .donemark, .infomark { + background: url(../images/icon_error_sml.gif) no-repeat; +} + +.warningmark { + background-image: url(../images/icon_warning_sml.gif); +} + +.donemark { + background-image: url(../images/icon_success_sml.gif); +} + +.infomark { + background-image: url(../images/icon_info_sml.gif); +} + +.cvsdiff, .cvsblame { + background-color: #ccc; +} + +.cvsdiffadd { + background-color: #afa; +} + +.cvsdiffremove { + background-color: #faa; +} + +.cvsdiffchanges1 { + background-color: #ff7; +} + +.cvsdiffchanges2 { + background-color: #ff7; +} + +li.selection ul a { + background: #fff; +} + +.band1 { + color: #fff; + background-color: #663; +} + +.band2 { + color: #fff; + background-color: #66C; +} + +.band3 { + background-color: #C99; +} + +.band4 { + background-color: #CFF; +} + +.band5 { + color: #fff; + background-color: #336; +} + +.band6 { + color: #fff; + background-color: #966; +} + +.band7 { + background-color: #9CC; +} + +.band8 { + background-color: #FFC; +} + +.band9 { + color: #fff; + background-color: #633; +} + +.band10 { + color: #fff; + background-color: #699; +} + +.band11 { + background-color: #CC9; +} + +.band12 { + background-color: #CCF; +} + +.band13 { + color: #fff; + background-color: #366; +} + +.band14 { + color: #fff; + background-color: #996; +} + +.band15 { + background-color: #99C; +} + +.band16 { + background-color: #FCC; +} + +.contentBox .helplink, #helptext .helplink { + cursor: help; +} + +.legend th, .bars th { + background-color: #fff; +} + +/* font and text properties, exclusive of link indication, alignment, text-indent */ +body, th, td, input, select { + font-family: Verdana, Helvetica, Arial, sans-serif; +} + +code, pre { + font-family: 'Andale Mono', Courier, monospace; +} + +body, .contentBox h2, .contentBox h3, #rightcol h2, pre, code, #apphead h2 small, h3, th, td { + font-size: x-small; + voice-family: "\"}\""; + voice-family: inherit; + font-size: small; +} + +small, div#footer, div#login, div.tabs th, div.tabs td, input, select, .paginate, .functnbar, .functnbar2, .functnbar3, #breadcrumbs, .courtesylinks, #rightcol div.help, .colbar, .tasknav, body.docs div#toc, #leftColumn, .legend, .bars { + font-size: xx-small; + voice-family: "\"}\""; + voice-family: inherit; + font-size: x-small; +} + +.tabs td, .tabs th, dt, .tasknav .selfref, #login .username, .selection { + font-weight: bold; +} + +li.selection ul { + font-weight: normal; +} + +#apphead h2 em { + font-style: normal; +} + +#banner h1 { + font-size: 1.25em; +} + +/* box properties (exclusive of borders), positioning, alignments, list types, text-indent */ +#bodyColumn h2 { + margin-top: .3em; + margin-bottom: .5em; +} + +p, ul, ol, dl, .bars table { + margin-top: .67em; + margin-bottom: .67em; +} + +form { + margin: 0; +} + +#bodyColumn { + padding-left: 12px; + padding-right: 12px; + width: 100%; + voice-family: "\"}\""; + voice-family: inherit; + width: auto; +} + +html>body #bodyColumn { + width: auto; +} + +.docs { + line-height: 1.4; +} + +ol ol { + list-style-type: lower-alpha; +} + +ol ol ol { + list-style-type: lower-roman; +} + +.contentBox h2, .contentBox h3 { + padding: 5px; + margin-right: 2px; +} + +.contentBox td, .contentBox th { + padding: 2px 3px; +} + +.h2 p, .h3 p, .h2 dt, .h3 dt { + margin-right: 7px; + margin-left: 7px; +} + +.tasknav { + margin-bottom: 1.33em; +} + +div.colbar { + padding: 3px; + margin: 2px 2px 0; +} + +.tabs { + margin-top: .67em; + margin-right: 2px; + margin-left: 2px; + padding-left: 8px; +} + +.tabs td, .tabs th { + padding: 3px 9px; +} + +#rightcol div.www, #rightcol div.help { + padding: 0 .5em; +} + +body.docs #toc { + position: absolute; + top: 15px; + left: 0px; + width: 120px; + padding: 0 20px 0 0; +} + +body.docs #toc ul, #toc ol { + margin-left: 0; + padding-left: 0; +} + +body.docs #toc li { + margin-top: 7px; + padding-left: 10px; + list-style-type: none; +} + +body.docs div.docs { + margin: 61px 0 0 150px; + padding: 1em 2em 1em 1em !important; +} + +.docs p+p { + text-indent: 5%; + margin-top: -.67em; +} + +.docs h2, .docs h3 { + margin-bottom: .1em; + padding-top: .3em; +} + +.functnbar, .functnbar2, .functnbar3 { + padding: 5px; + margin: .67em 2px; +} + +.functnbar3 { + margin-top: 0; +} + +body { + padding: 1em; +} + +body.composite, body.docs { + margin: 0; + padding: 0; +} + +th, td { + text-align: left; + vertical-align: top; +} + +.right { + text-align: right !important; +} + +.center { + text-align: center !important; +} + +.axial th, .axial th .strut { + text-align: right; +} + +.contentBox .axial td th { + text-align: left; +} + +body .stb { + margin-top: 1em; + text-indent: 0; +} + +body .mtb { + margin-top: 2em; + text-indent: 0; +} + +.courtesylinks { + margin-top: 1em; + padding-top: 1em; +} + +dd { + margin-bottom: .67em; +} + +.toolgroup { + margin-bottom: 6px; +} + +.toolgroup .body { + padding: 4px 4px 4px 0; +} + +.toolgroup .label { + padding: 4px; +} + +.toolgroup .body div { + padding-bottom: .3em; + padding-left: 1em; +} + +.toolgroup .body div div { + margin-top: .3em; + padding-bottom: 0; +} + +.tier1 { + margin-left: 0; +} + +.tier2 { + margin-left: 1.5em; +} + +.tier3 { + margin-left: 3em; +} + +.tier4 { + margin-left: 4.5em; +} + +.tier5 { + margin-left: 6em; +} + +.tier6 { + margin-left: 7.5em; +} + +.tier7 { + margin-left: 9em; +} + +.tier8 { + margin-left: 10.5em; +} + +.tier9 { + margin-left: 12em; +} + +.tier10 { + margin-left: 13.5em; +} + +.filebrowse .expanded, .filebrowse .collapsed { + padding-left: 34px; +} + +.filebrowse .leafnode, .filebrowse .leaf { + padding-left: 20px; +} + +.messagechild { + padding-left: 34px; +} + +.filebrowse-alt .expanded, .filebrowse-alt .collapsed, .filebrowse-alt .leaf, .filebrowse-alt .leafnode, .expandedwaste, .collapsedwaste, .sortup, .sortdown { + /* hide from macie5\*/ + float: left; + /* resume */ + display: inline-block; + height: 15px; + width: 34px; + padding-left: 0 !important; +} + +.filebrowse-alt .leaf, .filebrowse-alt .leafnode, .sortup, .sortdown { + width: 20px; +} + +.filebrowse ul, .filebrowse-alt ul { + list-style-type: none; + padding-left: 0; + margin-left: 0; +} + +.filebrowse ul ul, .filebrowse-alt ul ul { + margin-left: 1.5em; + margin-top: 0; + padding-top: .67em; +} + +.filebrowse li, .filebrowse-alt li { + margin-bottom: .67em; +} + +td.filebrowse h2 { + margin-top: 0; +} + +.errormessage, .warningmessage, .donemessage, .infomessage, .docinfo, .dirinfo, .memberinfo, .usergroupinfo { + margin: .67em 0; + padding: .33em 0 .67em 42px; + min-height: 32px; +} + +.errormark, .warningmark, .donemark, .infomark { + padding-left: 20px; + min-height: 15px; +} + +.alt { + display: none; +} + +#banner h1 { + margin: 0; +} + +.axial th, .axial th .strut, #leftColumn .strut { + width: 12em; +} + +#breadcrumbs { + padding: 2px 8px; +} + +/* Bad for IE +.contentBox h2, .contentBox h3, .bars { + clear: both; +} +*/ + +.legend { + float: right; +} + +.legend th, .bars th { + text-align: right; + padding-left: 1em; +} + +.bars table { + table-layout: fixed; +} + +.bars th { + width: 12em; +} + +#projectdocumentlist td.filebrowse-alt { + padding-right: .75em; +} +#organizationLogo img, #projectLogo img, #projectLogo span{ + margin: 8px; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-theme.css b/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-theme.css new file mode 100644 index 0000000000..ea20b09932 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/maven-theme.css @@ -0,0 +1,125 @@ +body { + padding: 0px 0px 10px 0px; +} +body, td, select, input, li{ + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 13px; +} +code{ + font-family: Courier, monospace; + font-size: 13px; +} +a { + text-decoration: none; +} +a:link { + color:#36a; +} +a:visited { + color:#47a; +} +a:active, a:hover { + color:#69c; +} +#legend li.externalLink { + background: url(../images/external.png) left top no-repeat; + padding-left: 18px; +} +a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover { + background: url(../images/external.png) right center no-repeat; + padding-right: 18px; +} +#legend li.newWindow { + background: url(../images/newwindow.png) left top no-repeat; + padding-left: 18px; +} +a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover { + background: url(../images/newwindow.png) right center no-repeat; + padding-right: 18px; +} +h2 { + padding: 4px 4px 4px 6px; + border: 1px solid #999; + color: #900; + background-color: #ddd; + font-weight:900; + font-size: x-large; +} +h3 { + padding: 4px 4px 4px 6px; + border: 1px solid #aaa; + color: #900; + background-color: #eee; + font-weight: normal; + font-size: large; +} +h4 { + padding: 4px 4px 4px 6px; + border: 1px solid #bbb; + color: #900; + background-color: #fff; + font-weight: normal; + font-size: large; +} +h5 { + padding: 4px 4px 4px 6px; + color: #900; + font-size: normal; +} +p { + line-height: 1.3em; + font-size: small; +} +#breadcrumbs { + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; + background-color: #ccc; +} +#leftColumn { + margin: 10px 0 0 5px; + border: 1px solid #999; + background-color: #eee; +} +#navcolumn h5 { + font-size: smaller; + border-bottom: 1px solid #aaaaaa; + padding-top: 2px; + color: #000; +} + +table.bodyTable th { + color: white; + background-color: #bbb; + text-align: left; + font-weight: bold; +} + +table.bodyTable th, table.bodyTable td { + font-size: 1em; +} + +table.bodyTable tr.a { + background-color: #ddd; +} + +table.bodyTable tr.b { + background-color: #eee; +} + +.source { + border: 1px solid #999; +} +dl { + padding: 4px 4px 4px 6px; + border: 1px solid #aaa; + background-color: #ffc; +} +dt { + color: #900; +} +#organizationLogo img, #projectLogo img, #projectLogo span{ + margin: 8px; +} +#banner { + border-bottom: 1px solid #fff; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/print.css b/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/print.css new file mode 100644 index 0000000000..26ad7f0b59 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/javadoc/css/print.css @@ -0,0 +1,7 @@ +#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn { + display: none !important; +} +#bodyColumn, body.docs div.docs { + margin: 0 !important; + border: none !important +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/pom.xml new file mode 100644 index 0000000000..491f9a5932 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/pom.xml @@ -0,0 +1,290 @@ + + + + 4.0.0 + org.apache.tuscany + tuscany-project + incubating-M1 + pom + Tuscany Project + http://incubator.apache.org/tuscany/ + + Tuscany is an open source project implementing a Service Component Architecture. + + 2005 + + Apache Software Foundation + http://www.apache.org/ + + + + 2.0 + + + + jira + http://issues.apache.org/jira/browse/TUSCANY + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + ibiblio + ibiblio + http://www.ibiblio.org/maven2 + + + + + spec + sdo + das + sca + samples + sampleapps + + + + + + maven-test-repository + Test Repository + scp://people.apache.org/home/jsdelfino/public_html/maven2 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.apache + http://incubator.apache.org/tuscany/ + + + + + + + + + src/main/java + + **/*.componentType + + + + src/main/resources + + + + + + src/test/java + + **/*.componentType + + + + src/test/resources + + + install + + + + org.apache.maven.wagon + wagon-ssh-external + 1.0-alpha-5 + + + + + + + scm:svn:http://svn.apache.org/repos/asf/incubator/tuscany/java + scm:svn:https://svn.apache.org/repos/asf/incubator/tuscany/java + http://svn.apache.org/viewcvs.cgi/incubator/tuscany/java + + + + + + + maven-javadoc-plugin + + + maven-jxr-plugin + + + + + + + distribution + + + + tuscany.home + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.0 + + + package + package + + javadoc + + + + + + http://java.sun.com/j2se/1.5.0/docs/api/ + + + + ../sca-api + ${tuscany.home}/spec/sca/target/site/apidocs + + + ../sdo-api + ${tuscany.home}/spec/sdo/target/site/apidocs + + + ../tuscany-common + ${tuscany.home}/sca/common/target/site/apidocs + + + ../tuscany-model + ${tuscany.home}/sca/model/target/site/apidocs + + + ../tuscany-core + ${tuscany.home}/sca/core/target/site/apidocs + + + ../tuscany-databinding-sdo + ${tuscany.home}/sca/databinding/sdo/target/site/apidocs + + + + true + true + - +
${project.name}
+
${project.name}
+
+
+ + maven-antrun-plugin + + + create-dist + install + + + + + + + + + + + + + + run + + + + clean-dist + clean + + + + + + + + + + + + + + run + + + + + +
+ +
+
+
+
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/build.xml new file mode 100644 index 0000000000..5d53fde251 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/build.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/pom.xml new file mode 100644 index 0000000000..4a7bc56abf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/pom.xml @@ -0,0 +1,125 @@ + + + + + org.apache.tuscany.samples.bigbank + bigbank-scenario + incubating-M1 + + 4.0.0 + sample-bigbank-account + war + Tuscany BigBank Account Module + BigBank Scenario - Account Management Module + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + org.apache.tuscany.sca.bindings + tuscany-binding-axis2 + ${pom.version} + provided + + + org.apache.tuscany.das + tuscany-das-rdb + ${pom.version} + provided + + + javax.servlet + servlet-api + 2.4 + provided + + + org.apache.derby + derby + 10.1.2.1 + provided + + + + junit + junit + 3.8.1 + test + + + + + + + org.apache.tuscany + tuscany-sdo-plugin + + + + + ${basedir}/src/main/resources/wsdl + true + true + true + + + generate + + + + + + org.apache.tuscany.sca.plugins + tuscany-plugin-wsdl2java + + + + + + ${basedir}/src/main/resources/wsdl/stockquotes.webservicex.wsdl + + + StockQuoteSoap + + + + + ${basedir}/src/main/resources/wsdl/AccountService.wsdl + + + + + generate + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/readme.htm new file mode 100644 index 0000000000..d7e35ae92b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/readme.htm @@ -0,0 +1,20 @@ + + + + + + + + + Tuscany Hello World Web Sample + + + + + + +Please see +../readme.htm + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java new file mode 100644 index 0000000000..304244b7db --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/account/AccountServiceImpl.java @@ -0,0 +1,260 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.account.services.account; + +import java.rmi.RemoteException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import bigbank.account.services.accountdata.AccountDataService; +import bigbank.account.services.stockquote.StockQuote; +import bigbank.account.services.stockquote.StockQuoteService; + +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountService; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +@Service(interfaces = AccountService.class) +public class AccountServiceImpl implements AccountService { + + public static final String CHECKING_ACCOUNT_PREFIX = "134-43-394"; + + public static final String SAVINGS_ACCOUNT_PREFIX = "134-42-623"; + + public static final String ACCOUNT_TYPE_SAVINGS = "savings"; + + public static final String ACCOUNT_TYPE_CHECKINGS = "checkings"; + + public static final DateFormat tsformatXSDDateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz"); + static { + AccountServiceImpl.tsformatXSDDateTime.setTimeZone(TimeZone.getTimeZone("UTC")); + } + + private float currencyConversion = 1.0f; + private String currency= "USD"; + + @Property + public void setCurrency(final String currency) { + this.currency= currency == null ? this.currency: currency.trim(); + + if ("USD".equals(this.currency)) + currencyConversion= 1.0f; + else if ("EURO".equals(this.currency)) + currencyConversion= 0.8f; + else{ + try { + currencyConversion = Float.parseFloat(this.currency); + } catch (Exception e) { + currencyConversion= 1.0f; + } + + } + + } + + private AccountDataService accountDataService; + + @Reference + public void setAccountDataService(AccountDataService accountDataService) { + this.accountDataService = accountDataService; + } + + private StockQuoteService stockQuoteService; + + @Reference + public void setStockQuoteService(StockQuoteService stockQuoteService) { + this.stockQuoteService = stockQuoteService; + } + + public AccountServiceImpl() { + } + + @SuppressWarnings("unchecked") + public AccountReport getAccountReport(int customerID) throws RemoteException { + + try { + AccountReport accountReport = accountDataService.getAccountReport(customerID); + //convert to local currency. + List accounts = accountReport.getAccountSummaries(); + for(AccountSummary accountSummary : accounts){ + accountSummary.setBalance(fromUSDollarToCurrency(accountSummary.getBalance())); + + } + return updateStockInformation(accountReport); + } catch (Exception e) { + e.printStackTrace(); + if (e instanceof RemoteException) + throw (RemoteException) e; + else + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + private AccountReport updateStockInformation(AccountReport accountReport) throws RemoteException { + List stocks = accountReport.getStockSummaries(); + if (stocks.size() < 1) + return accountReport; // nothing todo + HashSet owned = new HashSet(stocks.size()); + for (StockSummary stock : stocks) { + owned.add(stock.getSymbol()); + } + ArrayList ownedStr = new ArrayList(owned.size() * 5); + for (String s : owned) { + + ownedStr.add(s); + } + + Map stockInfo = stockQuoteService.getQuotes((String[]) ownedStr.toArray(new String[owned.size()])); + + for (StockSummary stock : stocks) { + String symbol = stock.getSymbol(); + StockQuote stockquote = stockInfo.get(symbol); + if (stockquote == null) { + stock.setCurrentPrice(Float.NaN); + stock.setCompany("*not found*"); + stock.setHighPrice(Float.NaN); + stock.setLowPrice(Float.NaN); + + } else { + stock.setCurrentPrice(fromUSDollarToCurrency(convertToFloat(stockquote.getStockQuote()))); + stock.setCompany(stockquote.getCompanyName()); + stock.setHighPrice(fromUSDollarToCurrency(convertToFloat(stockquote.getDayHighPrice()))); + stock.setLowPrice(fromUSDollarToCurrency(convertToFloat(stockquote.getDayLowPrice()))); + } + } + + return accountReport; + } + + float convertToFloat(final String s) { + + try { + return Float.parseFloat(s); + } catch (Exception e) { + return Float.NaN; + } + + } + + private float fromUSDollarToCurrency(float value) { + return value * currencyConversion ; + + + } + private float toUSDollarfromCurrency(float value) { + + return value /currencyConversion ; + } + + + public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException { + + try { + return accountDataService.getCustomerProfile(logonID); + } catch (Exception e) { + e.printStackTrace(); + if (e instanceof RemoteException) + throw (RemoteException) e; + else + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + + } + + public float deposit(String account, float ammount) throws RemoteException { + try { + return accountDataService.deposit(account, toUSDollarfromCurrency(ammount)); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public StockSummary purchaseStock(int id, StockSummary stock) throws RemoteException { + try { + String symbol = stock.getSymbol(); + Map stockInfo = stockQuoteService.getQuotes(new String[] { symbol }); + + StockQuote stockQuote = stockInfo.get(symbol); + stock.setPurchasePrice(Float.parseFloat(stockQuote.getStockQuote())); + String purchaseDate = tsformatXSDDateTime.format(new Date()); + if (purchaseDate.endsWith("UTC")) + purchaseDate = purchaseDate.substring(0, purchaseDate.length() - 3) + "Z"; + stock.setPurchaseDate(purchaseDate); + + return accountDataService.purchaseStock(id, stock); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException { + try { + return accountDataService.sellStock(purchaseLotNumber, quantity); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public float withdraw(String account, float ammount) throws RemoteException { + try { + return accountDataService.withdraw(account, toUSDollarfromCurrency(ammount)); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + try { + return accountDataService.createAccount(customerProfile, createSavings, createCheckings); + } catch (RemoteException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass() + " " + e.getMessage(), e); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java new file mode 100644 index 0000000000..4c44ca307e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataService.java @@ -0,0 +1,77 @@ +/** + * + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.account.services.accountdata; + + +public interface AccountDataService { + + /** + * Auto generated method signatures + * @param param0* @param param1* @param param2 + */ + public com.bigbank.account.StockSummary purchaseStock( + int param0,com.bigbank.account.StockSummary parm1) throws java.rmi.RemoteException; + + + /** + * Auto generated method signatures + * @param param4 + */ + public com.bigbank.account.CustomerProfileData getCustomerProfile( + java.lang.String param4) throws java.rmi.RemoteException; + + + /** + * Auto generated method signatures + * @param param6* @param param7 + */ + public float deposit( + java.lang.String param6,float param7) throws java.rmi.RemoteException; + + + /** + * Auto generated method signatures + * @param param9* @param param10* @param param11 + */ + public com.bigbank.account.CustomerProfileData createAccount( + com.bigbank.account.CustomerProfileData param9,boolean param10,boolean param11) throws java.rmi.RemoteException; + + + /** + * Auto generated method signatures + * @param param13* @param param14 + */ + public com.bigbank.account.StockSummary sellStock( + int param13,int param14) throws java.rmi.RemoteException; + + + /** + * Auto generated method signatures + * @param param16* @param param17 + */ + public float withdraw( + java.lang.String param16,float param17) throws java.rmi.RemoteException; + + + /** + * Auto generated method signatures + * @param param19 + */ + public com.bigbank.account.AccountReport getAccountReport( + int param19) throws java.rmi.RemoteException; + + + } diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java new file mode 100644 index 0000000000..39c319b7a5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceDASImpl.java @@ -0,0 +1,397 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.account.services.accountdata; + +import java.io.InputStream; +import java.rmi.RemoteException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.List; +import java.util.Properties; +import java.util.TimeZone; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; +import org.apache.tuscany.das.rdb.Converter; +import org.osoa.sca.annotations.Service; + +import bigbank.account.services.account.AccountServiceImpl; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.DataGraphRoot; +import com.bigbank.account.StockSummary; +import commonj.sdo.DataObject; +import commonj.sdo.helper.TypeHelper; + +@Service(AccountDataService.class) +public class AccountDataServiceDASImpl implements AccountDataService { + + static public String dbDirectory = null; + + public static final DateFormat tsformatXSDDateTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz"); + + public static final DateFormat sqlformatDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSz"); + + static { + tsformatXSDDateTime.setTimeZone(TimeZone.getTimeZone("UTC")); + + } + + public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException { + + try { + InputStream mapping = createConfigStream(); + Command select = Command.FACTORY.createCommand( + "SELECT firstName, lastName, loginID, password, id FROM customers where loginID = :loginID", mapping); + Connection conn = getConnection(); + select.setConnection(conn); + select.setParameterValue("loginID", logonID); + TypeHelper helper = TypeHelper.INSTANCE; + + select.setDataObjectModel(helper.getType(DataGraphRoot.class)); + + DataGraphRoot root = (DataGraphRoot) select.executeQuery(); + conn.close(); + + Collection customers = root.getCustomerProfileData(); + CustomerProfileData customerProfileData = (CustomerProfileData) customers.iterator().next(); + + + return customerProfileData; + } catch (Exception e) { + + e.printStackTrace(); + RemoteException re = new RemoteException("Failed to get customer profile'" + logonID + "' ", e); + re.printStackTrace(); + throw re; + } + } + + protected static final String driver = "org.apache.derby.jdbc.EmbeddedDriver"; + + protected static final String protocol = "jdbc:derby:"; + + public CustomerProfileData testgetCustomerByLoginIDThroughDASRead(final String logonID) throws Exception { + + InputStream mapping = createConfigStream(); + + Command select = Command.FACTORY.createCommand("SELECT firstName, lastName, loginID, password, id FROM customers where loginID = :loginID", + mapping); + Connection conn = getConnection(); + select.setConnection(conn); + select.setParameterValue("loginID", logonID); + TypeHelper helper = TypeHelper.INSTANCE; + + select.setDataObjectModel(helper.getType(DataGraphRoot.class)); + + DataGraphRoot root = (DataGraphRoot) select.executeQuery(); + conn.close(); + + Collection customers = root.getCustomerProfileData(); + CustomerProfileData customerProfileData = (CustomerProfileData) customers.iterator().next(); + return customerProfileData; + + } + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + + try { + Command insert = Command.FACTORY.createCommand("insert into customers (firstName,lastName,address,email, loginID, password ) values ('" + + customerProfile.getFirstName() + "', '" + customerProfile.getLastName() + "', '" + customerProfile.getAddress() + "', '" + + customerProfile.getEmail() + "', '" + customerProfile.getLoginID() + "', '" + customerProfile.getPassword() + "')"); + insert.setConnection(getConnection()); + insert.execute(); + CustomerProfileData ret = getCustomerProfile(customerProfile.getLoginID()); + String cid = ret.getId() + ""; + if (createSavings) { + insert = Command.FACTORY.createCommand("insert into accounts (id,accountNumber, accountType, balance ) values (" + cid + ", '" + + AccountServiceImpl.SAVINGS_ACCOUNT_PREFIX + cid + "', '" + AccountServiceImpl.ACCOUNT_TYPE_SAVINGS + "', " + 1.0F + ")"); + insert.setConnection(getConnection()); + insert.execute(); + + } + if (createCheckings) { + insert = Command.FACTORY.createCommand("insert into accounts (id,accountNumber, accountType, balance ) values (" + cid + ", '" + + AccountServiceImpl.CHECKING_ACCOUNT_PREFIX + cid + "', '" + AccountServiceImpl.ACCOUNT_TYPE_CHECKINGS + "', " + 1.0F + ")"); + insert.setConnection(getConnection()); + insert.execute(); + + } + + return ret; + } catch (Exception e) { + if (e instanceof RemoteException) + throw (RemoteException) e; + throw new RemoteException("createAccount " + e.getClass().getName() + "'. " + e.getMessage(), e); + } + } + + public CustomerProfileData createAccountNOTWORKING(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + try { + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(createConfigStream()); + commandGroup.setConnection(getConnection()); + Command read = commandGroup.getCommand("all customers"); + + // select.setDataObjectModel(); + TypeHelper helper = TypeHelper.INSTANCE; + read.setDataObjectModel(helper.getType(DataGraphRoot.class)); + DataObject root = read.executeQuery(); + + // Create a new stockPurchase + DataObject customer = root.createDataObject("customerProfileData"); + + // THIS SEEMS TO BE THE ONLY WAY TO DO THIS .. NO WAY TO JUST ADD AN EXISTING CUSTOMER. + customer.set("firstName", customerProfile.getFirstName()); + customer.set("lastName", customerProfile.getLastName()); + customer.set("address", customerProfile.getAddress()); + customer.set("email", customerProfile.getEmail()); + customer.set("loginID", customerProfile.getLoginID()); + customer.set("password", customerProfile.getPassword()); + + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + apply.execute(root); + return getCustomerProfile(customerProfile.getLoginID()); + + } catch (Exception e) { + if (e instanceof RemoteException) + throw (RemoteException) e; + throw new RemoteException("createAccount " + e.getClass().getName() + "'. " + e.getMessage(), e); + } + + } + + public AccountReport getAccountReport(final int customerID) throws RemoteException { + try { + final AccountFactory accountFactory = AccountFactory.INSTANCE; + final AccountReport accountReport = accountFactory.createAccountReport(); + InputStream mapping = createConfigStream(); + + Command select = Command.FACTORY.createCommand("SELECT accountNumber, accountType, balance FROM accounts where id = :id", mapping); + Connection conn = getConnection(); + select.setConnection(conn); + select.setParameterValue("id", customerID); + TypeHelper helper = TypeHelper.INSTANCE; + select.setDataObjectModel(helper.getType(DataGraphRoot.class)); + DataGraphRoot root = (DataGraphRoot) select.executeQuery(); + accountReport.getAccountSummaries().addAll(root.getAccountSummaries()); + + // Get Stocks + + select = Command.FACTORY.createCommand( + "SELECT Symbol, quantity, purchasePrice, purchaseDate, purchaseLotNumber FROM stocks where id = :id", createConfigStream()); + select.setConnection(conn); + select.setParameterValue("id", customerID); + select.setDataObjectModel(helper.getType(DataGraphRoot.class)); + + // select.addConverter("STOCKS.PURCHASEDATE", DateConverter.class.getName()); + + root = (DataGraphRoot) select.executeQuery(); + accountReport.getStockSummaries().addAll(root.getStockSummaries()); + + conn.close(); + + return accountReport; + } catch (Exception e) { + if (e instanceof RemoteException) + throw (RemoteException) e; + throw new RemoteException("getAccountReport failed. customerID ('" + customerID + "')" + e.getClass().getName() + "'. " + e.getMessage(), + e); + } + } + + public float withdraw(String account, float ammount) throws RemoteException { + + return deposit(account, -ammount); + } + + public float deposit(String account, float ammount) throws RemoteException { + + try { + Command select = Command.FACTORY.createCommand("SELECT accountNumber, balance FROM accounts where accountNumber = :accountNumber", + createConfigStream()); + Connection conn = getConnection(); + select.setConnection(conn); + select.setParameterValue("accountNumber", account); + TypeHelper helper = TypeHelper.INSTANCE; + select.setDataObjectModel(helper.getType(DataGraphRoot.class)); + DataGraphRoot root = (DataGraphRoot) select.executeQuery(); + Collection accounts = root.getAccountSummaries(); + AccountSummary accountData = (AccountSummary) accounts.iterator().next(); + float newbalance = accountData.getBalance() + ammount; + accountData.setBalance(newbalance); + // update department set companyid = ? where department.name = ? + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(createConfigStream()); + commandGroup.setConnection(conn); + Command update = commandGroup.getCommand("update balance"); + update.setParameterValue("BALANCE", new Float(newbalance)); + update.setParameterValue("ACCOUNTNUMBER", account); + update.execute(); + conn.close(); + return newbalance; + } catch (Exception e) { + throw new RemoteException(e.getClass().getName(), e); + } + + } + + public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException { + try { + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(createConfigStream()); + commandGroup.setConnection(getConnection()); + + Command read = commandGroup.getCommand("stockbylotSelect"); + TypeHelper helper = TypeHelper.INSTANCE; + read.setDataObjectModel(helper.getType(DataGraphRoot.class)); + read.setParameterValue("PURCHASELOTNUMBER", purchaseLotNumber);// autoboxing :-) + DataGraphRoot root = (DataGraphRoot) read.executeQuery(); + List stocks = root.getStockSummaries(); + if (null != stocks && !stocks.isEmpty()) { + StockSummary stock = (StockSummary) stocks.get(0); + int newQuatity = Math.max(stock.getQuantity() - quantity, 0); + if (newQuatity < 1) { + + Command delete = Command.FACTORY.createCommand("DELETE FROM STOCKS WHERE PURCHASELOTNUMBER = ?"); + delete.setParameterValue(1, purchaseLotNumber); + delete.setConnection(getConnection()); + delete.execute(); + + } else { + + Command update = commandGroup.getCommand("stockbylot"); + + update.setParameterValue("QUANTITY", newQuatity); + update.setParameterValue("PURCHASELOTNUMBER", purchaseLotNumber); + update.execute(); + + stock.setQuantity(newQuatity); + } + + } + + return null; + } catch (Exception e) { + throw new RemoteException("sellStock", e); + } + } + + public StockSummary purchaseStock(int id, StockSummary stock) throws RemoteException { + + try { + + Command insert = Command.FACTORY + .createCommand("insert into stocks (id, symbol, quantity, purchasePrice, purchaseDate) values (?,?,?,?,?)"); + insert.setParameterValue(1, new Integer(id)); + insert.setParameterValue(2, stock.getSymbol()); + insert.setParameterValue(3, stock.getQuantity()); + insert.setParameterValue(4, stock.getPurchasePrice()); + insert.setParameterValue(5, DateConverter.INSTANCE.getColumnValue(stock.getPurchaseDate())); + + insert.setConnection(getConnection()); + insert.execute(); + + return stock; + } catch (Exception e) { + if (e instanceof RemoteException) + throw (RemoteException) e; + throw new RemoteException("purchaseStock " + e.getClass().getName() + "'. " + e.getMessage(), e); + } + } + + protected Connection getConnection() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { + Connection conn; + Class.forName(driver).newInstance(); + Properties props = new Properties(); + // props.put("user", "tuscany"); + // props.put("password", "tuscany"); + conn = DriverManager.getConnection(protocol + dbDirectory + ";create=true", props); + + conn.setAutoCommit(false); + return conn; + } + + protected InputStream createConfigStream() { + InputStream mapping = getClass().getClassLoader().getResourceAsStream("DasAccountConfiguration.xml"); + return mapping; + } + + public static class DateConverter implements Converter { + public final static DateConverter INSTANCE = new DateConverter(); + + public DateConverter() { + } + + public Object getPropertyValue(Object columnData) { + + try { + + String ret = tsformatXSDDateTime.format(columnData); + if (ret.endsWith("UTC")) + ret = ret.substring(0, ret.length() - 3) + "Z"; + return ret; + + } catch (Exception e) { + + e.printStackTrace(); + throw new IllegalArgumentException(e); + } + + } + + public Object getColumnValue(Object propertyData) { + + if (propertyData instanceof java.util.Date) { + // Need to convert back to local time for DB and remove timezone notation at the end.. + String ret = sqlformatDateTime.format(propertyData); + char lc = ret.charAt(ret.length() - 1); + while (!Character.isDigit(lc)) { + ret = ret.substring(0, ret.length() - 1); + lc = ret.charAt(ret.length() - 1); + } + return ret; + } else if (propertyData instanceof String) { + + try { + String time = (String) propertyData; + char last = time.charAt(time.length() - 1); + if (last == 'z' || last == 'Z') { + time = time.substring(0, time.length() - 1); + } + if (!time.endsWith("UTC")) { + time = time + "UTC"; + } + return getColumnValue(tsformatXSDDateTime.parse(time)); + } catch (ParseException e) { + throw new IllegalArgumentException("'" + propertyData + "' does not parse to date."); + } + } else + throw new IllegalArgumentException(); + + } + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..3b9a64dda5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,99 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.account.services.accountdata; + +import java.rmi.RemoteException; +import java.util.List; + +import org.osoa.sca.annotations.Service; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +@Service(AccountDataService.class) +public class AccountDataServiceImpl implements AccountDataService { + + public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public AccountReport getAccountReport(int customerID) { + final AccountFactory accountFactory = AccountFactory.INSTANCE; + AccountReport accountReport = accountFactory.createAccountReport(); + List accounts = accountReport.getAccountSummaries(); + + AccountSummary account = accountFactory.createAccountSummary(); + account.setAccountType("1111"); + account.setAccountNumber("22-22-22"); + account.setBalance(123.45F); + accounts.add(account); + + account = accountFactory.createAccountSummary(); + account.setAccountType("04-11-19"); + account.setAccountNumber("11-23"); + account.setBalance(543.21F); + accounts.add(account); + + List stocks = accountReport.getStockSummaries(); + StockSummary stock = accountFactory.createStockSummary(); + stock.setSymbol("IBM"); + stock.setPurchaseDate("1999-11-23"); + stock.setPurchaseLotNumber(101); + stock.setPurchasePrice(33.33F); + stock.setQuantity(10); + stocks.add(stock); + + stock = accountFactory.createStockSummary(); + stock.setSymbol("TUSK"); + stock.setPurchaseDate("2005-01-05"); + stock.setPurchaseLotNumber(102); + stock.setPurchasePrice(11.11F); + stock.setQuantity(4); + stocks.add(stock); + return accountReport; + } + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public float deposit(String param6, float param7) throws RemoteException { + // TODO Auto-generated method stub + return 0; + } + + public StockSummary purchaseStock(int param0, StockSummary stock) throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public StockSummary sellStock(int param13, int param14) throws RemoteException { + // TODO Auto-generated method stub + return null; + } + + public float withdraw(String param16, float param17) throws RemoteException { + // TODO Auto-generated method stub + return 0; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java new file mode 100644 index 0000000000..42cf6dde2a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/accountdb/AccountDBInit.java @@ -0,0 +1,452 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.account.services.accountdb; + +import java.io.InputStream; +import java.io.PrintStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Date; +import java.util.Properties; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; + +import org.apache.tuscany.das.rdb.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; +import org.apache.tuscany.das.rdb.Converter; +import org.apache.tuscany.das.rdb.config.ConfigFactory; +import org.apache.tuscany.sdo.util.SDOUtil; + +import bigbank.account.services.account.AccountServiceImpl; +import bigbank.account.services.accountdata.AccountDataServiceDASImpl; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.DataGraphRoot; +import com.bigbank.account.StockSummary; +import com.bigbank.account.purchaseStock; +import com.bigbank.account.withdraw; +import commonj.sdo.DataObject; +import commonj.sdo.helper.TypeHelper; + +public class AccountDBInit extends HttpServlet { + + /** + * + */ + private static final long serialVersionUID = -4795999792460944805L; + + protected static final String driver = "org.apache.derby.jdbc.EmbeddedDriver"; + + protected static final String protocol = "jdbc:derby:"; + + boolean deleteExisting = false; + + protected String dbDirectory = null; + + + @Override + public void init() throws ServletException { + try { + + registerTypes(); + ServletConfig servletConfig = getServletConfig(); + ServletContext servletContext = servletConfig.getServletContext(); + this.dbDirectory = servletContext.getRealPath("WEB-INF/bigbankdb/accounts"); + this.deleteExisting = false; + + createDB(dbDirectory); + + + } catch (Exception e) { + + e.printStackTrace(); + log(e.toString(), e); + throw new ServletException(e); + } + } + + public AccountDBInit() { + } + + public AccountDBInit(String dbDirectory, Boolean deleteExisting) { + this.dbDirectory = dbDirectory; + this.deleteExisting = deleteExisting; + } + + public static void createDB(final String location) throws Exception { + Connection conn = null; + AccountDataServiceDASImpl.dbDirectory = location; + Exception processessingException = null; + try { + conn = createConnection(location); + + creatTables(conn); + + int id = createCustomer(conn, "Test", "User", "304 Fox Trot ln, Apex, NC", "test@das.org", "test", "password"); + createAccount(conn, id, AccountServiceImpl.SAVINGS_ACCOUNT_PREFIX + id, AccountServiceImpl.ACCOUNT_TYPE_SAVINGS, 123.43F); + createAccount(conn, id, AccountServiceImpl.CHECKING_ACCOUNT_PREFIX+id, AccountServiceImpl.ACCOUNT_TYPE_CHECKINGS, 23.12F); + createStockPurchase(conn, id, "IBM", 33, 66.20F, "2005-11-23 13:22:02"); + createStockPurchase(conn, id, "DELL", 13, 12.74F, "2003-01-03 11:04:03"); + createStockPurchase(conn, id, "LU", 7, 2.74F, "2003-01-04 16:04:03"); + createStockPurchase(conn, id, "IBM", 22, 81.43F, "2004-02-03 13:04:33"); + + id = createCustomer(conn, "test2", "demo2", "Pleasant Plains Rd, ViewMount, CO","test2@das.org", "test2", "password"); + createAccount(conn, id, AccountServiceImpl.SAVINGS_ACCOUNT_PREFIX + id, AccountServiceImpl.ACCOUNT_TYPE_SAVINGS, 924.40F); + createAccount(conn, id, AccountServiceImpl.CHECKING_ACCOUNT_PREFIX+id, AccountServiceImpl.ACCOUNT_TYPE_CHECKINGS, 33.26F); + createStockPurchase(conn, id, "FOO", 3, 6.20F, "2000-09-11 09:11:01"); + + + + conn.commit(); + + + + } catch (org.apache.derby.impl.jdbc.EmbedSQLException e) { + if (conn != null && !conn.isClosed()) + conn.rollback(); + if (e.getErrorCode() == 20000 && "X0Y32".equalsIgnoreCase(e.getSQLState()) && -1 != e.getMessage().indexOf("already exists")) { + // this is ok the database is there. + + } else { + + e.printStackTrace(); + processessingException = e; + throw e; + } + } finally { + try { + if (null != conn && !conn.isClosed()) { + + conn.close(); + } + conn = null; + } catch (Exception e) { + e.printStackTrace(); + if (null != processessingException) { + throw e; + } + } + } + + } + + private Connection createConnection() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { + return createConnection(dbDirectory); + } + + private static Connection createConnection(final String location) throws InstantiationException, IllegalAccessException, ClassNotFoundException, + SQLException { + Connection conn; + Class.forName(driver).newInstance(); + Properties props = new Properties(); + conn = DriverManager.getConnection(protocol + location + ";create=true", props); + + conn.setAutoCommit(false); + return conn; + } + + protected static void creatTables(Connection conn) throws Exception { + + + + Statement s = conn.createStatement(); + s + .execute("create table customers(firstName varchar(80) NOT NULL, lastName varchar(80), address varchar(180),email varchar(40),loginID varchar(80) NOT NULL UNIQUE, password varchar(80), id int NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY)"); + + s.execute("create table accounts(id int NOT NULL, accountNumber varchar(80) NOT NULL UNIQUE, accountType varchar(80), balance real )"); + + s + .execute("create table stocks(id int NOT NULL, Symbol varchar(8) NOT NULL, quantity int NOT NULL, purchasePrice real NOT NULL, purchaseDate TIMESTAMP, purchaseLotNumber int NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY )"); + + s.close(); + } + + protected static int createCustomer(Connection conn, final String firstName, final String lastName, final String address, final String email, final String logonID, final String password) + throws SQLException, Exception { + Statement s = conn.createStatement(); + + s.execute("insert into customers (firstName,lastName,address,email, loginID, password ) values ('" + firstName + "', '" + lastName + "', '"+ address + "', '" + email + "', '" + logonID + + "', '" + password + "')"); + + ResultSet rs = s.executeQuery("SELECT loginID, id FROM customers where loginID='" + logonID + "'"); + if (!rs.next()) { + throw new Exception("Wrong number of rows"); + } + int id = rs.getInt(2); + s.close(); + + return id; + } + + protected static void createAccount(Connection conn, int customerID, final String accountNumber, final String accountType, final float balance) + throws SQLException, Exception { + Statement s = conn.createStatement(); + + s.execute("insert into accounts (id,accountNumber, accountType, balance ) values (" + customerID + ", '" + accountNumber + "', '" + + accountType + "', " + balance + ")"); + + s.close(); + + + } + + protected InputStream createConfigStream() { + InputStream mapping = getClass().getClassLoader().getResourceAsStream("basicStaticCustomer.xml"); + return mapping; + } + + protected static void createStockPurchase(Connection conn, int customerID, final String stockSymbol, final int quantity, final float purchasePrice, + String purchaseDate) throws SQLException, Exception { + Statement s = conn.createStatement(); + + s.execute("insert into stocks (id, symbol, quantity, purchasePrice, purchaseDate ) values (" + customerID + ", '" + stockSymbol + "', " + + quantity + ", " + purchasePrice + ", '" + purchaseDate + "')"); + + s.close(); + + } + + protected static void registerTypes() { + SDOUtil.registerStaticTypes(AccountFactory.class); + // TODO remove + SDOUtil.registerStaticTypes(ConfigFactory.class); + + } + + /** + * @param args + */ + public static void main(String[] args) throws Exception { + registerTypes(); + String dbDirectory = null; // "c:/derbydbtest/foo"; + Boolean deleteExisting = false; + for (String x : args) { + if ("-d".equals(x)) { + deleteExisting = true; + } + if (!x.startsWith("-")) { + dbDirectory = x; + } + + } + AccountDBInit accountDBInit = new AccountDBInit(dbDirectory, deleteExisting); + + createDB(dbDirectory); + accountDBInit.readDBstdout(System.out); + + + // Test withdrawl + withdraw wd = AccountFactory.INSTANCE.createwithdraw(); + wd.setAccountNumber("134-43-39438"); + wd.setAmount(1.00F); + // accountDBInit.testWithdrawThroughDAS(wd); + + // test stock purchase. + + purchaseStock sp = AccountFactory.INSTANCE.createpurchaseStock(); + StockSummary stock= AccountFactory.INSTANCE.createStockSummary(); + sp.setStock(stock); + stock.setSymbol("GOOG"); + sp.setId(1); + stock.setQuantity(10); + accountDBInit.testStrockPurchaseThroughDAS(sp); + + accountDBInit.readDBstdout(System.out); + + System.out.flush(); + } + + protected void testStrockPurchaseThroughDAS(purchaseStock sp) throws InstantiationException, IllegalAccessException, ClassNotFoundException, + SQLException { + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(createConfigStream()); + commandGroup.setConnection(createConnection()); + Command read = commandGroup.getCommand("all stocks"); + + DataObject root = read.executeQuery(); + + // Create a new stockPurchase + DataObject stockPurchase = root.createDataObject("STOCKS"); + stockPurchase.set("ID", new Integer(sp.getId())); + stockPurchase.set("SYMBOL", sp.getStock().getSymbol()); + stockPurchase.set("QUANTITY", new Integer(sp.getStock().getQuantity())); + stockPurchase.set("PURCHASEPRICE", new Float(11.00)); + stockPurchase.set("PURCHASEDATE", new Date()); + + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + + apply.execute(root); + + + + } + + public CustomerProfileData testgetCustomerByLoginIDThroughDASRead(final String logonID) throws Exception { + + InputStream mapping = createConfigStream(); + + Command select = Command.FACTORY.createCommand("SELECT firstName, lastName, loginID, password, id FROM customers where loginID = :loginID", + mapping); + Connection conn = createConnection(); + select.setConnection(conn); + select.setParameterValue("loginID", logonID); + TypeHelper helper = TypeHelper.INSTANCE; + + select.setDataObjectModel(helper.getType(DataGraphRoot.class)); + + DataGraphRoot root = (DataGraphRoot) select.executeQuery(); + conn.close(); + + Collection customers = root.getCustomerProfileData(); + CustomerProfileData customerProfileData = (CustomerProfileData) customers.iterator().next(); + System.out.println(customerProfileData); + System.out.flush(); + return customerProfileData; + + } + + protected void readDBstdout(PrintStream stream) throws Exception { + Connection conn = null; + try { + conn = createConnection(dbDirectory); + Statement s = conn.createStatement(); + ResultSet rs = s.executeQuery("SELECT firstName, lastName, loginID, password, id FROM customers ORDER BY lastName"); + while (rs.next()) { + stream.print(rs.getString(1)); + stream.print(" "); + stream.print(rs.getString(2)); + stream.print(" "); + stream.print(rs.getString(3)); + stream.print(" "); + stream.print(rs.getString(4)); + stream.print(" "); + stream.print(rs.getString(5)); + stream.println(); + int id = rs.getInt(5); + Statement s1 = conn.createStatement(); + ResultSet rs1 = s1.executeQuery("SELECT accountNumber, accountType, balance FROM accounts where id=" + id); + while (rs1.next()) { + stream.print("\t"); + stream.print(rs1.getString(1)); + stream.print(" "); + stream.print(rs1.getString(2)); + stream.print(" "); + stream.print(rs1.getString(3)); + stream.println(); + } + rs1.close(); + rs1 = s1.executeQuery("SELECT symbol, quantity, purchasePrice, purchaseDate, purchaseLotNumber FROM stocks where id=" + id); + while (rs1.next()) { + stream.print("\t"); + stream.print(rs1.getString(1)); + stream.print(" "); + stream.print(rs1.getString(2)); + stream.print(" "); + stream.print(rs1.getString(3)); + stream.print(" "); + stream.print(rs1.getString(4)); + stream.print(" "); + stream.print(rs1.getString(5)); + stream.println(); + } + s1.close(); + stream.println(); + + } + s.close(); + conn.commit(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (conn != null) + conn.close(); + conn = null; + } + + } + + public void testWithdrawThroughDAS(withdraw wd) throws Exception { + + Command select = Command.FACTORY.createCommand("SELECT accountNumber, balance FROM accounts where accountNumber = :accountNumber", + createConfigStream()); + Connection conn = createConnection(); + select.setConnection(conn); + select.setParameterValue("accountNumber", wd.getAccountNumber()); + TypeHelper helper = TypeHelper.INSTANCE; + + select.setDataObjectModel(helper.getType(DataGraphRoot.class)); + + DataGraphRoot root = (DataGraphRoot) select.executeQuery(); + + Collection accounts = root.getAccountSummaries(); + AccountSummary account = (AccountSummary) accounts.iterator().next(); + float newbalance = account.getBalance() - wd.getAmount(); + account.setBalance(newbalance); + // update department set companyid = ? where department.name = ? + + CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(createConfigStream()); + commandGroup.setConnection(conn); + Command update = commandGroup.getCommand("update balance"); + update.setParameterValue("BALANCE", new Float(newbalance)); + update.setParameterValue("ACCOUNTNUMBER", wd.getAccountNumber()); + + update.execute(); + conn.close(); + + } + + public static class MyDateConverter implements Converter { + + private static DateFormat tsformat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + + public Object getPropertyValue(Object columnData) { + + try { + return tsformat.parse(columnData.toString()); + } catch (ParseException e) { + + e.printStackTrace(); + throw new IllegalArgumentException(e); + } + + } + + public Object getColumnValue(Object propertyData) { + + if (propertyData instanceof Date) { + return tsformat.format(propertyData); + } else + throw new IllegalArgumentException(); + + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java new file mode 100644 index 0000000000..627ab7b379 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java @@ -0,0 +1,223 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.account.services.stockquote; + +public class StockQuote { + + private String companyName; + + private String symbol; + + private String stockQuote; + + private String lastUpdated; + + private String change; + + private String openPrice; + + private String dayHighPrice; + + private String dayLowPrice; + + private String volume; + + private String marketCap; + + private String yearRange; + + private String exDividendDate; + + private String dividendYield; + + private String dividendPerShare; + + /** + * + * + * @generated + */ + protected StockQuote() { + super(); + } + + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(String newCompanyName) { + companyName = newCompanyName; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String newStockTicker) { + symbol = newStockTicker; + } + + public String getStockQuote() { + return stockQuote; + } + + public void setStockQuote(String newStockQuote) { + stockQuote = newStockQuote; + } + + public String getLastUpdated() { + return lastUpdated; + } + + public void setLastUpdated(String newLastUpdated) { + lastUpdated = newLastUpdated; + } + + public String getChange() { + return change; + } + + public void setChange(String newChange) { + change = newChange; + } + + public String getOpenPrice() { + return openPrice; + } + + public void setOpenPrice(String newOpenPrice) { + openPrice = newOpenPrice; + } + + public String getDayHighPrice() { + return dayHighPrice; + } + + public void setDayHighPrice(String newDayHighPrice) { + dayHighPrice = newDayHighPrice; + } + + public String getDayLowPrice() { + return dayLowPrice; + } + + public void setDayLowPrice(String newDayLowPrice) { + dayLowPrice = newDayLowPrice; + } + + public String getVolume() { + return volume; + } + + public void setVolume(String newVolume) { + volume = newVolume; + } + + public String getMarketCap() { + return marketCap; + } + + public void setMarketCap(String newMarketCap) { + marketCap = newMarketCap; + } + + public String getYearRange() { + return yearRange; + } + + public void setYearRange(String newYearRange) { + yearRange = newYearRange; + } + + public String getExDividendDate() { + return exDividendDate; + } + + public void setExDividendDate(String newExDividendDate) { + exDividendDate = newExDividendDate; + } + + public String getDividendYield() { + return dividendYield; + } + + public void setDividendYield(String newDividendYield) { + dividendYield = newDividendYield; + } + + public String getDividendPerShare() { + return dividendPerShare; + } + + public void setDividendPerShare(String newDividendPerShare) { + dividendPerShare = newDividendPerShare; + } + + public String toString() { + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (companyName: "); + result.append(companyName); + result.append(", symbol: "); + result.append(symbol); + result.append(", stockQuote: "); + result.append(stockQuote); + result.append(", lastUpdated: "); + result.append(lastUpdated); + result.append(", change: "); + result.append(change); + result.append(", openPrice: "); + result.append(openPrice); + result.append(", dayHighPrice: "); + result.append(dayHighPrice); + result.append(", dayLowPrice: "); + result.append(dayLowPrice); + result.append(", volume: "); + result.append(volume); + result.append(", marketCap: "); + result.append(marketCap); + result.append(", yearRange: "); + result.append(yearRange); + result.append(", exDividendDate: "); + result.append(exDividendDate); + result.append(", dividendYield: "); + result.append(dividendYield); + result.append(", dividendPerShare: "); + result.append(dividendPerShare); + result.append(')'); + return result.toString(); + } + public StockQuote clone(){ + StockQuote ret = new StockQuote(); + ret.companyName= companyName; + ret.symbol= symbol; + ret.stockQuote= stockQuote; + ret.lastUpdated= lastUpdated; + ret.change= change; + ret.openPrice= openPrice; + ret.dayHighPrice= dayHighPrice; + ret.dayLowPrice= dayLowPrice; + ret.volume= volume; + ret.marketCap= marketCap; + ret.yearRange= yearRange; + ret.exDividendDate= exDividendDate; + ret.dividendYield= dividendYield; + ret.dividendPerShare= dividendPerShare; + return ret; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..b899d7cbd0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.account.services.stockquote; + +import java.rmi.RemoteException; +import java.util.Map; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface StockQuoteService { + + public Map getQuotes(String[] symbols) throws RemoteException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java new file mode 100644 index 0000000000..039abde4bc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.account.services.stockquote; + +import java.rmi.RemoteException; +import java.util.Hashtable; +import java.util.Map; +import java.util.Random; + +/* Mock StockQuoteService */ + +public class StockQuoteServiceImpl implements StockQuoteService { + + static Random rn = new Random(); + + static Hashtable stocks = new Hashtable(); + + public synchronized Map getQuotes(String[] symbols) throws RemoteException { + Map ret = new Hashtable(); + for (String sym : symbols) { + sym = sym.toUpperCase(); + if (!ret.containsKey(sym)) { + StockQuote sq = stocks.get(sym); + if (sq == null) { + sq = new StockQuote(); + stocks.put(sym, sq); + sq.setSymbol(sym); + sq.setCompanyName(sym + " INC"); + float val = rn.nextFloat() * 97.0F + 3.0F; + sq.setStockQuote(val + ""); + sq.setDayHighPrice(val + ""); + sq.setDayLowPrice(val + ""); + sq.setOpenPrice(val + ""); + } else { + float diff = (rn.nextFloat() * 2.0F) - 1; + float newval = new Float(sq.getStockQuote()) + diff; // auto boxing cool. + sq.setStockQuote(newval + ""); + float dh = Math.max(newval, new Float(sq.getDayHighPrice())); + sq.setDayHighPrice(dh + ""); + float dl = Math.min(newval, new Float(sq.getDayLowPrice())); + sq.setDayLowPrice(dl + ""); + + } + ret.put(sym, (StockQuote) sq.clone()); + } + + } + + return ret; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java new file mode 100644 index 0000000000..f5f481ca1b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java @@ -0,0 +1,150 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.account.services.stockquote; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Method; +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamReader; + +import net.x.webservice.StockQuoteSoap; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the Stock quote service component. + */ +@Service(StockQuoteService.class) +@Scope("MODULE") +public class StockQuoteWebservicexServiceImpl implements StockQuoteService { + + @Reference + public StockQuoteSoap stockQuoteService = null; // Injected by the SCA container. + + /** + * @throws RemoteException + * @see bigbank.account.services.stockquote.StockQuoteService#getQuotes(String[]) + */ + public Map getQuotes(final String[] symbols) throws RemoteException { + try { + assert null != stockQuoteService : "stockQuoteService was not set by the SCA runtime!"; + StringBuilder sb = new StringBuilder(5 * symbols.length); + for (String sym : symbols) { + if (sb.length() != 0) + sb.append(' '); + sb.append(sym); + } + String stockdata = stockQuoteService.GetQuote(sb.toString()); + + InputStream in = new ByteArrayInputStream(stockdata.getBytes()); + XMLInputFactory factory = XMLInputFactory.newInstance(); + XMLStreamReader parser = factory.createXMLStreamReader(in); + ArrayList listQuotes = new ArrayList(); + Hashtable listQuoteHT = new Hashtable(); + MapStock currentStock = null; + StringBuilder currentText = new StringBuilder(100); + for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) { + String lname; + switch (event) { + case XMLStreamConstants.START_ELEMENT: + if (parser.getLocalName() == "Stock") { + + currentStock = new MapStock(); + listQuotes.add(currentStock); + } + break; + case XMLStreamConstants.END_ELEMENT: + lname = parser.getLocalName(); + String mname = "set" + lname; + try { + Method setter = MapStock.class.getMethod(mname, new Class[] { String.class }); + if (setter != null) { + setter.invoke(currentStock, currentText.toString()); + if (lname.equals("Symbol")) { + listQuoteHT.put(currentText.toString(), currentStock); + + } + } + } catch (NoSuchMethodException e) { + + } + // System.err.println(parser.getLocalName() + ":" + currentText.toString()); + currentText.setLength(0); + break; + case XMLStreamConstants.CHARACTERS: + // System.out.print(parser.getText()); + currentText.append(parser.getText()); + break; + case XMLStreamConstants.CDATA: + // System.out.print(parser.getText()); + currentText.append(parser.getText()); + break; + } // end switch + } // end while + parser.close(); + + return listQuoteHT; + } catch (Exception e) { + e.printStackTrace(); + throw new RemoteException(e.getClass().getName() + e.getMessage(), e); + } + } + + public static class MapStock extends StockQuote { + + public void setLast(String val) { + super.setStockQuote(val); + } + + public void setDate(String val) { + }; + + public void setTime(String val) { + }; + + public void setHigh(String val) { + super.setDayHighPrice(val); + } + + public void setLow(String val) { + super.setDayLowPrice(val); + } + + public void setOpen(String val) { + super.setOpenPrice(val); + } + + public void setMktCap(String val) { + super.setMarketCap(val); + } + + public void setName(String val) { + super.setCompanyName(val); + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/DasAccountConfiguration.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/DasAccountConfiguration.xml new file mode 100644 index 0000000000..e558e959fa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/DasAccountConfiguration.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/WebservicexService_stockquote.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/WebservicexService_stockquote.fragment new file mode 100644 index 0000000000..b52ba7fe06 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/WebservicexService_stockquote.fragment @@ -0,0 +1,32 @@ + + + + + + + + + + StockQuoteWebService + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/mock_stockquote.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/mock_stockquote.fragment new file mode 100644 index 0000000000..b7c433d6a1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/mock_stockquote.fragment @@ -0,0 +1,27 @@ + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.fragment new file mode 100644 index 0000000000..b7c433d6a1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.fragment @@ -0,0 +1,27 @@ + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.module new file mode 100644 index 0000000000..b9234573e1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.module @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + AccountServiceComponent/AccountService + + + + + + USD + + + AccountDataServiceComponent + StockQuoteServiceComponent + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.subsystem b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.subsystem new file mode 100644 index 0000000000..fd6ab20151 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/sca.subsystem @@ -0,0 +1,22 @@ + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..c44b826440 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,392 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl new file mode 100644 index 0000000000..e225678888 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/resources/wsdl/stockquotes.webservicex.wsdl @@ -0,0 +1,133 @@ + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get Stock quote for a company Symbol + + + + + + + Get Stock quote for a company Symbol + + + + + + + Get Stock quote for a company Symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..af8fae9d35 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,28 @@ + + + + + Tuscany Bigbank Account sample + + + AccountDBInit + bigbank.account.services.accountdb.AccountDBInit + 2 + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/test/java/bigbank/account/client/AccountClient.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/test/java/bigbank/account/client/AccountClient.java new file mode 100644 index 0000000000..32308169ca --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/account/src/test/java/bigbank/account/client/AccountClient.java @@ -0,0 +1,57 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.account.client; + +import java.util.Iterator; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountService; +import com.bigbank.account.AccountSummary; + +public class AccountClient extends SCA { + + public void start() { + } + + public void stop() { + } + + public static void main(String[] args) throws Exception { + TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.account.testclient", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + AccountService accountService = (AccountService) moduleContext.locateService("AccountServiceComponent"); + + AccountReport accountReport = accountService.getAccountReport(12345); + + for (Iterator i = accountReport.getAccountSummaries().iterator(); i.hasNext();) { + AccountSummary accountSummary = (AccountSummary) i.next(); + + System.out.println(accountSummary.getAccountNumber()); + System.out.println(accountSummary.getAccountType()); + System.out.println(accountSummary.getBalance()); + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/build.xml new file mode 100644 index 0000000000..8697bd1561 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/build.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/Show.Image.html b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/Show.Image.html new file mode 100644 index 0000000000..a06154f6dd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/Show.Image.html @@ -0,0 +1,22 @@ + + + + + +
+ +
+ + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/accountfiles.png b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/accountfiles.png new file mode 100644 index 0000000000..a430b12ca2 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/accountfiles.png differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/modualoverview.png b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/modualoverview.png new file mode 100644 index 0000000000..7e6d7ba25e Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/modualoverview.png differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/webclientfiles.png b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/webclientfiles.png new file mode 100644 index 0000000000..bed1a1731a Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/docs/webclientfiles.png differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/pom.xml new file mode 100644 index 0000000000..72a4c00405 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/pom.xml @@ -0,0 +1,34 @@ + + + + + org.apache.tuscany.sampleapps + tuscany-sampleapps + incubating-M1 + + 4.0.0 + org.apache.tuscany.samples.bigbank + bigbank-scenario + pom + Tuscany BigBank Scenario Sample + incubating-M1 + + + account + webclient + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/readme.htm new file mode 100644 index 0000000000..857a94596f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/readme.htm @@ -0,0 +1,94 @@ + + +Tuscany BigBank Sample Application + +

Tuscany +BigBank Sample Application

+

Overview

+

The Tuscany BigBank sample application  +shows using the Tuscany SCA runtime to build a  financial +application.

Location

This +sample is located in the sampleapps\bigbank +directory. There are two subdirectories in that for the two modules account and webclient. +

Setup

This Setup section is not required if you are +working from a binary distribution. Set up your server as described in +the Tomcat +Setup.  If you are building the sample from source you need to deploy the war files produced in sampleapps\bigbank\account\target and sampleapps\bigbank\webclient\target  +your webapp directory.
+

Running

+Once you've started your web server, use your web browser to view the +following URL http://localhost:8080/sample-bigbank-webclient/
You can either use an already supplied account with Login as test and Password as password, or you can  create a new account.
The +demo is first configured to use a local mock stock quote service that +returns random stock data.  If you want to use an actual stock +quote provider follow these steps:
  • Stop your server by issuing in the apache-tomcat-5.5.17\bin directory
  • Issue shutdown command to stop your web application server.
  • Change the directory to apache-tomcat-5.5.17\webapps\sample-bigbank-account-incubating-M1\WEB-INF\classes
  • Copy the file WebservicexService_stockquote.fragment to sca.fragment
  • Change to the directory  apache-tomcat-5.5.17\bin 
  • issue startup  command to start up the server.
The +sample should now be using the real stock quote provider. The +"sca.fragment" file is loaded and added to the sca.module at runtime.

Introduction

This +example illustrates using Tuscany runtime in building +a financial application using SCA programing model. + The following key concepts are covered: +
  •  Component +implementations. that provide web based  +HTML user interface
  • Component +implementations that provide local +services in Java. Local services implement internal +application business logic such as tracking user state and are not +exposed remotely.
  • Component +implementations that have configuration +properties and service references +to other services
  • Components +that use and configure the +properties and references of component +implementations
  • Entry points +to publish remotable services via a Web Service +binding.
  • External +services to consume remotable services via a Web +Service binding
  • Assembling +implementation, components, entry points and external service into modules. +
  • Creating a module and all of its artifacts as part +of a web application to show a +front-end access to SCA services
  • The +use of Data Access services to persist and retrieve Service Data +Objects from Apache Derby.
  • The +use of  existing Web services in SCA.
BigBank +sample provides the following user services: account balance, making deposits and withdrawals  +to purchase and sell stock, and to view current stock value.
The +sample is organized into two SCA modules: webclient and account. The +webclient module functionality is to provide user information and +obtain user input. The account module is is used to retrieve and store +user information, account information, current stock information and +the purchasing and selling of stock. The two modules interact via web +services through SCA exterenalService and entryPoint.

+Overview of modules.

Webclient


+
Webclient files 
click to enlarge
Java source files implementing SCA components and interfaces.
AccountServiceComponentImpl.javaImplements +the account service.
AccountLoginServiceImpl.javaImplements +the Logiin service.
LoginService.javaInterface +for a services provided by a login  service component.
ProfileService.javaInterface +for a service provided by a profile component.
ProfileServiceImpl.javaImplements +the profile component.
SimpleLoginServiceImpl.javaA +simple in memory login service.
Java source files implementing Web HTML interface.
AccountStatusTag.javaImplements +a jsp tag that displays the account information
StockStatusTag.javaImplements +a jsp tag that displays the stock information.
LoginBarrierTag.javaImplements +a jsp tag that ensures the user is logged in.
ServiceTag.javaPlaces +an SCA service in the JSP page context.
FormServlet.javaProcess +user input and uses the AccountService component.
LoginServlet.javaProcesses +logging in and logout.
Files that will be loaded as resources along classpath.
sca.moduleSCA  module. 
sca.subsystemSCA +subsystem.
AccountService.wsdlWSDL +that  defines the account service.
bigbank-tags.tldDefines +the tag libs for the user interface.
+

Account

+
Webclient files 
click to enlarge
Java source files implementing SCA components and interfaces.
AccountServiceImpl.javaImplements +the account service component.
AccountDataService.javaInterface defined for component implementing  an account's data service.
AccountDataServiceDASImpl.javaA Data Access Service (DAS) implementation of of the Account Data Service.
AccountDataServiceImpl.javaA Data Service implementation not using DAS.
AccountDBInit.javaA utility to just create the database and it table and fill in some initial data.
StockQuote.javaA class to hold the StockQuote information.
StockQuoteService.javaInterface defined for a component implementing a stock quote service.
StockQuoteServiceImpl.javaImplements a fake stock quote service.
StockQuoteWebservicexServiceImpl.javaImplements an actual stock quote service.
Files that will be loaded as resources along classpath.
AccountService.wsdlWSDL +that  defines the account service
stockquotes.webservicex.wsdlActual stock quote service.
DasAccountConfiguration.xmlProvides any needed configuration info including datasource properties, table definitions,
sca.moduleSCA module.
sca.fragrmentLoaded and combined with the existing SCA module.
sca.subsystemProcesses +logging in and logout.
+
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/build.xml new file mode 100644 index 0000000000..6cabfe08f5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/build.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/pom.xml new file mode 100644 index 0000000000..3b51a419fb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/pom.xml @@ -0,0 +1,95 @@ + + + + + org.apache.tuscany.samples.bigbank + bigbank-scenario + incubating-M1 + + 4.0.0 + sample-bigbank-webclient + war + Tuscany BigBank Web Client Module + BigBank Scenario Sample - Web Front-End Module + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + tomcat + servlet-api + 5.0.18 + provided + + + tomcat + jsp-api + 5.0.18 + provided + + + + junit + junit + 3.8.1 + test + + + + + + + org.apache.tuscany + tuscany-sdo-plugin + + + + ${basedir}/src/main/resources/wsdl/AccountService.wsdl + true + true + true + + + + generate + + + + + + org.apache.tuscany.sca.plugins + tuscany-plugin-wsdl2java + + + + ${basedir}/src/main/resources/wsdl/AccountService.wsdl + + + generate + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/readme.htm new file mode 100644 index 0000000000..d7e35ae92b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/readme.htm @@ -0,0 +1,20 @@ + + + + + + + + + Tuscany Hello World Web Sample + + + + + + +Please see +../readme.htm + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/account/AccountServiceComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/account/AccountServiceComponentImpl.java new file mode 100644 index 0000000000..7de9658d34 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/account/AccountServiceComponentImpl.java @@ -0,0 +1,106 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.services.account; + +import java.rmi.RemoteException; + +import org.osoa.sca.ServiceUnavailableException; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountService; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +/** + */ +@Service(AccountService.class) +public class AccountServiceComponentImpl implements AccountService { + + private AccountService accountService; + + @Reference + public void setAccountService(AccountService accountService) { + this.accountService = accountService; + } + + /** + * + */ + public AccountServiceComponentImpl() { + super(); + } + + /** + * @see bigbank.account.services.account.AccountService#getAccountReport(java.lang.String) + */ + public AccountReport getAccountReport(int customerID) { + try { + return accountService.getAccountReport(customerID); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public StockSummary purchaseStock(int customerID, StockSummary stockSummary) throws RemoteException { + try { + return accountService.purchaseStock(customerID, stockSummary); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public CustomerProfileData getCustomerProfile(String param2) throws RemoteException { + try { + return accountService.getCustomerProfile(param2); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public float deposit(String account, float amount) throws RemoteException { + try { + return accountService.deposit(account, amount); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException { + try { + return accountService.sellStock(purchaseLotNumber, quantity); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public float withdraw(String account, float amount) throws RemoteException { + try { + return accountService.withdraw(account, amount); + } catch (Exception e) { + throw new ServiceUnavailableException(e); + } + } + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + + return accountService.createAccount(customerProfile, createSavings, createCheckings); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/AccountLoginServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/AccountLoginServiceImpl.java new file mode 100644 index 0000000000..0de0ef85c3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/AccountLoginServiceImpl.java @@ -0,0 +1,50 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.services.profile; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.bigbank.account.AccountService; +import com.bigbank.account.CustomerProfileData; + +@Service(LoginService.class) +public class AccountLoginServiceImpl implements LoginService { + @Reference + public AccountService accountService; + + @Reference + public ProfileService profileService; + + public int login(String userName, String password) throws RemoteException { + + CustomerProfileData profileData = accountService.getCustomerProfile(userName); + + if (!password.equals(profileData.getPassword())) { + return INVALID_PASSWORD; + } + + profileService.setLoggedIn(true); + profileService.setFirstName(profileData.getFirstName()); + profileService.setLastName(profileData.getLastName()); + profileService.setId(profileData.getId()); + + return SUCCESS; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/LoginService.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/LoginService.java new file mode 100644 index 0000000000..465c1b3e7e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/LoginService.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.services.profile; + +import java.rmi.RemoteException; + +public interface LoginService { + + public static final int SUCCESS = 1; + + public static final int INVALID_LOGIN = -1; + + public static final int INVALID_PASSWORD = -2; + + public int login(String userName, String password) throws RemoteException; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileService.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileService.java new file mode 100644 index 0000000000..2cbfbf489a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileService.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.services.profile; + +public interface ProfileService { + + public String getFirstName(); + + public void setFirstName(String pName); + + public String getLastName(); + + public void setLastName(String pName); + + public boolean isLoggedIn(); + + public void setLoggedIn(boolean pStatus); + + public int getId(); + + public void setId(int pId); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileServiceImpl.java new file mode 100644 index 0000000000..4ae808f31a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/ProfileServiceImpl.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.services.profile; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ProfileService.class) +@Scope("session") +public class ProfileServiceImpl implements ProfileService { + + private String firstName; + + public String getFirstName() { + return firstName; + } + + @Property + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + private String lastName; + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + private boolean loggedIn; + + public boolean isLoggedIn() { + return loggedIn; + } + + public void setLoggedIn(boolean status) { + loggedIn = status; + } + + private int id; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java new file mode 100644 index 0000000000..a8d57fb506 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.services.profile; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(LoginService.class) +public class SimpleLoginServiceImpl implements LoginService { + + public ProfileService profileService; + + @Reference + public void setProfileService(ProfileService profileService) { + this.profileService = profileService; + } + + public int login(String userName, String password) { + + if (!"test".equals(userName)) { + return INVALID_LOGIN; + } + + if (!"password".equals(password)) { + return INVALID_PASSWORD; + } + + profileService.setLoggedIn(true); + profileService.setFirstName("John"); + profileService.setLastName("Doe"); + profileService.setId(12345); + + return SUCCESS; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountStatusTag.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountStatusTag.java new file mode 100644 index 0000000000..c11d3f9e46 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/AccountStatusTag.java @@ -0,0 +1,125 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.tags.account; + +import java.util.Iterator; +import java.util.List; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import bigbank.webclient.services.profile.ProfileService; + +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountService; + +/** + * Retrieves and iterates over account summary information for the current profile by accessing the remotable account service component + */ + +public class AccountStatusTag extends TagSupport { + + // ---------------------------------- + // Constructors + // ---------------------------------- + + public AccountStatusTag() { + super(); + } + + // ---------------------------------- + // Methods + // ---------------------------------- + + private String mAccountService; + + public String getAccountService() { + return mAccountService; + } + + public void setAccountService(String pAccountService) { + mAccountService = pAccountService; + } + + private String mProfileService; + + public String getProfileService() { + return mProfileService; + } + + public void setProfileService(String pProfileService) { + mProfileService = pProfileService; + } + + private String mId; + + public String getId() { + return mId; + } + + public void setId(String pId) { + mId = pId; + } + + private Iterator mIterator; + + public int doStartTag() throws JspException { + ModuleContext moduleContext = CurrentModuleContext.getContext(); + ProfileService profile = (ProfileService) moduleContext.locateService(mProfileService); + if (profile == null) { + throw new JspException("Profile [" + mProfileService + "] not found in current module context"); + } + + AccountService service = (AccountService) moduleContext.locateService(mAccountService); + if (service == null) { + throw new JspException("Service [" + mAccountService + "] not found in current module context"); + } + List summaries; + try { + AccountReport accountReport = service.getAccountReport(profile.getId()); + pageContext.setAttribute("StockSummaries", accountReport.getStockSummaries()); + summaries = accountReport.getAccountSummaries(); + } catch (Exception e) { + throw new JspException(e); + } + mIterator = summaries.iterator(); + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_INCLUDE; + } else { + return SKIP_BODY; + } + } + + public int doAfterBody() { + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_AGAIN; + } else { + return SKIP_BODY; + } + } + + public void release() { + super.release(); + mId = null; + mIterator = null; + } +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockStatusTag.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockStatusTag.java new file mode 100644 index 0000000000..ac0b5f4467 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/account/StockStatusTag.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.tags.account; + +import java.util.Iterator; +import java.util.List; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +/** + * Retrieves and iterates over account summary information for the current profile by accessing the remotable account service component + */ + +public class StockStatusTag extends TagSupport { + + + public StockStatusTag() { + super(); + } + + + private String mId; + + public String getId() { + return mId; + } + + public void setId(String pId) { + mId = pId; + } + + private Iterator mIterator; + + public int doStartTag() throws JspException { + + List summaries = (List) pageContext.getAttribute("StockSummaries"); + if (null == summaries) + return SKIP_BODY; + mIterator = summaries.iterator(); + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_INCLUDE; + } else { + return SKIP_BODY; + } + } + + public int doAfterBody() { + if (mIterator.hasNext()) { + pageContext.setAttribute(mId, mIterator.next()); + return EVAL_BODY_AGAIN; + } else { + pageContext.setAttribute("StockSummaries", null); + return SKIP_BODY; + } + } + + public void release() { + pageContext.setAttribute("StockSummaries", null); + super.release(); + mId = null; + mIterator = null; + } +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/LoginBarrierTag.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/LoginBarrierTag.java new file mode 100644 index 0000000000..e923596bae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/LoginBarrierTag.java @@ -0,0 +1,97 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.tags.sca; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import bigbank.webclient.services.profile.ProfileService; + +public class LoginBarrierTag extends TagSupport { + + public LoginBarrierTag() { + super(); + } + + private String mProfile; + + public String getProfile() { + return mProfile; + } + + public void setProfile(String pProfile) { + mProfile = pProfile; + } + + private String mUrl; + + public String getUrl() { + return mUrl; + } + + public void setUrl(String pUrl) { + mUrl = pUrl; + } + + int doPage = EVAL_PAGE; + + + public int doStartTag() throws JspException { + if (mProfile == null || mProfile.length() < 1) { + throw new JspException("Invalid profile location specified"); + } + + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + ProfileService profile = (ProfileService) moduleContext.locateService(mProfile); + + if (profile == null) { + throw new JspException("Profile [" + mProfile + "] not found in current module context"); + } + + if (profile.isLoggedIn()) { + return EVAL_BODY_INCLUDE; + } else { + try { + doPage = SKIP_PAGE; + pageContext.forward(mUrl); + ((HttpServletResponse) (pageContext.getResponse())).sendRedirect("login.html"); + return SKIP_BODY; + } catch (ServletException e) { + throw new JspException("Unable to forward to [" + mUrl + "]"); + } catch (IOException e) { + throw new JspException("Unable to forward to [" + mUrl + "]"); + } + } + } + + public int doEndTag() throws JspException { + return doPage; + } + + public void release() { + super.release(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/ServiceTag.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/ServiceTag.java new file mode 100644 index 0000000000..1fa4252c0c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/tags/sca/ServiceTag.java @@ -0,0 +1,98 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.tags.sca; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * Places an SCA service in the JSP page context, making it available to other tags corresponding to its id value. + */ + +public class ServiceTag extends TagSupport { + + // ---------------------------------- + // Constructors + // ---------------------------------- + + public ServiceTag() { + super(); + } + + // ---------------------------------- + // Methods + // ---------------------------------- + + private String mName; + + /** + * Returns the name of the SCA service to import into the page context. + */ + public String getName() { + return mName; + } + + /** + * Sets name of the SCA service to import into the page context. + */ + public void setName(String pName) { + mName = pName; + } + + private String mId; + + /** + * Returns the id of the service in the page context + */ + public String getId() { + return mId; + } + + /** + * Sets the id of the service for the page context + */ + + public void setId(String pId) { + mId = pId; + } + + public int doStartTag() throws JspException { + ModuleContext moduleContext = CurrentModuleContext.getContext(); + Object service = moduleContext.locateService(mName); + if (service == null) { + throw new JspException("Service [" + mName + "] not found in current module context"); + } + if (mId == null) { + // if the Id name was not specified, default to the basic name of the + // service + mId = mName; + } + pageContext.setAttribute(mId, service); + return EVAL_BODY_INCLUDE; + } + + public int doEndTag() throws JspException { + return EVAL_PAGE; + } + + public void release() { + super.release(); + } +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/ui/FormServlet.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/ui/FormServlet.java new file mode 100644 index 0000000000..bad6d370b0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/ui/FormServlet.java @@ -0,0 +1,156 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.ui; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import bigbank.webclient.services.profile.ProfileService; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountService; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class FormServlet extends HttpServlet { + + // private ServletContext mContext; + // public void init(ServletConfig pCfg) throws ServletException { + // mContext = pCfg.getServletContext(); + // } + + public void doPost(HttpServletRequest pReq, HttpServletResponse pResp) throws ServletException { + + try { + final String action = pReq.getParameter("action"); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + AccountService accountServices = (AccountService) moduleContext.locateService("AccountServiceComponent"); + if (accountServices == null) { + throw new ServletException("AccountServiceComponent"); + } + ProfileService profileServices = null; + if (!"createAccount".equals(action)) { + profileServices = (ProfileService) moduleContext.locateService("ProfileServiceComponent"); + if (profileServices == null) { + throw new ServletException("ProfileServiceComponent not found."); + } + if (!profileServices.isLoggedIn()) { + throw new ServletException("User id '" + profileServices.getId() + "' not logged on."); + } + } + + if ("createAccount".equals(action)) { + createAccount(pReq, pResp, accountServices); + } else if ("account".equals(action)) { + accountTransaction(pReq, pResp, accountServices); + } else if ("stockPurchase".equals(action)) { + stockPurchase(pReq, pResp, profileServices, accountServices); + } else if ("stockSale".equals(action)) { + stockSale(pReq, pResp, profileServices, accountServices); + } else { + throw new IllegalArgumentException("Unknown action in Form servlet '" + action + "'."); + } + // mContext.getRequestDispatcher("summary.jsp").forward(pReq, pResp); + pResp.sendRedirect("summary.jsp"); + } catch (ServletException e) { + e.printStackTrace(); + throw e; + + } catch (Exception e) { + + throw new ServletException(e); + } + + } + + private void stockSale(HttpServletRequest req, HttpServletResponse resp, ProfileService profileServices, AccountService accountServices) + throws ServletException { + try { + if (!"cancel".equals(req.getParameter("cancel"))) { + + int quantity = Integer.parseInt(req.getParameter("quantity")); + int purchaseLotNumber = Integer.parseInt(req.getParameter("purchaseLotNumber")); + accountServices.sellStock(purchaseLotNumber, quantity); + } + + } catch (Exception e) { + + throw new ServletException("stockSale " + e.getMessage(), e); + } + + } + + private void stockPurchase(HttpServletRequest req, HttpServletResponse resp, ProfileService profileServices, AccountService accountServices) + throws ServletException { + try { + if (!"cancel".equals(req.getParameter("cancel"))) { + + String symbol = req.getParameter("symbol").trim().toUpperCase(); + int quantity = Integer.parseInt(req.getParameter("quantity")); + StockSummary stockSummry = AccountFactory.INSTANCE.createStockSummary(); + stockSummry.setSymbol(symbol); + stockSummry.setQuantity(quantity); + accountServices.purchaseStock(profileServices.getId(), stockSummry); + } + } catch (Exception e) { + throw new ServletException("stockPurchase " + e.getMessage(), e); + } + } + + private void accountTransaction(HttpServletRequest req, HttpServletResponse resp, AccountService accountServices) throws ServletException { + try { + if (!"cancel".equals(req.getParameter("cancel"))) { + String account = req.getParameter("account"); + String amount = req.getParameter("Amount"); + if ("deposit".equals(req.getParameter("actionType"))) + accountServices.deposit(account, Float.parseFloat(amount)); + else + accountServices.withdraw(account, Float.parseFloat(amount)); + } + } catch (Exception e) { + throw new ServletException("accountTransaction " + e.getMessage(), e); + } + + } + + private void createAccount(HttpServletRequest pReq, HttpServletResponse pResp, AccountService accountServices) throws ServletException { + try { + CustomerProfileData customerProfileData = AccountFactory.INSTANCE.createCustomerProfileData(); + customerProfileData.setFirstName(pReq.getParameter("firstName")); + customerProfileData.setLastName(pReq.getParameter("lastName")); + customerProfileData.setAddress(pReq.getParameter("address")); + customerProfileData.setEmail(pReq.getParameter("email")); + customerProfileData.setLoginID(pReq.getParameter("loginID")); + customerProfileData.setPassword(pReq.getParameter("password")); + + CustomerProfileData resp = accountServices.createAccount(customerProfileData, "savings".equals(pReq.getParameter("savings")), "checkings" + .equals(pReq.getParameter("checkings"))); + LoginServlet.login(resp.getLoginID(), resp.getPassword()); + + } catch (IOException e) { + throw new ServletException(e); + } + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/ui/LoginServlet.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/ui/LoginServlet.java new file mode 100644 index 0000000000..886f42a778 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/java/bigbank/webclient/ui/LoginServlet.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.ui; + +import java.io.IOException; +import java.rmi.RemoteException; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import bigbank.webclient.services.profile.LoginService; + +public class LoginServlet extends HttpServlet { + + public void init(ServletConfig pCfg) throws ServletException { + + } + + public void doPost(HttpServletRequest pReq, HttpServletResponse pResp) throws ServletException { + + if ("logout".equals(pReq.getParameter("logout")) || "logoutHIDDEN".equals(pReq.getParameter("logoutHIDDEN"))) { + HttpSession sess = pReq.getSession(); + if (sess != null) + sess.invalidate(); + try { + pResp.sendRedirect("login.html"); + } catch (IOException e) { + + e.printStackTrace(); + throw new ServletException(e); + } + + } else { + + String login = pReq.getParameter("login"); + String password = pReq.getParameter("password"); + try { + int resp = login(login, password); + if (resp == LoginService.SUCCESS) { + + pResp.sendRedirect("summary.jsp"); + } else { + + pResp.sendRedirect("login.html"); + } + } catch (IOException e) { + throw new ServletException(e); + } + } + } + + static int login(final String login, final String password) throws ServletException { + + ModuleContext moduleContext = CurrentModuleContext.getContext(); + LoginService loginMgr = (LoginService) moduleContext.locateService("LoginServiceComponent"); + + if (loginMgr == null) { + throw new ServletException("LoginManager not found"); + } + + try { + return loginMgr.login(login, password); + } catch (RemoteException e) { + + throw new ServletException(e); + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/sca.module new file mode 100644 index 0000000000..05e3859587 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/sca.module @@ -0,0 +1,51 @@ + + + + + + + + + + + + AccountServiceComponent + ProfileServiceComponent + + + + + + + Anonymous + + + + + + + AccountService + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/sca.subsystem b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/sca.subsystem new file mode 100644 index 0000000000..c0b66ca4e7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/sca.subsystem @@ -0,0 +1,27 @@ + + + + + + + sample-bigbank-account-subsystem/sample-bigbank-account/AccountService + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..c44b826440 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,392 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/CustomerProfile.jsp b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/CustomerProfile.jsp new file mode 100644 index 0000000000..6fc0484056 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/CustomerProfile.jsp @@ -0,0 +1,97 @@ + +<%-- + 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. + --%> + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + +<%-- LINK href="theme/Master.css" rel="stylesheet" type="text/css" --%> +BigBank- Customer Account + +

Customer Account
+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
First name
Last name
Address
email
 
Checkings
Savings
 
Logon ID
Password
+
+   +
+


+

+ + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld new file mode 100644 index 0000000000..36554640cd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld @@ -0,0 +1,91 @@ + + + + 1.0 + 2.0 + BigBank Tags + Tag library containing BigBank tags + + service + bigbank.webclient.tags.sca.ServiceTag + JSP + Places a reference to an SCA Service in the page context + + id + true + false + + + name + true + false + + + + login + bigbank.webclient.tags.sca.LoginBarrierTag + JSP + Redirects if user is not logged in + + profile + true + false + + + url + true + false + + + + + accountStatus + bigbank.webclient.tags.account.AccountStatusTag + JSP + Accesses and iterates the account service + + id + true + false + + + accountService + true + false + + + profileService + true + false + + + + stockStatus + bigbank.webclient.tags.account.StockStatusTag + JSP + Accesses and iterates the stocks + + id + true + false + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..3b4c735a62 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,44 @@ + + + + + Tuscany Bigbank Web UI sample + + login.html + + + + LoginServlet + bigbank.webclient.ui.LoginServlet + 1 + + + FormServlet + bigbank.webclient.ui.FormServlet + 0 + + + + LoginServlet + /loginAction/* + + + FormServlet + /FormServlet/* + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/accountTransaction.jsp b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/accountTransaction.jsp new file mode 100644 index 0000000000..4188b70b71 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/accountTransaction.jsp @@ -0,0 +1,47 @@ + +<%-- + 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. + --%> + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + +BigBank - <%=request.getParameter("account") %> + + +

Account <%= request.getParameter("account") %>
+
+
+

+
+ + + +Amount to <%=request.getParameter("transaction")%>
+
+
+
+      +
+ + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/login.html b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/login.html new file mode 100644 index 0000000000..83f8fd3d2c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/login.html @@ -0,0 +1,42 @@ + +Welcome to Big Bank + + + +
+ + + + +
Please login in to access your account
+ + + + + + + + + + + +   + +   + +
Login(test)
Password(password)
+
+


+
+
+
New to Big Bank? Please open a new account with us. +
+

+ + +

+ + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/purchaseStock.jsp b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/purchaseStock.jsp new file mode 100644 index 0000000000..b0838a9a81 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/purchaseStock.jsp @@ -0,0 +1,56 @@ + +<%-- + 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. + --%> + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + +BigBank- Stock purchase + +

Stock purchase
+
+

+
+ + + + + + + + + + + + + + + + + + + +
Symbol
Quantity
+
+   +
+


+

+ + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/stockSale.jsp b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/stockSale.jsp new file mode 100644 index 0000000000..de4c438ffb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/stockSale.jsp @@ -0,0 +1,53 @@ + +<%-- + 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. + --%> + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + +BigBank- Stock sale + +

Stock sale
+
+

+
+ + + + + + + + + + + + + + + + +
Quantity
+
+   +
+


+

+ + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/summary.jsp b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/summary.jsp new file mode 100644 index 0000000000..263ab9e1ac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/main/webapp/summary.jsp @@ -0,0 +1,136 @@ +<%-- + 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. + --%> + + <%@ page import="com.bigbank.account.AccountSummary" %> + <%@ page import="com.bigbank.account.StockSummary" %> + <%@ page session="true" %> + <%@ page autoFlush="true" %> +<%@ taglib uri="/WEB-INF/bigbank-tags.tld" prefix="sca" %> + + + + + BigBank Account Summary + + + + Account Information for +
+ + + +    +
+ + + + + + + + + + + + + + + + + + + + + +
Account Balance
+ + + + + + + + + + +
+ + + +
+
+ Stocks:     
+
+ + + + + + + + <%-- spacer --%> + + + + + + <%-- spacer --%> + + + +
+
+ + + + <%-- spacer --%> + + + + + + + + <%-- spacer --%> + + + + +
SymbolQuantityPurchase Date  Purchase PriceCurrent PriceCompany NameToday HighToday Low   <%-- sell button --%>
+ + + + + +    + + + + + + + + + +    +
+ +
+ + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/test/java/bigbank/webclient/client/TestAccountService.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/test/java/bigbank/webclient/client/TestAccountService.java new file mode 100644 index 0000000000..5dbb56865f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/test/java/bigbank/webclient/client/TestAccountService.java @@ -0,0 +1,52 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.client; + +import java.util.List; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountService; + + +public class TestAccountService extends SCA { + + public void start() { + } + + public void stop() { + } + + public static void main(String[] args) throws Exception { + TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.webclient.testclient", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + AccountService accountService = (AccountService) moduleContext.locateService("AccountServiceComponent"); + + AccountReport report = accountService.getAccountReport(12345); + List summaries = report.getAccountSummaries(); + + System.out.println("retrieved " + summaries.size() + " summaries"); + + tuscany.stop(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/test/java/bigbank/webclient/client/TestLoginService.java b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/test/java/bigbank/webclient/client/TestLoginService.java new file mode 100644 index 0000000000..4d2f10a706 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/bigbank/webclient/src/test/java/bigbank/webclient/client/TestLoginService.java @@ -0,0 +1,50 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package bigbank.webclient.client; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + +import org.apache.tuscany.core.client.TuscanyRuntime; + +import bigbank.webclient.services.profile.LoginService; + + +public class TestLoginService extends SCA { + + public void start() { + } + + public void stop() { + } + + public static void main(String[] args) throws Exception { + + + TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.webclient.testclient", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + LoginService loginService = (LoginService) + moduleContext.locateService("LoginServiceComponent"); + + if (loginService.login("test", "password") == LoginService.SUCCESS) + System.out.println("Success"); + else + System.out.println("Failure"); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/build.xml new file mode 100644 index 0000000000..4057778754 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/build.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/pom.xml new file mode 100644 index 0000000000..92d54393fe --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/pom.xml @@ -0,0 +1,106 @@ + + + + 4.0.0 + org.apache.tuscany.sampleapps + tuscany-sampleapps + pom + Tuscany Scenario Samples + http://incubator.apache.org/tuscany/ + incubating-M1 + + + 2.0 + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + ibiblio + ibiblio + http://www.ibiblio.org/maven2 + + + incubating-M1 + incubating-M1 + http://people.apache.org/~jsdelfino/maven2 + + + + + bigbank + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.apache + http://incubator.apache.org/tuscany/ + + + + + + + + + src/main/java + + **/*.componentType + + + + src/main/resources + + + + + + src/test/java + + **/*.componentType + + + + src/test/resources + + + install + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/readme.htm new file mode 100644 index 0000000000..d701d89aa0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sampleapps/readme.htm @@ -0,0 +1,20 @@ + + + + + + + + + Tuscany Hello World Web Sample + + + + + + +Please see +bigbank/readme.htm + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/build.xml new file mode 100644 index 0000000000..c650e16c64 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/build.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/build.xml new file mode 100644 index 0000000000..7f06f24c0c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/build.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/build.xml new file mode 100644 index 0000000000..afc88122f7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/db.lck b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/db.lck new file mode 100644 index 0000000000..9f6b4b3d4b Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/db.lck differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/log.ctrl b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/log.ctrl new file mode 100644 index 0000000000..edbd775299 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/log.ctrl differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/log1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/log1.dat new file mode 100644 index 0000000000..7e85ac8e8f Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/log1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/logmirror.ctrl b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/logmirror.ctrl new file mode 100644 index 0000000000..edbd775299 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/log/logmirror.ctrl differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c10.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c10.dat new file mode 100644 index 0000000000..5d8ecaa10f Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c10.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c101.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c101.dat new file mode 100644 index 0000000000..0f79fa7574 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c101.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c111.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c111.dat new file mode 100644 index 0000000000..39d49e3d19 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c111.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c121.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c121.dat new file mode 100644 index 0000000000..2a4311779b Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c121.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c130.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c130.dat new file mode 100644 index 0000000000..64e3c18d62 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c130.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c141.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c141.dat new file mode 100644 index 0000000000..0632d04164 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c141.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c150.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c150.dat new file mode 100644 index 0000000000..d7541026f6 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c150.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c161.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c161.dat new file mode 100644 index 0000000000..6673bf1873 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c161.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c171.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c171.dat new file mode 100644 index 0000000000..c2a753cc5d Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c171.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c180.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c180.dat new file mode 100644 index 0000000000..cb9391aed1 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c180.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c191.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c191.dat new file mode 100644 index 0000000000..d3cf1d6364 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c191.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1a1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1a1.dat new file mode 100644 index 0000000000..a7a2d536e9 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1a1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1b1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1b1.dat new file mode 100644 index 0000000000..19097e69e7 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1b1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1c0.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1c0.dat new file mode 100644 index 0000000000..359525a31a Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1c0.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1d1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1d1.dat new file mode 100644 index 0000000000..9f257df932 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1d1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1e0.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1e0.dat new file mode 100644 index 0000000000..e43e52fb7f Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1e0.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1f1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1f1.dat new file mode 100644 index 0000000000..7e6ee3b1e0 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c1f1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c20.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c20.dat new file mode 100644 index 0000000000..1be6390f06 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c20.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c200.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c200.dat new file mode 100644 index 0000000000..b15d56855c Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c200.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c211.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c211.dat new file mode 100644 index 0000000000..84b0022312 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c211.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c221.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c221.dat new file mode 100644 index 0000000000..63106a9523 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c221.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c230.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c230.dat new file mode 100644 index 0000000000..9975f27c1f Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c230.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c241.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c241.dat new file mode 100644 index 0000000000..835c645a16 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c241.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c251.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c251.dat new file mode 100644 index 0000000000..d3d6adf4fb Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c251.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c260.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c260.dat new file mode 100644 index 0000000000..8d7333df7d Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c260.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c271.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c271.dat new file mode 100644 index 0000000000..af722f7d73 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c271.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c281.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c281.dat new file mode 100644 index 0000000000..3972983c2e Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c281.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c290.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c290.dat new file mode 100644 index 0000000000..31577b8124 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c290.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2a1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2a1.dat new file mode 100644 index 0000000000..0f700d13a7 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2a1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2b1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2b1.dat new file mode 100644 index 0000000000..1d6382fb3d Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2b1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2c1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2c1.dat new file mode 100644 index 0000000000..3bc60d886b Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2c1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2d0.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2d0.dat new file mode 100644 index 0000000000..c542d3c91c Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2d0.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2e1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2e1.dat new file mode 100644 index 0000000000..16abd20b5f Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2e1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2f0.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2f0.dat new file mode 100644 index 0000000000..eb26be5932 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c2f0.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c300.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c300.dat new file mode 100644 index 0000000000..1214f1df4b Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c300.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c31.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c31.dat new file mode 100644 index 0000000000..18c16f1123 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c31.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c311.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c311.dat new file mode 100644 index 0000000000..926cbf25b5 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c311.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c320.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c320.dat new file mode 100644 index 0000000000..07e7bc023c Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c320.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c331.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c331.dat new file mode 100644 index 0000000000..fd827f9dc2 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c331.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c340.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c340.dat new file mode 100644 index 0000000000..ca70319886 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c340.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c351.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c351.dat new file mode 100644 index 0000000000..8fbe2a527c Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c351.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c360.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c360.dat new file mode 100644 index 0000000000..dcf9c746e1 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c360.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c371.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c371.dat new file mode 100644 index 0000000000..6f21a840ea Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c371.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c380.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c380.dat new file mode 100644 index 0000000000..b512e8065f Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c380.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c391.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c391.dat new file mode 100644 index 0000000000..27006e95a1 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c391.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3a0.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3a0.dat new file mode 100644 index 0000000000..565dca97ac Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3a0.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3b1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3b1.dat new file mode 100644 index 0000000000..36894c9818 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3b1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3c0.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3c0.dat new file mode 100644 index 0000000000..d0c538aede Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3c0.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3d1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3d1.dat new file mode 100644 index 0000000000..65bcec5527 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3d1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3e0.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3e0.dat new file mode 100644 index 0000000000..bdab359420 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3e0.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3f1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3f1.dat new file mode 100644 index 0000000000..dc2d278b57 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c3f1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c400.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c400.dat new file mode 100644 index 0000000000..3072709cec Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c400.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c41.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c41.dat new file mode 100644 index 0000000000..61086690f2 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c41.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c411.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c411.dat new file mode 100644 index 0000000000..ca551d8249 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c411.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c420.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c420.dat new file mode 100644 index 0000000000..f04de0840e Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c420.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c431.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c431.dat new file mode 100644 index 0000000000..398b1672cc Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c431.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c440.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c440.dat new file mode 100644 index 0000000000..af259d0872 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c440.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c451.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c451.dat new file mode 100644 index 0000000000..772a18c658 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c451.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c460.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c460.dat new file mode 100644 index 0000000000..505428362d Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c460.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c471.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c471.dat new file mode 100644 index 0000000000..484d0df42d Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c471.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c481.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c481.dat new file mode 100644 index 0000000000..faac073076 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c481.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c490.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c490.dat new file mode 100644 index 0000000000..7585319d21 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c490.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c4a1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c4a1.dat new file mode 100644 index 0000000000..4fe8b786e3 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c4a1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c51.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c51.dat new file mode 100644 index 0000000000..7fc7937b15 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c51.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c60.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c60.dat new file mode 100644 index 0000000000..d1fb08c946 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c60.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c71.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c71.dat new file mode 100644 index 0000000000..d4c2090a3b Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c71.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c81.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c81.dat new file mode 100644 index 0000000000..38b6ea6520 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c81.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c90.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c90.dat new file mode 100644 index 0000000000..a607a5969c Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/c90.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/ca1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/ca1.dat new file mode 100644 index 0000000000..19b4c9e340 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/ca1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cb1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cb1.dat new file mode 100644 index 0000000000..73dc986572 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cb1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cc0.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cc0.dat new file mode 100644 index 0000000000..d1eef3bb56 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cc0.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cd1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cd1.dat new file mode 100644 index 0000000000..c7e6db3ef7 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cd1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/ce1.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/ce1.dat new file mode 100644 index 0000000000..8fd3bf17a8 Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/ce1.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cf0.dat b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cf0.dat new file mode 100644 index 0000000000..332b3d9a8a Binary files /dev/null and b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/seg0/cf0.dat differ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/service.properties b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/dastest/service.properties new file mode 100644 index 0000000000..8cfe3b09a5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/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/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/pom.xml new file mode 100644 index 0000000000..8dbf952e89 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/pom.xml @@ -0,0 +1,42 @@ + + + + + + org.apache.tuscany.samples.das + tuscany-samples-das + incubating-M1 + + + 4.0.0 + sample-companyweb + war + Tuscany DAS Company Sample + Sample use of RDB DAS in a Web application + incubating-M1 + + + + + org.apache.tuscany.das + tuscany-das-rdb + ${pom.version} + provided + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/readme.htm new file mode 100644 index 0000000000..349fee547a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/readme.htm @@ -0,0 +1,810 @@ + + + + + + + + +Tuscany RDB DAS Sample + + + + + + + + + + +
+ +

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.

+ +

 

+ +

Kevin Williams

+ +

V-0.4

+ +

Tuscany RDB DAS Sample (companyweb)

+ +

 

+ +

 

+ +

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

+ +

 

+ +

The application starts with a canned 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. +
+ +

 

+ +

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

+ +

 

+ +

Running the sample

+ +

There are three options for running this sample:

+ +

 

+ +
    +
  1. Run + from Tomcat in the binary distribution
  2. +
  3. Run + from Tomcat configured by the build
  4. +
  5. Run + from Tomcat you configure yourself
  6. +
+ +

Running from binary distribution

+ +

This sample is also pre-deployed in a Tomcat instance as +part of the Tuscany binary +distribution.  When running the sample +this way, you just:

+ +
    +
  • Unzip the distribution + archive
  • +
  • Change the directory to +  apache-tomcat-5.5.17\bin
  • +
      +
    • If you start Tomcat from some other + location then it will not find the canned database
    • +
    +
  • Execute: startup
  • +
  • Point your browser to http://localhost:8080/sample-companyweb/
  • +
+ +

Running from Tomcat configured by the build

+ +

This sample application is deployed (along with the canned +test database) to an instance of Tomcat as part of our automated sample +testing.  This means you can run the +java/testing/tomcat build (see java/testing/tomcat/readme.htm +)  and then access the application +by pointing your browser to http://localhost:8080/sample-companyweb/. 

+ +

Running from 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 +downloaded the Tuscany source and +run our maven build.  https://svn.apache.org/repos/asf/incubator/tuscany/java/BUILDING.txt

+ +

Set Up

+ +
    +
  1. Download + and install the most recent stable version of Tomcat 5.5.  You can find it here: http://tomcat.apache.org/download-55.cgi
  2. +
  3. 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.jar
  4. +
  5. Stop + Tomcat
  6. +
  7. Move + the following files (details in appendix) to {Tomcat_Home}/common/lib:
  8. +
      +
    1. tuscany-das-rdb-xxx.jar
    2. +
    3. sdo-api-xxx.jar
    4. +
    5. tuscany-sdo-impl-xxx.jar
    6. +
    7. xsd{latest version}.jar
    8. +
    9. ecore-{latest version}.jar
    10. +
    11. ecore-change-{latest version}.jar
    12. +
    13. ecore-xmi-{latest version}.jar
    14. +
    15. common-{latest + version}.jar
    16. +
    17. derby.jar
    18. +
    +
  9. Add + the sample war file (details in appendix) to {Tomcat_Home}/webapps
  10. +
      +
    1. sample-companyweb-xxx.war
    2. +
    +
  11. Install + the canned Derby database to + Tomcat:
  12. +
      +
    1. Create + {Tomcat_Home}/Databases
    2. +
    3. Copy + the dastest folder (and all its contents) from {build + directory root}/java/samples/das/companyweb to + {Tomcat_Home}/Databases.  
    4. +
    +
  13. Define + a DataSource by adding a datasource definition + to {Tomcat_Home}/conf/server.xml.
  14. +
      +
    1. Find + the end-of-section marker </GlobalNamingResources> + and add the following lines just above it:
    2. +
    +
+ +

 

+ +
        <!-- 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:Databases/dastest"/>
+ +

 NOTE: If you are NOT starting Tomcat as a +service then you will need to provide the absolute path in the above url.  Fore example:

+ +

 

+ +
         url="jdbc:derby:c:\apache-tomcat-5.5.17\Databases/dastest"/>
+ +

 

+ +
    +
  1. Start + tomcat and either:
  2. +
+ +

go to the +manager console http://localhost:8080/manager/html +and select the application named “Tuscany DAS +sample Company WEB”

+ +

or:

+ +

point +your browser to :

+ +

http://localhost:8080/sample-companyweb-{version +name}/

+ +

 

+ +

NOTE: for the M1 version of Tuscany +sample the url is:

+ +

http://localhost:8080/sample-companyweb-incubating-M1/

+ +

 

+ +

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 + canned Derby database
  • +
+ +

 

+ +

 

+ +

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 canned Derby +database comes preloaded with Companies and related Departments.  The Derby +database instance is a simple file folder.

+ +

 

+ +

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

+ +

 

+ +

Appendix

+ +

 

+ +

The following specifies the location of all dependency jars needed +to run this sample.  These jars are +available only after you have +successfully downloaded and built Tuscany/java.  +Instructions for building can be found here:

+ +

https://svn.apache.org/repos/asf/incubator/tuscany/java/BUILDING.txt

+ +

 

+ +

Dependency jar locations:

+ +

 

+ +

For +Step #4

+ +
    +
  • tuscany-das-rdb-xxx.jar – {build directory root}/java/das/rdb/target
  • +
  • sdo-api-xxx.jar – {build directory root}/java/spec/sdo/target
  • +
  • tuscany-sdo-impl-xxx.jar – {build directory root}//java/sdo/impl/target
  • +
  • xsd{latest version}.jar – + {user}/.m2/repository/org/eclipse/xsd
  • +
  • ecore-{latest version}.jar – + {user}/.m2/repository/org/eclipse/emf/ecore
  • +
  • ecore-change-{latest version}.jar – + {user}/.m2/repository/org/eclipse/emf/ecore-change
  • +
  • ecore-xmi-{latest version}.jar  – {user}/.m2/repository/org/eclipse/emf/ecore-xmi
  • +
  • common-{latest version}.jar  – {user}/.m2/repository/org/eclipse/emf/common
  • +
  • derby.jar – Extract from the archive file you downloaded + in step #2
  • +
+ +

 

+ +

Application artifact locations:

+ +

 

+ +

For +Step #5

+ +
    +
  • sample-companyweb-xxx.war + - {build directory root}/java/samples/das/companyweb/target
  • +
+ +

 

+ +

Conventions:

+ +
    +
  • {user} refers the + directory where Maven2 is installed on your machine.  On my machine, “{user}” is “C:\Documents + and Settings\Administrator”
  • +
  • {Tomcat_Home} refers to + the directory that Tomcat is installed on your machine.  On my machine, this is “C:\Program + Files\Apache Software Foundation\Tomcat 5.5”
  • +
  • {latest version} means + the tag associated with the latest version available in the maven2 + repository.  For example the version + of ecore-{latest version}.jar that I used for + testing this sample is “ecore-2.2.0-RC4.jar”
  • +
  • {build directory root} refers to the target + directory for the tuscany/java source you are + building from
  • +
+ +
+ + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java new file mode 100644 index 0000000000..63affa0649 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/java/org/apache/tuscany/samples/das/companyweb/CompanyClient.java @@ -0,0 +1,154 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.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.ApplyChangesCommand; +import org.apache.tuscany.das.rdb.Command; +import org.apache.tuscany.das.rdb.CommandGroup; + +import commonj.sdo.DataObject; + +public class CompanyClient { + + private Random generator = new Random(); + + private CommandGroup commandGroup = CommandGroup.FACTORY.createCommandGroup(getConfig("CompanyConfig.xml")); + + public final List getCompanies() { + + Command read = commandGroup.getCommand("all companies"); + DataObject root = read.executeQuery(); + return root.getList("COMPANY"); + + } + + public final List getCompaniesWithDepartments() { + + Command read = commandGroup.getCommand("all companies and departments"); + DataObject root = read.executeQuery(); + return root.getList("COMPANY"); + } + + public final List getDepartmentsForCompany(int id) { + Command read = commandGroup.getCommand("all departments for company"); + read.setParameterValue("ID", new Integer(id)); + DataObject root = read.executeQuery(); + return root.getList("COMPANY"); + } + + public final void addDepartmentToFirstCompany() { + Command read = commandGroup.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); + + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + apply.execute(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 = commandGroup.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 = commandGroup.getCommand("company by id with departments"); + readCust.setParameterValue("ID", 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(); + } + + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + apply.execute(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 = commandGroup.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 = commandGroup.getCommand("company by id with departments"); + readCust.setParameterValue("ID", 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()); + } + + ApplyChangesCommand apply = commandGroup.getApplyChangesCommand(); + apply.execute(root); + + } + + + public void releaseResources() { + commandGroup.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/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/CompanyConfig.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/CompanyConfig.xml new file mode 100644 index 0000000000..fe1202ff69 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/CompanyConfig.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + +
diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/Company.jsp b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/Company.jsp new file mode 100644 index 0000000000..12b9bd736e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/Company.jsp @@ -0,0 +1,157 @@ + + +<%-- + * 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. + --%> + + + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + + pageEncoding="ISO-8859-1" + + import="org.apache.tuscany.samples.das.companyweb.CompanyClient" + import="commonj.sdo.*" +%> + + +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/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/META-INF/context.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000000..fa95e589d3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/META-INF/context.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..2908daece9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/companyweb/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,27 @@ + + + + + + Tuscany DAS sample Company WEB + + + Company.jsp + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/das/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/pom.xml new file mode 100644 index 0000000000..fb59eef88e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/das/pom.xml @@ -0,0 +1,34 @@ + + + + + org.apache.tuscany.samples + tuscany-samples + incubating-M1 + + + 4.0.0 + org.apache.tuscany.samples.das + tuscany-samples-das + pom + Tuscany DAS Samples + incubating-M1 + + + companyweb + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/pom.xml new file mode 100644 index 0000000000..d0d02f6288 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/pom.xml @@ -0,0 +1,107 @@ + + + + 4.0.0 + org.apache.tuscany.samples + tuscany-samples + pom + Tuscany Samples + http://incubator.apache.org/tuscany/ + incubating-M1 + + + 2.0 + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + ibiblio + ibiblio + http://www.ibiblio.org/maven2 + + + incubating-M1 + incubating-M1 + http://people.apache.org/~jsdelfino/maven2 + + + + + das + sca + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.apache + http://incubator.apache.org/tuscany/ + + + + + + + + + src/main/java + + **/*.componentType + + + + src/main/resources + + + + + + src/test/java + + **/*.componentType + + + + src/test/resources + + + install + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/build.xml new file mode 100644 index 0000000000..3df88aeeeb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/build.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/build.xml new file mode 100644 index 0000000000..91e143311b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/pom.xml new file mode 100644 index 0000000000..2a6e6864d8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/pom.xml @@ -0,0 +1,51 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + 4.0.0 + sample-calculator + jar + Tuscany Calculator Sample + A sample Calculator made of several SCA components wired together. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/readme.htm new file mode 100644 index 0000000000..8ae5ca6488 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/readme.htm @@ -0,0 +1,53 @@ + + + Tuscany +Calculator + +

Tuscany +Calculator Sample

+

Overview

+

The Tuscany calculator sample shows using the Tuscany SCA +runtime in a J2SE environment  loading several components. +Each component provides a basic operation (add, subtract, etc).
The +main component uses each of these to perrform a simple calculation.

Location

This +sample is located  in the samples\sca\calculator directory.

+ +

Setup

This sample depends on the Tuscany runtime and the sample jar, + + + sample-calculator-incubating-M1.jar + + +, both of these must be available on the classpath to run the sample. +
    +
+

Running

+ + In the directory samples/sca/calculator use the JDK 1.5 java command to run the class calculator.CalculatorClient + +
Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:target/sample-calculator-incubating-M1.jar calculator.CalculatorClient
+
Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;target/sample-calculator-incubating-M1.jar calculator.CalculatorClient
+ +

Results

+

The sample when run should simply display to the standard +output:
Hello World

+

Code Overview

+The source files are physically organized as shown below: +
src
+---main
    +---java
    ¦   +---calculator
    ¦           AddService.java
    ¦           AddServiceImpl.java
    ¦           CalculatorClient.java
    ¦           CalculatorService.java
    ¦           CalculatorServiceImpl.java
    ¦           DivideService.java
    ¦           DivideServiceImpl.java
    ¦           MultiplyService.java
    ¦           MultiplyServiceImpl.java
    ¦           SubtractService.java
    ¦           SubtractServiceImpl.java
    ¦
    +---resources
            logging.properties
            sca.module
+
+ + + + + + +
sca.moduleDefines the SCA module and component. Defines for the CalculatorServiceComponent component  the Java class that +implements that component.  Wires each of the operation components to the CalculatorServiceComponent
CalculatorService.javaDefines the Java interface implemented by the cacomponent.
CalculatorServiceImpl.javaImplements the SCA component. Uses the SCA service annotation +tag on the class to show what SCA interface is being implemented.
CalculatorClient.javaCreates a Tuscany runtime and starts it.  Obtains +the module context which was defined by the sca.module file. From the +module context locates the CalculatorServiceComponent and then +calls operations on that component to demonstrating it using the multiple components implementing the operations..

\ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/AddService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..34a3edeb0e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/AddService.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..02cddd08db --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +import org.osoa.sca.annotations.Service; + +/** + * An implementation of the Add service + */ +@Service(AddService.class) +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + return n1 + n2; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..ee1c138940 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.LogManager; + +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.JavaLoggingMonitorFactory; +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the Calculator service and invoke it. + */ +public class CalculatorClient { + + public static final void main(String[] args) throws Exception { + + // Setup Tuscany monitoring to use java.util.logging + LogManager.getLogManager().readConfiguration(CalculatorClient.class.getResourceAsStream("/logging.properties")); + Properties levels = new Properties(); + MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages"); + + // Create a Tuscany runtime for the sample module component + TuscanyRuntime tuscany = new TuscanyRuntime("CalculatorModuleComponent", "http://calculator", monitorFactory); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + + // Get the SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the Calculator service + CalculatorService calculatorService = (CalculatorService) moduleContext.locateService("CalculatorServiceComponent"); + + // Calculate + System.out.println("3 + 2="+calculatorService.add(3, 2)); + System.out.println("3 - 2="+calculatorService.subtract(3, 2)); + System.out.println("3 * 2="+calculatorService.multiply(3, 2)); + System.out.println("3 / 2="+calculatorService.divide(3, 2)); + + System.out.flush(); + + // Disassociate the runtime from this thread + tuscany.stop(); + + // Shut down the runtime + tuscany.shutdown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..ff39e0b57a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..b81a6f00fd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,70 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + + +/** + * An implementation of the Calculator service. + */ +@Service(CalculatorService.class) +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/DivideService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..664ba2ba61 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/DivideService.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..12d0c65ed2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +import org.osoa.sca.annotations.Service; + +/** + * An implementation of the Divide service. + */ +@Service(DivideService.class) +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + return n1 / n2; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..fcb274dc8a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..c274d1a6d1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +import org.osoa.sca.annotations.Service; + +/** + * An implementation of the Multiply service. + */ +@Service(MultiplyService.class) +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + return n1 * n2; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/SubtractService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..2e0fcb2b36 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/SubtractService.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..62103906fa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +import org.osoa.sca.annotations.Service; + +/** + * An implementation of the subtract service. + */ +@Service(SubtractService.class) +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + return n1 - n2; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/logging.properties b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/logging.properties new file mode 100644 index 0000000000..58407bd5a9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/logging.properties @@ -0,0 +1,27 @@ +# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/sca.module new file mode 100644 index 0000000000..d37fc3f659 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/main/resources/sca.module @@ -0,0 +1,46 @@ + + + + + + + + AddServiceComponent + SubtractServiceComponent + MultiplyServiceComponent + DivideServiceComponent + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/test/java/calculator/CalculatorTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/test/java/calculator/CalculatorTestCase.java new file mode 100644 index 0000000000..f6b5d5f24d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/calculator/src/test/java/calculator/CalculatorTestCase.java @@ -0,0 +1,65 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * This shows how to test the HelloWorld service component. + */ +public class CalculatorTestCase extends TestCase { + + private TuscanyRuntime tuscany; + + protected void setUp() throws Exception { + super.setUp(); + + // Create a Tuscany runtime for the sample module component + tuscany = new TuscanyRuntime("CalculatorModuleComponent", "http://calculator"); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + } + + public void testCalculator() throws Exception { + + // Get the SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the Calculator service + CalculatorService calculatorService = (CalculatorService) moduleContext.locateService("CalculatorServiceComponent"); + + // Calculate + assertEquals(calculatorService.add(3, 2), 5.0); + assertEquals(calculatorService.subtract(3, 2), 1.0); + assertEquals(calculatorService.multiply(3, 2), 6.0); + assertEquals(calculatorService.divide(3, 2), 1.5); + + } + + protected void tearDown() throws Exception { + + // Stop the Tuscany runtime + tuscany.stop(); + + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/build.xml new file mode 100644 index 0000000000..c35e86f885 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/build.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/pom.xml new file mode 100644 index 0000000000..b299059dfe --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/pom.xml @@ -0,0 +1,52 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + + 4.0.0 + sample-customerinfo + jar + Tuscany Customer Info Sample + A component that exposes a WSDL portType interface and uses the dynamic SDO API. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/readme.htm new file mode 100644 index 0000000000..5619733093 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/readme.htm @@ -0,0 +1,61 @@ + + + Tuscany +CustomerInfo + + + +

Tuscany CustomerInfo Sample

+ +

Overview

+ +

The CustomerInfo sample shows a component exposing a WSDL portType interface + and a J2SE client using the dynamic SDO API to use the component.

+ +

Location

This +sample is located  in the samples\sca\customerinfo directory.

+ +

Setup

This sample depends on the Tuscany runtime and the sample jar, + + + sample-customerinfo-incubating-M1.jar + + +, both of these must be available on the classpath to run the sample. +
    +
+

Running

+ + In the directory samples/sca/customerinfo use the JDK 1.5 java command to run the class customerinfo.CustomerInfoClient + +
Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:target/sample-customerinfo-incubating-M1.jar customerinfo.CustomerInfoClient
+
Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;target/sample-customerinfo-incubating-M1.jar customerinfo.CustomerInfoClient
+ +

Results

+

The sample when run should simply display to the standard +output:
+ +customerID = 12345
+firstName = Jane
+lastName = Doe
+

+

Code Overview

+The source files are physically organized as shown below: +
src
+---main
    +---java
    ¦   +---customerinfo
    ¦           CustomerInfoClient.java
    ¦           CustomerInfoServiceImpl.java
    ¦
    +---resources
            sca.module
    +---wsdl
            customer.xsd
            customerinfo.wsdl
+
+ + + + + + +
sca.moduleDefines the SCA module and component. Defines for the +CustomerInfoServiceComponent component with the Java class that +implements that component
CustomerInfoServiceImpl.javaImplements the SCA component. Uses an @SDOHelper anotation to have the SDO DataFactory automatically injected into the dataFacory field, and uses the DataFactory to create a cutomer DataObject which it initialises and returns to the caller.
CustomerInfoClient .javaCreates a Tuscany runtime and starts it.  Obtains +the module context which was defined by the sca.module file. From the +module context locates the CustomerInfoServiceComponent, and then +calls  the getCustomerInfo method to invoke the component. It uses the SDO dynamic APIs to extract the information from the returned DataObject.

\ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/java/customerinfo/CustomerInfoClient.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/java/customerinfo/CustomerInfoClient.java new file mode 100644 index 0000000000..7f97c36625 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/java/customerinfo/CustomerInfoClient.java @@ -0,0 +1,72 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package customerinfo; + +import java.lang.reflect.Method; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.LogManager; + +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.JavaLoggingMonitorFactory; +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import commonj.sdo.DataObject; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the CustomerInfo service and invoke it. + */ +public class CustomerInfoClient { + + public static final void main(String[] args) throws Exception { + + // Setup Tuscany monitoring to use java.util.logging + LogManager.getLogManager().readConfiguration(CustomerInfoClient.class.getResourceAsStream("/logging.properties")); + Properties levels = new Properties(); + MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages"); + + // Create a Tuscany runtime for the sample module component + TuscanyRuntime tuscany = new TuscanyRuntime("CustomerInfoModuleComponent", "http://customerinfo", monitorFactory); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + + // Get the SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the CustomerInfo service + Object customerInfoService = moduleContext.locateService("CustomerInfoServiceComponent"); + + // Invoke the CustomerInfo service + Method getCustomerInfo = customerInfoService.getClass().getMethod("getCustomerInfo", new Class[] {String.class}); + DataObject customer = (DataObject)getCustomerInfo.invoke(customerInfoService, "12345"); + + System.out.println("customerID = " + customer.getString("customerID")); + System.out.println("firstName = " + customer.getString("firstName")); + System.out.println("lastName = " + customer.getString("lastName")); + System.out.flush(); + + // Disassociate the runtime from this thread + tuscany.stop(); + + // Shut down the runtime + tuscany.shutdown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/java/customerinfo/CustomerInfoServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/java/customerinfo/CustomerInfoServiceImpl.java new file mode 100644 index 0000000000..090076aa0d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/java/customerinfo/CustomerInfoServiceImpl.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package customerinfo; + +import org.apache.tuscany.core.sdo.helper.SDOHelper; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.DataFactory; + +/** + * Implementation of the CustomerInfo service. + */ +public class CustomerInfoServiceImpl { + + @SDOHelper + public DataFactory dataFactory; + + public DataObject getCustomerInfo(String customerID) { + + DataObject customer = dataFactory.create("http://customer", "Customer"); + customer.setString("customerID", customerID); + customer.setString("firstName", "Jane"); + customer.setString("lastName", "Doe"); + return customer; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/logging.properties b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/logging.properties new file mode 100644 index 0000000000..58407bd5a9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/logging.properties @@ -0,0 +1,27 @@ +# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/sca.module new file mode 100644 index 0000000000..8d6a38197a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/sca.module @@ -0,0 +1,27 @@ + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/wsdl/customer.xsd b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/wsdl/customer.xsd new file mode 100644 index 0000000000..4d8aeff0b0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/wsdl/customer.xsd @@ -0,0 +1,26 @@ + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/wsdl/customerinfo.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/wsdl/customerinfo.wsdl new file mode 100644 index 0000000000..58978aad0e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/main/resources/wsdl/customerinfo.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/test/java/customerinfo/CustomerInfoTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/test/java/customerinfo/CustomerInfoTestCase.java new file mode 100644 index 0000000000..08b1e701d1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/customerinfo/src/test/java/customerinfo/CustomerInfoTestCase.java @@ -0,0 +1,74 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package customerinfo; + +import java.lang.reflect.Method; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import commonj.sdo.DataObject; + +/** + * This shows how to test the CustomerInfo service component. + */ +public class CustomerInfoTestCase extends TestCase { + + private TuscanyRuntime tuscany; + + protected void setUp() throws Exception { + super.setUp(); + + // Create a Tuscany runtime for the sample module component + tuscany = new TuscanyRuntime("CustomerInfoModuleComponent", "http://customerinfo"); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + } + + public void testCustomerInfo() throws Exception { + + // Get the SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the CustomerInfo service + Object customerInfoService = moduleContext.locateService("CustomerInfoServiceComponent"); + + // Invoke the CustomerInfo service + Method getCustomerInfo = customerInfoService.getClass().getMethod("getCustomerInfo", new Class[] {String.class}); + DataObject customer = (DataObject)getCustomerInfo.invoke(customerInfoService, "12345"); + + assertEquals("12345", customer.getString("customerID")); + assertEquals("Jane", customer.getString("firstName")); + assertEquals("Doe", customer.getString("lastName")); + + } + + protected void tearDown() throws Exception { + + // Stop the Tuscany runtime + tuscany.stop(); + + // Shutdown the runtime + tuscany.shutdown(); + + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/build.xml new file mode 100644 index 0000000000..38d8bd2d1f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/build.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/pom.xml new file mode 100644 index 0000000000..ea6d570a06 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/pom.xml @@ -0,0 +1,58 @@ + + + + + org.apache.tuscany.samples.sca.jms + samples-helloworldjms + incubating-M1 + + + 4.0.0 + sample-helloworldjms-client + jar + Tuscany HelloWorld Celtix JMS Client Sample + A sample client for a HelloWorld JMS Service. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + org.apache.tuscany.sca.bindings + tuscany-binding-celtix + ${pom.version} + provided + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/readme.htm new file mode 100644 index 0000000000..8449aace44 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/readme.htm @@ -0,0 +1,100 @@ + + + + + + + Tuscany Hello World JMS Client Sample + + + + + +

Tuscany Hello World JMS Client Sample

Overview

+

+ The Tuscany Hello World JMS client sample shows using the Tuscany SCA runtime in + a J2SE environment invoking a service using XML over JMS. +

+

Location

This sample is located  in the samples\sca\helloworld-jms\client + directory.
+ +

Setup

This sample depends on the Tuscany runtime, Celtix, and the sample jar, + + + sample-helloworldjms-client-incubating-M1.jar + + +, all of these must be available on the classpath to run the sample. Additionally, the JMS server sample must also be running. + +

Running

+ + In the directory samples/sca/helloworld use the JDK 1.5 java command to run the class helloworld.HelloWorldClient + +
Linux: java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar:../../../../lib/celtix/tuscany-celtix-incubating-M1.jar:target/sample-helloworldjms-client-incubating-M1.jar helloworld.HelloWorldClient
+
Windows: java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar;../../../../lib/celtix/tuscany-celtix-incubating-M1.jar;target/sample-helloworldjms-client-incubating-M1.jar helloworld.HelloWorldClient
+ +

Results

+

+ The sample when run should simply display to the standard output:
+ Hello World +

+

Code Overview

The source files are physically organized as shown below:
+ + + + + + +
+
+   src
+   +---main
+   +---java
+   ¦   +---helloworld
+   ¦           HelloWorldClient.java
+   ¦           HelloWorldService.java
+   ¦ 
+   +---resources
+   ¦   logging.properties
+   ¦   sca.module
+   ¦
+   +---wsdl
+           helloworld.wsdl 
+   
+
+
+
+ + + + + + + + + + + + + + + + + + + +
sca.moduleDefines the SCA module, externalService and component. + Defines for the HelloWorldServiceComponent component and the Java class that + implements the component For the externalService it defines WSDL for the service, + the Java interface provided by the service. The the HelloWorldServiceComponent + is via a referenced wired to the externalService
HelloWorldClient.javaCreates a Tuscany runtime and starts it.  Obtains the module context + which was defined by the sca.module file. From the module context locates the + HelloWorldService entryPoint and then calls  the getGreetings method to + invoke the web service defined in the helloword.wsdl.
HelloWorldService.javaDefines the Java interface implemented by the + component.
helloworld.wsdlWSDL for the service. Not that the WSDL defines a XML binding using a JMS transport intead of the normal SOAP/HTTP
+ + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/java/helloworld/HelloWorldClient.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..be121bc63b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import java.util.logging.Level; +import java.util.logging.LogManager; +import java.util.Properties; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.JavaLoggingMonitorFactory; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldClient { + + public static final void main(String[] args) throws Exception { + + // Setup Tuscany monitoring to use java.util.logging + LogManager.getLogManager().readConfiguration(HelloWorldClient.class.getResourceAsStream("/logging.properties")); + Properties levels = new Properties(); + MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages"); + + // Create a Tuscany runtime for the sample module component + TuscanyRuntime tuscany = new TuscanyRuntime("HelloWorldModuleComponent", "http://helloworld", monitorFactory); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + + // Get the SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldService"); + + // Invoke the HelloWorld service + String value = helloworldService.getGreetings("World"); + + System.out.println(value); + System.out.flush(); + + // Disassociate the runtime from this thread + tuscany.stop(); + + // Shut down the runtime + tuscany.shutdown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..1f87f17d74 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/logging.properties b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/logging.properties new file mode 100644 index 0000000000..58407bd5a9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/logging.properties @@ -0,0 +1,27 @@ +# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/sca.module new file mode 100644 index 0000000000..cf6a8f675c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/sca.module @@ -0,0 +1,28 @@ + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..cc9fc6a529 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/client/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/pom.xml new file mode 100644 index 0000000000..8d34ad5696 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/pom.xml @@ -0,0 +1,35 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + + 4.0.0 + org.apache.tuscany.samples.sca.jms + samples-helloworldjms + pom + Tuscany SCA JMS Samples + incubating-M1 + + + client + server + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/activemq.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/activemq.xml new file mode 100644 index 0000000000..7ba4e94a60 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/activemq.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.apache.derby.jdbc.EmbeddedDriver + + + + jdbc:derby:derbydb;create=true + + + + + + + + + true + + + + + + + com.mysql.jdbc.Driver + + + jdbc:mysql://localhost/activemq + + + myname + + + mypassword + + + true + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/build.xml new file mode 100644 index 0000000000..058d1f3909 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/build.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/pom.xml new file mode 100644 index 0000000000..042189b5ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/pom.xml @@ -0,0 +1,52 @@ + + + + + org.apache.tuscany.samples.sca.jms + samples-helloworldjms + incubating-M1 + + 4.0.0 + sample-helloworldjms-service + jar + Tuscany HelloWorld Celtix JMS Service Sample + A sample HelloWorld JMS Service. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + org.apache.tuscany.sca.bindings + tuscany-binding-celtix + ${pom.version} + provided + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/readme.htm new file mode 100644 index 0000000000..a069618b38 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/readme.htm @@ -0,0 +1,108 @@ + + + + + + + Tuscany Hello World JMS Service Sample + + + + + +

Tuscany Hello World JMS Service Sample

+

Overview

+

+ The Tuscany hello world jms sample shows using the Tuscany SCA runtime using the Celtix/J2SE environment to  provide a web service using + XML over JMS as well as SOAP over HTTP. +

+

Location

This sample is located  in the samples\sca\helloworld-jms\server + directory.
+ +

Setup

This sample depends on the Tuscany runtime, Celtix, and the sample jar, + + + sample-helloworldjms-service-incubating-M1.jar + + +, all of these must be available on the classpath to run the sample. + +

Running

+ + In the directory samples/sca/helloworld-jms/server use the JDK 1.5 java command to start the JMS broker and then run the class helloworld.HelloWorldServer. + +
Linux:
+ + java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar:../../../../lib/celtix/tuscany-celtix-incubating-M1.jar org.activemq.spring.Main activemq.xml + java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar:../../../../lib/celtix/tuscany-celtix-incubating-M1.jar:target/sample-helloworldjms-service-incubating-M1.jar helloworld.HelloWorldServer +
+ +
Windows:
+ java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar;../../../../lib/celtix/tuscany-celtix-incubating-M1.jar org.activemq.spring.Main activemq.xml + java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar;../../../../lib/celtix/tuscany-celtix-incubating-M1.jar;target/sample-helloworldjms-service-incubating-M1.jar helloworld.HelloWorldServer +
+ + + +

Code Overview

The source files are physically organized as shown below:
+ + + + + + +
+
+   +---main
+   +---java
+   ¦   +---helloworld
+   ¦           HelloWorldServer.java
+   ¦           HelloWorldImpl.java
+   ¦           HelloWorldService.java
+   +---resources
+     ¦   sca.module
+     +---wsdl
+            helloworld.wsdl 
+   activemq.xml
+                
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
HelloWorldServer.javaMain method to startup the Tuscany runtime which will startup the services defined in sca.module
HelloWorldService.javaDefines the Java interface implemented by the component.
HelloWorldImpl.javaImplements the SCA component. Uses the SCA service annotation + tag on the class to show what SCA interface is being implemented.
sca.moduleDefines the SCA module, entryPoint and component. + Defines for the HelloWorldServiceComponent component and the Java class that + implements the component For the entryPoint it defines WSDL for the service, the + Java interface provided by the service, and wires the service to the HelloWorldServiceComponent
helloworld.wsdlWSDL for the service.
activemq.xmlConfiguration file for ActiveMQ to setup the broker
+ + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..bf7209e7a8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldServer.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..e6290b3f37 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,49 @@ +/** + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldServer { + + public static final void main(String[] args) throws Exception { + + // Create a Tuscany runtime for the sample module component + TuscanyRuntime tuscany = new TuscanyRuntime("HelloWorldModuleComponent", "http://helloworld"); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + + + System.out.println("Hit ENTER to exit"); + System.in.read(); + + // Disassociate the runtime from this thread + tuscany.stop(); + + // Shut down the runtime + tuscany.shutdown(); + + System.exit(0); + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..1f87f17d74 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/sca.module new file mode 100644 index 0000000000..460faf4ef0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/sca.module @@ -0,0 +1,38 @@ + + + + + + + + + + + HelloWorldServiceComponent/HelloWorldService + + + + + HelloWorldServiceComponent/HelloWorldService + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..09459bb209 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld-jms/server/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/build.xml new file mode 100644 index 0000000000..1c9843ff2c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/pom.xml new file mode 100644 index 0000000000..9a936abe29 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/pom.xml @@ -0,0 +1,51 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + 4.0.0 + sample-helloworld + jar + Tuscany HelloWorld Sample + A sample implementation of HelloWorld using an SCA component. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/readme.htm new file mode 100644 index 0000000000..82de419b1c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/readme.htm @@ -0,0 +1,54 @@ + + + Tuscany +HelloWorld + +

Tuscany +Hello World Sample

+

Overview

+

The Tuscany helloworld sample shows using the Tuscany SCA +runtime in a J2SE environment  loading a component that +implements the classic introductory hello world example.

+

Location

This +sample is located  in the samples\sca\helloworld directory.

+

Setup

This sample depends on the Tuscany runtime and the sample jar, + + + sample-helloworld-incubating-M1.jar + + +, both of these must be available on the classpath to run the sample. +
    +
+

Running

+ + In the directory samples/sca/helloworld use the JDK 1.5 java command to run the class helloworld.HelloWorldClient + +
Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:target/sample-helloworld-incubating-M1.jar helloworld.HelloWorldClient
+
Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;target/sample-helloworld-incubating-M1.jar helloworld.HelloWorldClient
+ +

Results

+

The sample when run should simply display to the standard +output:
Hello World

+

Code Overview

+The source files are physically organized as shown below: +
src
+---main
    +---java
    ¦   +---helloworld
    ¦           HelloWorldClient.java
    ¦           HelloWorldImpl.java
    ¦           HelloWorldService.java
    ¦
    +---resources
            sca.module
+
+ + + + + + + +
sca.moduleDefines the SCA module and component. Defines for the +HelloWorldServiceComponent component  the Java class that +implements that component
HelloWorldService.javaDefines the Java interface implemented by the component.
HelloWorldImpl.javaImplements the SCA component. Uses the SCA service annotation +tag on the class to show what SCA interface is being implemented.
HelloWorldClient.javaCreates a Tuscany runtime and starts it.  Obtains +the module context which was defined by the sca.module file. From the +module context locates the HelloWorldServiceComponent and then +calls  the getGreetings method to invoke the component.

\ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldClient.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..da46402b05 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,55 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldClient { + + public static final void main(String[] args) throws Exception { + + // Create a Tuscany runtime for the sample module component + TuscanyRuntime tuscany = new TuscanyRuntime("HelloWorldModuleComponent", "http://helloworld"); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + + // Get the SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent"); + + // Invoke the HelloWorld service + String value = helloworldService.getGreetings("World"); + + System.out.println(value); + System.out.flush(); + + // Disassociate the runtime from this thread + tuscany.stop(); + + // Shut down the runtime + tuscany.shutdown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..bf7209e7a8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..1f87f17d74 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/sca.module new file mode 100644 index 0000000000..22d319a165 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/main/resources/sca.module @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/test/java/helloworld/HelloWorldTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/test/java/helloworld/HelloWorldTestCase.java new file mode 100644 index 0000000000..1a1c906ca8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworld/src/test/java/helloworld/HelloWorldTestCase.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import helloworld.HelloWorldService; +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * This shows how to test the HelloWorld service component. + */ +public class HelloWorldTestCase extends TestCase { + + private TuscanyRuntime tuscany; + + protected void setUp() throws Exception { + super.setUp(); + + // Create a Tuscany runtime for the sample module component + tuscany = new TuscanyRuntime("HelloWorldModuleComponent", "http://helloworld"); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + } + + public void testGreetings() throws Exception { + + // Get the SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent"); + + // Invoke the HelloWorld service + String value = helloworldService.getGreetings("World"); + + assertEquals(value, "Hello World"); + } + + protected void tearDown() throws Exception { + + // Stop the Tuscany runtime + tuscany.stop(); + + // Shutdown the runtime + tuscany.shutdown(); + + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/build.xml new file mode 100644 index 0000000000..5c72a1784e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/build.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/pom.xml new file mode 100644 index 0000000000..8f806cc986 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/pom.xml @@ -0,0 +1,49 @@ + + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + + 4.0.0 + sample-helloworlde4xws + war + Tuscany HelloWorld JavaScript/E4X Web Service Sample + A sample HelloWorld Web Service using JavaScript/E4X + incubating-M1 + + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + + org.apache.tuscany.sca.containers + tuscany-container-rhino + ${pom.version} + provided + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/readme.htm new file mode 100644 index 0000000000..53bc323d1f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/readme.htm @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + Tuscany Hello World JavaScript/E4X WS Sample + + + + + + + +

Tuscany Hello World JavaScript/E4X WS Sample

+ + + +

Overview

+ + + +

The Tuscany hello world JavaScript/E4X WS sample shows using the Tuscany SCA + runtime in a Tomcat environment providing a web service implemented in JavaScript/E4X.

+

Location

+This sample is located in the samples\sca\helloworlde4xws directory. + + + +

Setup

+Set up your server as described in the Tomcat +Setup.  If +you are not configuring with the acceptance test the server, you will +need to add helloworlde4xws-incubating-M1.war +to your Tomcat's webapp directory. + + +

Running

+This service can be invoked by the Tuscany SCA helloworldjsclient +sample.
+ +

Code Overview

+The source files are physically organized as shown below:
+
+
+---main
+---resources
¦ ¦ sca.module
¦ ¦
¦ +---helloworld
¦ ¦ HelloWorldImpl.componentType
¦ ¦ HelloWorldImpl.js
¦ ¦
¦ +---wsdl
¦ helloworld.wsdl
¦
+---webapp
+---WEB-INF
web.xml
+ +

+ + + + + + + + + + + + + + + + + + + +
+sca.module +Defines the SCA module, +entryPoint and component. Defines for the HelloWorldComponent +component and the JavaScript script that implements the component. For the +entryPoint it defines WSDL for the service, and wires the service to +the HelloWorldComponent
HelloWorldImpl.componentTypeThe .componentType side file describing the service
HelloWorldImpl.jsThe JavaScript implementation of the service
helloworld.wsdlWSDL for the service.
web.xmlStandard J2EE web application's web.xml
+ + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/helloworld/HelloWorldImpl.componentType b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/helloworld/HelloWorldImpl.componentType new file mode 100644 index 0000000000..54462091f5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/helloworld/HelloWorldImpl.componentType @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/helloworld/HelloWorldImpl.js b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/helloworld/HelloWorldImpl.js new file mode 100644 index 0000000000..1529784c0f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/helloworld/HelloWorldImpl.js @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function process(xmlIn) { + + var response = "e4xHello " + xmlIn..*::name; + + var xmlOut = + + { response } + ; + + return xmlOut; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/sca.module new file mode 100644 index 0000000000..4f5724d64b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/sca.module @@ -0,0 +1,34 @@ + + + + + + + + + + + HelloWorldComponent + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..cbc15f58eb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..37c6d8e249 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworlde4xws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + + + + Tuscany HelloWorld JavaScript Web Service Sample + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/build.xml new file mode 100644 index 0000000000..cd35274ff1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/build.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/pom.xml new file mode 100644 index 0000000000..f9a710d444 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/pom.xml @@ -0,0 +1,56 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + + 4.0.0 + sample-helloworldjsclient + war + Tuscany HelloWorld JSON-RPC WS Client Sample + A web app client for the HelloWorld Web service samples + incubating-M1 + + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + + org.apache.tuscany.sca.bindings + tuscany-binding-jsonrpc + ${pom.version} + provided + + + + org.apache.tuscany.sca.bindings + tuscany-binding-axis2 + ${pom.version} + provided + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/readme.htm new file mode 100644 index 0000000000..5aa9dbc3d5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/readme.htm @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + Tuscany Hello World JS WS Client Sample + + + + + + + +

Tuscany Hello World JS WS Client Sample

+ + + +

Overview

+ + + +

The Tuscany hello world JS client WS sample shows using the Tuscany SCA + runtime in a Tomcat environment providing a client for the Tuscany helloworld WS samples, helloworldws and helloworlde4xws.

+

Location

+This sample is located in the samples\sca\helloworldjsclient directory. + + + +

Setup

+Set up your server as described in the Tomcat +Setup.  If +you are not configuring with the acceptance test the server, you will +need to add sample-helloworldjsclient-incubating-M1.war +to your Tomcat's webapp directory. + + +

Running

+ +Once you've started your web server, use your browse to view the +following URL: http://localhost:8080/sample-helloworldjsclient/ +
+ +

Code Overview

+The source files are physically organized as shown below:
+
+
+---main
+---resources
¦ ¦ sca.module
¦ ¦
¦ +---wsdl
¦ helloworld.wsdl
¦
+---webapp
¦ HelloWorldClient.html
¦
+---WEB-INF
web.xml
+ +

+ + + + + + + + + + + + + + + +
+sca.module +Defines the SCA module, and +entryPoints which are wired directly to externalServices for each of the web services.
helloworld.wsdlWSDL for the service.
HelloWorldClient.htmlThe HTML page for the client. This includes a JavaScript script which uses the SCA JSON-RPC support to invoke methods on the SCA entryPoints.
web.xmlStandard J2EE web application's web.xml
+ +

+There isn't much code in this sample, only the script in the HTML for the page, and even that script is fairly simple. It demonstrates how simple SCA and its assembly model can make component implementations. +

+ + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/sca.module new file mode 100644 index 0000000000..f73adafbd5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/sca.module @@ -0,0 +1,49 @@ + + + + + + + + + + + JavaHelloworldWS + + + + + + E4XHelloworldWS + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..cbc15f58eb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/webapp/HelloWorldClient.html b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/webapp/HelloWorldClient.html new file mode 100644 index 0000000000..98d76dc25e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/webapp/HelloWorldClient.html @@ -0,0 +1,50 @@ + + + + Tuscany HelloWorld WS Client Sample + + + + + + + + +

Tuscany HelloWorld WS Client Sample


+ +

+ Name please:     + + +

+ + + + +

+ +

+
+ + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..9757e60124 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsclient/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,27 @@ + + + + + + Tuscany HelloWorld JSON-RPC WS Client Sample + + + HelloWorldClient.html + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/build.xml new file mode 100644 index 0000000000..2f655f9965 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/pom.xml new file mode 100644 index 0000000000..1949d593e0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/pom.xml @@ -0,0 +1,57 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + 4.0.0 + sample-helloworldjsonrpc + war + Tuscany HelloWorld JSON-RPC Sample + A sample HelloWorld Web application using JSON-RPC + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + org.apache.tuscany.sca.bindings + tuscany-binding-jsonrpc + ${pom.version} + provided + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/readme.htm new file mode 100644 index 0000000000..51c3dd2249 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/readme.htm @@ -0,0 +1,139 @@ + + + + + + + + Tuscany Hello World JSON-RPC Sample + + + +

Tuscany Hello World JSON-RPC Sample

+ +

Overview

+ +

The Tuscany hello world JSON-RPC sample shows using the Tuscany SCA + runtime in a Tomcat environment being accessed from a JavaScript program running in the client browser that + implements the classic introductory hello world example.

+ + +

Setup

Set up your server as described in the Tomcat + Setup.  If you are not configuring with the acceptance test the server, you will need to add sample-helloworldjsonrpc-incubating-M1.war to your tomcat's webapp directory.
+ +

Running

+ +Once you've started your web server, use your browse to view the +following URL: http://localhost:8080/sample-helloworldjsonrpc/ +
+ +You should see a form you can supply your name and a button. + Once you click the button the JavaScript program locates the SCA component to execute +the greeting service. +
+Note, unlike the J2SE or JSP clients the Tuscany runtime is automatically +initialized and running. +

Results

+ +

The page should be updated with the greeting displayed below + the form.
+ +

+ +

Code Overview

+ +The source files are physically organized as shown below:
+ + + + + + +
+
+---main
¦ +---java
¦ ¦ sca.module + +---org
¦ +---apache
¦ +---tuscany
¦ +---samples
¦ +---helloworldjsonrpc + ¦ HelloWorldService.java + ¦ HelloWorldServiceComponentImpl.java
+---webapp + ¦ helloworld.js + ¦ HelloWorldJSONRPC.html + +---WEB-INF
¦ web.xml
+
+
+
+ +

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sca.moduleDefines the SCA module, entryPoint and component. Defines an entryPoint with an JSON-RPC binding, and the + HelloWorldService component and the Java class that + implements that component
HelloWorldService.javaDefines the Java interface implemented by the component.
HelloWorldServiceComponentImpl.javaImplements the SCA component. Uses the SCA service + annotation tag on the class to show what SCA interface is being + implemented.
helloworld.jsHandles invoking the HelloWorld SCA service. Gets the value entered in the text field on the web page, invokes the SCA component and puts the result in the output field on the web page. +
The interesting part of the script is  SCA.HelloWorldService.getGreetings(who)  . + In the SCA JSON-RPC environment all entryPoints with an JSON-RPC binding are bound to the automatically defined script variable  SCA. . +
HelloWorldJSONRPC.htmlThe HTML page for the sample. Creates a text box for the user to enter their name, a button to click to get the greeting, and a text field to show the response. + The helloworld.js script function getGreeting is used to invoke the SCA service when the button is clicked. + To initialize the SCA environment the sca.js script must be defined as the first script in the HTML with the following line:
+ <script type="text/javascript" src="SCA/scripts/sca.js"> + +
web.xmlStandard J2EE web application's web.xml
+ +
+ + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/java/org/apache/tuscany/samples/helloworldjsonrpc/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/java/org/apache/tuscany/samples/helloworldjsonrpc/HelloWorldService.java new file mode 100644 index 0000000000..f5d3ef6066 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/java/org/apache/tuscany/samples/helloworldjsonrpc/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldjsonrpc; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/java/org/apache/tuscany/samples/helloworldjsonrpc/HelloWorldServiceComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/java/org/apache/tuscany/samples/helloworldjsonrpc/HelloWorldServiceComponentImpl.java new file mode 100644 index 0000000000..3eb259f90e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/java/org/apache/tuscany/samples/helloworldjsonrpc/HelloWorldServiceComponentImpl.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.samples.helloworldjsonrpc; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldService.class) +public class HelloWorldServiceComponentImpl implements HelloWorldService { + + /* + * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() + */ + public String getGreetings(String name) { + return "jsonrpcHello " + name; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/sca.module new file mode 100644 index 0000000000..0ad0131754 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/resources/sca.module @@ -0,0 +1,32 @@ + + + + + + + + HelloWorldServiceComponent/HelloWorldService + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/webapp/HelloWorldJSONRPC.html b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/webapp/HelloWorldJSONRPC.html new file mode 100644 index 0000000000..9e5357a847 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/webapp/HelloWorldJSONRPC.html @@ -0,0 +1,48 @@ + + + + Tuscany JSON-RPC HelloWorld Example + + + + + + + + +

Tuscany JSON-RPC HelloWorld Example


+ +

+ Name please:     + + +

+ + +

+ +

+
+ + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..547153dd0e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldjsonrpc/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,27 @@ + + + + + + Tuscany sample HelloWorld JSON-RPC + + + HelloWorldJSONRPC.html + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/build.xml new file mode 100644 index 0000000000..077ea72dd1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/pom.xml new file mode 100644 index 0000000000..fdc9629d9e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/pom.xml @@ -0,0 +1,51 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + 4.0.0 + sample-helloworldweb + war + Tuscany HelloWorld Web Application Sample + A sample JSP that invokes a HelloWorld component. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/readme.htm new file mode 100644 index 0000000000..037b1d70f8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/readme.htm @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + Tuscany Hello World Web Sample + + + + + + + +

Tuscany Hello World Web Sample

+ + + +

Overview

+ + + +

The Tuscany hello world web sample shows using the Tuscany SCA + runtime in a Tomcat environment being accessed from a JSP + page that + implements the classic introductory hello world example.

+

Location

+This sample is located  in the samples\sca\helloworldweb directory. + + + +

Setup

+ +Set up your server as described in the Tomcat Setup.   + +If you are not using the pre-configured Tomcat server from the binary distribution, you will need to add sample-helloworldweb-incubating-M1.war to your tomcat's webapp directory.
+ + + +

Running

+ + + +Once you've started your web server, use your browse to view the +following URL: http://localhost:8080/sample-helloworldweb/ +
+ + + +You should see a form you can supply your name and a submit button. + Once you submit the form the JSP page calls a Java class that +gets the CurrentModuleContext and locates the SCA component to execute +the greeting service.  Note, unlike the a J2SE in a Tomcat environment the Tuscany runtime is automatically +initialized and running. +

Results

+ + + +

The page should be updated with the greeting displayed below + the form.
+ + + +

+ + + +

Code Overview

+ + + +The source files are physically organized as shown below:
+ + + + + + + + + + + + + + + + + + + + +
+ + +
src
+---main
+---java
¦ +---helloworld
¦ HelloWorldImpl.java
¦ HelloWorldService.java
¦
+---resources
¦ sca.module
¦
+---webapp
¦ HelloWorldWeb.jsp
¦
¦
+---WEB-INF
web.xml

+ + +
+ + +
+ + +
+ + + +

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sca.moduleDefines the SCA module and component. Defines for the + HelloWorldServiceComponent component and the Java class that + implements that component
HelloWorldService.javaDefines the Java interface implemented by the component.
HelloWorldImpl.javaImplements the SCA component. Uses the SCA service + annotation tag on the class to show what SCA interface is being + implemented.
HelloWorldWeb.jspHandles Web form input.. Obtains the module context which was defined by the + sca.module file. From the module context locates the + HelloWorldServiceComponent and then calls  the getGreetings + method to invoke the component. and formats  returned results.
web.xmlStandard J2EE web application's web.xml
+ + + +
+ + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..bf7209e7a8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..1f87f17d74 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/sca.module new file mode 100644 index 0000000000..ec329b8a23 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/resources/sca.module @@ -0,0 +1,24 @@ + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/webapp/HelloWorldWeb.jsp b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/webapp/HelloWorldWeb.jsp new file mode 100644 index 0000000000..5ebc111dd6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/webapp/HelloWorldWeb.jsp @@ -0,0 +1,79 @@ + +<%-- + * 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. + --%> + + + + <%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1" session="true" autoFlush="true" + isThreadSafe="true" isErrorPage="false" + import="helloworld.HelloWorldService" + import="java.io.PrintWriter" + import="java.io.StringWriter" + import="org.osoa.sca.CurrentModuleContext" + import="org.osoa.sca.ModuleContext" + %> + + + Tuscany HelloWorld WEB Example + <% + String name = request.getParameter("name"); + %> + + + +

Tuscany HelloWorld Web Application Sample

+ +

 

+ +
Name + please:    ">
+
+
+
+ +<% + try { + if (null != name) { + ModuleContext moduleContext = CurrentModuleContext.getContext(); + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent"); + String value = helloworldService.getGreetings(name); +%> +
+ +

<%=value%> + <%} +}catch(Exception e){ + e.printStackTrace(); + StringWriter sw= new StringWriter(); + PrintWriter pw= new PrintWriter(sw); + + e.printStackTrace(pw); + pw.flush(); + +%> + Whoops!
+

+    Exception "<%=e.getClass().getName()%>" Exception message: "<%=e.getMessage()%>"
+ <%=sw.toString() %> +
+<% + + }%> + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..e79a53705f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,27 @@ + + + + + + Tuscany HelloWorld Web Application Sample + + + HelloWorldWeb.jsp + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/test/java/helloworld/HelloWorldTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/test/java/helloworld/HelloWorldTestCase.java new file mode 100644 index 0000000000..b74323fe2a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldweb/src/test/java/helloworld/HelloWorldTestCase.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import helloworld.HelloWorldService; +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * This shows how to test the HelloWorld service component. + */ +public class HelloWorldTestCase extends TestCase { + + private TuscanyRuntime tuscany; + + protected void setUp() throws Exception { + super.setUp(); + + // Create a Tuscany runtime for the sample module component + tuscany = new TuscanyRuntime("HelloWorldModuleComponent", null); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + } + + public void testGeetings() throws Exception { + + // Get the SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent"); + + // Invoke the HelloWorld service + String value = helloworldService.getGreetings("World"); + + assertEquals(value, "Hello World"); + } + + protected void tearDown() throws Exception { + + // Stop the Tuscany runtime + tuscany.stop(); + + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/build.xml new file mode 100644 index 0000000000..6cdc29cf7d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/build.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/pom.xml new file mode 100644 index 0000000000..b16d3b17c8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/pom.xml @@ -0,0 +1,53 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + + 4.0.0 + sample-helloworldws-celtix + jar + Tuscany HelloWorld Celtix Web Service Sample + A sample HelloWorld Web Service. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + org.apache.tuscany.sca.bindings + tuscany-binding-celtix + ${pom.version} + provided + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/readme.htm new file mode 100644 index 0000000000..9b6b360892 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/readme.htm @@ -0,0 +1,92 @@ + + + + + + + Tuscany Hello World Celtix Web Service Sample + + + + + +

Tuscany Hello World Celtix Web service Sample

Overview

+

+ The Tuscany hello world Celtix Web service sample shows using the Tuscany SCA runtime as a standalone web service. +

+

Location

This sample is located  in the samples\sca\helloworldws-celtix + directory.
+ + +

Setup

This sample depends on the Tuscany runtime, Celtix, and the sample jar, + + + sample-helloworldws-celtix-incubating-M1.jar + + +, all of these must be available on the classpath to run the sample. + +

Running

+ + In the directory samples/sca/helloworldws-celtix use the JDK 1.5 java command to run the class helloworld.HelloWorldServer + +
Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:../../../lib/celtix/tuscany-celtix-incubating-M1.jar:target/sample-helloworldws-celtix-incubating-M1.jar helloworld.HelloWorldServer
+
Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;../../../lib/celtix/tuscany-celtix-incubating-M1.jar;target/sample-helloworldws-celtix-incubating-M1.jar helloworld.HelloWorldServer
+ +

Code Overview

The source files are physically organized as shown below:
+ + + + + + +
+
+   +---main
+   +---java
+   ¦   +---helloworld
+   ¦           HelloWorldServer.java
+   ¦           HelloWorldImpl.java
+   ¦           HelloWorldService.java
+   +---resources
+     ¦   sca.module
+     +---wsdl
+            helloworld.wsdl 
+                
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
HelloWorldServer.javaMain method to startup the Tuscany runtime which will startup the services defined in sca.module
HelloWorldService.javaDefines the Java interface implemented by the component.
HelloWorldImpl.javaImplements the SCA component. Uses the SCA service annotation + tag on the class to show what SCA interface is being implemented.
sca.moduleDefines the SCA module, entryPoint and component. + Defines for the HelloWorldServiceComponent component and the Java class that + implements the component For the entryPoint it defines WSDL for the service, the + Java interface provided by the service, and wires the service to the HelloWorldServiceComponent
helloworld.wsdlWSDL for the service.
+ + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..bf7209e7a8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldServer.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..e6290b3f37 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,49 @@ +/** + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldServer { + + public static final void main(String[] args) throws Exception { + + // Create a Tuscany runtime for the sample module component + TuscanyRuntime tuscany = new TuscanyRuntime("HelloWorldModuleComponent", "http://helloworld"); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + + + System.out.println("Hit ENTER to exit"); + System.in.read(); + + // Disassociate the runtime from this thread + tuscany.stop(); + + // Shut down the runtime + tuscany.shutdown(); + + System.exit(0); + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..1f87f17d74 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/sca.module new file mode 100644 index 0000000000..e16c62129a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/sca.module @@ -0,0 +1,33 @@ + + + + + + + + + + + HelloWorldServiceComponent/HelloWorldService + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..5e89bb071d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws-celtix/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/build.xml new file mode 100644 index 0000000000..2ec1f34959 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/pom.xml new file mode 100644 index 0000000000..32086e1074 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/pom.xml @@ -0,0 +1,57 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + 4.0.0 + sample-helloworldws + war + Tuscany HelloWorld Web Service Sample + A sample HelloWorld Web Service. + incubating-M1 + + + axis2 + + + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + + junit + junit + 3.8.1 + test + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/readme.htm new file mode 100644 index 0000000000..af3620aa9f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/readme.htm @@ -0,0 +1,48 @@ + + +Tuscany +Hello World Web Service Sample + +

Tuscany +Hello World WS Sample

+

Overview

+

The Tuscany hello world ws sample shows using the Tuscany SCA +runtime in a Tomcat environment providing a web +service.

+

Location

+This sample is located  in the samples\sca\helloworldws +directory.
+

Setup

+Set up your server as described in the Tomcat +Setup.  If you are not using the pre-configured Tomcat server from the binary distribution, you will need to add + sample-helloworldws-incubating-M1.war +to your Tomcat's webapp directory. +

Running

+This service can be invoked by the Tuscany SCA helloworldwsclient or helloworldjsclient +sample.
+

Code Overview

+The source files are physically organized as shown below:
+
+
+---main
+---resources
¦ ¦ sca.module
¦ ¦
¦ +---wsdl
¦ helloworld.wsdl
¦
+---webapp
+---WEB-INF
web.xml
+

+ + + + + + + +
sca.moduleDefines the SCA module, +entryPoint and component. Defines for the HelloWorldServiceComponent +component and the Java class that implements the component For the +entryPoint it defines WSDL for the service, the Java interface provided +by the service, and wires the service to +the HelloWorldServiceComponent
helloworld.wsdlWSDL for the service.
web.xmlStandard J2EE web application's web.xml
+

You may have noticed that there is no Java source for this +components implementation.  There reason is this sample reuses +the code from the helloworld sample to implement the service. +

diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..bf7209e7a8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..1f87f17d74 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/sca.module new file mode 100644 index 0000000000..20139fced7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/sca.module @@ -0,0 +1,33 @@ + + + + + + + + + + + HelloWorldServiceComponent/HelloWorldService + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..cbc15f58eb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..603eebabb1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldws/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,23 @@ + + + + + + Tuscany HelloWorld Web Service Sample + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/build.xml new file mode 100644 index 0000000000..80258a4c81 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/build.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/pom.xml new file mode 100644 index 0000000000..9291bb5e47 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/pom.xml @@ -0,0 +1,61 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + 4.0.0 + sample-helloworldwsclient + jar + Tuscany HelloWorld Web Service Client Sample + A sample client for a HelloWorld Web Service. + incubating-M1 + + + axis2 + + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + org.apache.tuscany.sca.bindings + tuscany-binding-${ws.type} + ${pom.version} + provided + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/readme.htm new file mode 100644 index 0000000000..5a69727ad2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/readme.htm @@ -0,0 +1,64 @@ + + + Tuscany +Hello World Web Sample + +

Tuscany Hello World WS Client Sample

+

Overview

+

The Tuscany hello world WS client sample shows using the +Tuscany SCA runtime in a J2SE environment invoking a web service.

+

Location

+This sample is located  in the samples\sca\helloworldwsclient +directory.
+ + +

Setup

This sample depends on the Tuscany runtime, Axis2, and the sample jar, + + + sample-helloworldwsclient-incubating-M1.jar + + +, all of these must be available on the classpath to run the sample. Additionally, one of the helloworld web services must be running, either the Tomcat version, helloworldws sample or the Celtix version, helloworldws-celtix sample. +
    +
+

Running

+ + In the directory samples/sca/helloworldwsclient use the JDK 1.5 java command to run the class helloworld.HelloWorldClient + +
Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:../../../lib/axis2/tuscany-axis2-incubating-M1.jar:target/sample-helloworldwsclient-incubating-M1.jar helloworld.HelloWorldClient
+
Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;../../../lib/axis2/tuscany-axis2-incubating-M1.jar;target/sample-helloworldwsclient-incubating-M1.jar helloworld.HelloWorldClient
+ + Note: In the above classpaths, you can replace axis2/tuscany-axis2-incubating-M1.jar with celtix/tuscany-celtix-incubating-M1.jar to use Celtix as the underlying webservices implementation. + +

Results

+

The sample when run should simply display to the standard +output:
Hello World

+

Code Overview

+The source files are physically organized as shown below:
+ + + +
src
+---main
+---java
¦ +---helloworld
¦ HelloWorldClient.java
¦ HelloWorldService.java
¦
+---resources
¦ logging.properties
¦ sca.module
¦
+---wsdl
helloworld.wsdl




+
+ + + + + + + +
sca.moduleDefines the SCA module, +externalService and component. Defines for the +HelloWorldServiceComponent component and the Java class that implements +the component For the externalService it defines WSDL for the service, +the Java interface provided by the service. +The the HelloWorldServiceComponent is via a +referenced wired to the externalService
HelloWorldClient.javaCreates a Tuscany runtime and starts it.  Obtains +the module context which was defined by the sca.module file. From the +module context locates the HelloWorldService entryPoint and then +calls  the getGreetings method to invoke the web service defined in the helloword.wsdl.
HelloWorldService.javaDefines the Java interface +implemented by the component.
helloworld.wsdlWSDL for the service.
\ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..be121bc63b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +import java.util.logging.Level; +import java.util.logging.LogManager; +import java.util.Properties; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.JavaLoggingMonitorFactory; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldClient { + + public static final void main(String[] args) throws Exception { + + // Setup Tuscany monitoring to use java.util.logging + LogManager.getLogManager().readConfiguration(HelloWorldClient.class.getResourceAsStream("/logging.properties")); + Properties levels = new Properties(); + MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages"); + + // Create a Tuscany runtime for the sample module component + TuscanyRuntime tuscany = new TuscanyRuntime("HelloWorldModuleComponent", "http://helloworld", monitorFactory); + + // Start the Tuscany runtime and associate it with this thread + tuscany.start(); + + // Get the SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldService"); + + // Invoke the HelloWorld service + String value = helloworldService.getGreetings("World"); + + System.out.println(value); + System.out.flush(); + + // Disassociate the runtime from this thread + tuscany.stop(); + + // Shut down the runtime + tuscany.shutdown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..1f87f17d74 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package helloworld; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/logging.properties b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/logging.properties new file mode 100644 index 0000000000..58407bd5a9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/logging.properties @@ -0,0 +1,27 @@ +# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/sca.module new file mode 100644 index 0000000000..3247636e91 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/sca.module @@ -0,0 +1,28 @@ + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..cbc15f58eb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/pom.xml new file mode 100644 index 0000000000..ae04924f5e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/pom.xml @@ -0,0 +1,45 @@ + + + + + org.apache.tuscany.samples + tuscany-samples + incubating-M1 + + + 4.0.0 + org.apache.tuscany.samples.sca + tuscany-samples-sca + pom + Tuscany SCA Samples + incubating-M1 + + + helloworld + helloworldweb + calculator + customerinfo + helloworldws + helloworldws-celtix + helloworldwsclient + supplychain + helloworldjsonrpc + helloworld-jms + helloworlde4xws + helloworldjsclient + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/readme.htm new file mode 100644 index 0000000000..2e3af5de93 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/readme.htm @@ -0,0 +1,95 @@ + + + + + + + + Tuscany SCA Samples + + + + +

Tuscany SCA Technology Samples

To configure and build  see +Sample setup
+
+
+

Sample Summary

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tuscany samples summary
helloworldSample showing a J2SE client using the Tuscany SCA runtime and + invoking a component. +
helloworldweb Sample showing a J2EE web app client using the Tuscany SCA + runtime and invoking a component. +
helloworldws Sample showing a Tuscany SCA component exposed as a Web + service endpoint. +
helloworldwsclient Sample showing a J2SE client using the Tuscany SCA runtime and + invoking a remote Web service +
helloworldws-celtixHelloWorld Sample using Celtix.
helloworld-jms serverHelloWorld JMS server sample using Celtix.
helloworld-jms clientHelloWorld JMS client sample using Celtix.
helloworlde4xwsSample showing a JavaScript/E4X component exposed as a Web + service
helloworldjsonrpcSample HelloWorld Web application using JSON-RPC
helloworldjsclientAnother JSON-RPC web app sample showing a Web service client
calculatorSample showing  Tuscany SCA runtime using multiple + components.
customerinfoSample showing  a component  exposing a WSDL +  portType interface and using the dynamic SDO API
supplychainSample showing the use of Tuscany SCA asynchronous API
+
+
+ + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/build.xml new file mode 100644 index 0000000000..8311b1708b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/build.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/pom.xml new file mode 100644 index 0000000000..3ee6f1e9f1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/pom.xml @@ -0,0 +1,52 @@ + + + + + org.apache.tuscany.samples.sca + tuscany-samples-sca + incubating-M1 + + + 4.0.0 + sample-supplychain + jar + Tuscany Supply Chain Sample + A sample implementation of an asynchronous supply chain application. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/readme.htm new file mode 100644 index 0000000000..d7e2d92c53 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/readme.htm @@ -0,0 +1,71 @@ + + + Tuscany +Supply Chain + +

Tuscany +Supply Chain Sample

+

Overview

+

The Tuscany supply chain sample shows using the Tuscany SCA +runtime in a J2SE environment executing the SCA asynchronous API.

+

Location

This +sample is located  in the samples\sca\supplychain directory.
+

Setup

This sample depends on the Tuscany runtime +and the sample jar, sample-supplychain-incubating-M1.jar +, both of these must be available on the classpath to run the sample. +

Running

In the directory samples\sca\supplychain +use the JDK 1.5 java command to run the class supplychain.SupplyChainClient
Linux: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar:target\sample-supplychain-incubating-M1.jar supplychain.SupplyChainClient
+
Windows: java -cp ../../../lib/tuscany-runtime-incubating-M1.jar;target\sample-supplychain-incubating-M1.jar supplychain.SupplyChainClient

Results

+

The sample when run should simply display to the standard +output:

May 16, 2006 +3:12:13 PM org.apache.tuscany.core.client.TuscanyRuntime$Monitor +moduleStarted
INFO: Started application module [supplychain]
Main +thread Thread[main,5,main]
Work thread Thread[Thread-1,5,main] +- Order, submitted, fulfilled, shipped

+

Code Overview

+The source files are physically organized as shown below: +
src
+---main
    ++---java
    +¦   +---supplychain
    +¦           +Customer.java
    +¦           +CustomerComponentImpl.java
    +¦           +Retailer.java
    +¦           +RetailerComponentImpl.java
    +¦           +Shipper.java
    +¦           +ShipperComponentImpl.java
    +¦           +SupplyChainClient.java
    +¦           +Warehouse.java
    +¦           +WarehouseComponentImpl.java
    +¦
    +---resources
            +logging.properties
            +sca.module
+
+ + + + + +
Customer.javaDefines the Java interface implemented by the Customer +component.
CustomerComponentImpl.javaImplements the SCA Customer component.
Retailer.javaDefines the Java interface implemented by the Retailer +component.
RetailerComponentImpl.javaImplements +the SCA RetailerComponent component.
Shipper.javaDefines +the Java interface implemented by the Shipper component
ShipperComponentImpl.javaImplements +the SCA ShipperComponent component.
SupplyChainClient.javaSupplyChainClient.java +loads SCA runtime
Warehouse.javaDefines +the Java interface implemented by the Warehouse component.
WarehouseComponentImpl.javaImplements +the SCA WarehouseComponent component.
logging.propertiesConfigures +Tuscany logging. Provides the output of this demo.
sca.moduleDefines +and assembles the SCA components

\ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Customer.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Customer.java new file mode 100644 index 0000000000..5d35802833 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Customer.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package supplychain; + +import org.osoa.sca.annotations.OneWay; + +/** + * This is the business interface of the Customer service component. + */ +public interface Customer { + + public void purchaseGoods(); + + @OneWay + public void notifyShipment(String order); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/CustomerComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/CustomerComponentImpl.java new file mode 100644 index 0000000000..2ec01ebbc8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/CustomerComponentImpl.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package supplychain; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the Customer service component. + */ +@Service(Customer.class) +public class CustomerComponentImpl implements Customer { + + private Retailer retailer; + + @Reference + public void setRetailer(Retailer retailer) { + this.retailer = retailer; + } + + public void purchaseGoods() { + retailer.submitOrder("Order"); + } + + public void notifyShipment(String order) { + System.out.print("Work thread " + Thread.currentThread() + " - "); + System.out.println(order); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Retailer.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Retailer.java new file mode 100644 index 0000000000..9496e730f5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Retailer.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package supplychain; + +/** + * This is the business interface of the Retailer service component. + */ +public interface Retailer { + + public void submitOrder(String order); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/RetailerComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/RetailerComponentImpl.java new file mode 100644 index 0000000000..4079bd2aea --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/RetailerComponentImpl.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package supplychain; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the Customer service component. + */ +@Service(Retailer.class) +public class RetailerComponentImpl implements Retailer { + + private Warehouse warehouse; + + @Reference + public void setWarehouse(Warehouse warehouse) { + this.warehouse = warehouse; + } + + public void submitOrder(String order) { + warehouse.fulfillOrder(order + ", submitted"); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Shipper.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Shipper.java new file mode 100644 index 0000000000..94d60d99a2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Shipper.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package supplychain; + +/** + * This is the business interface of the Shipper service component. + */ +public interface Shipper { + + public void processShipment(String order); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/ShipperComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/ShipperComponentImpl.java new file mode 100644 index 0000000000..4283bed795 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/ShipperComponentImpl.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package supplychain; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the Warehouse service component. + */ +@Service(Shipper.class) +public class ShipperComponentImpl implements Shipper { + + private Customer customer; + + @Reference + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public void processShipment(String order) { + customer.notifyShipment(order + ", shipped"); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/SupplyChainClient.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/SupplyChainClient.java new file mode 100644 index 0000000000..de30da9428 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/SupplyChainClient.java @@ -0,0 +1,57 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package supplychain; + +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.LogManager; + +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.JavaLoggingMonitorFactory; +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate a Customer service component and invoke it. + */ +public class SupplyChainClient { + + public static final void main(String[] args) throws Exception { + + // Setup Tuscany monitoring to use java.util.logging + LogManager.getLogManager().readConfiguration(SupplyChainClient.class.getResourceAsStream("/logging.properties")); + Properties levels = new Properties(); + MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages"); + + // Obtain Tuscany runtime + TuscanyRuntime tuscany = new TuscanyRuntime("supplychain", null, monitorFactory); + + // Associate the application module component with this thread + tuscany.start(); + + // Obtain SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service component and invoke it + Customer customer = (Customer) moduleContext.locateService("CustomerComponent"); + System.out.println("Main thread " + Thread.currentThread()); + customer.purchaseGoods(); + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Warehouse.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Warehouse.java new file mode 100644 index 0000000000..de52e71c1e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/Warehouse.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package supplychain; + +/** + * This is the business interface of the Warehouse service component. + */ +public interface Warehouse { + + public void fulfillOrder(String order); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java new file mode 100644 index 0000000000..96e0f2795b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package supplychain; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the Warehouse service component. + */ +@Service(Warehouse.class) +public class WarehouseComponentImpl implements Warehouse { + + private Shipper shipper; + + @Reference + public void setShipper(Shipper shipper) { + this.shipper = shipper; + } + + public void fulfillOrder(String order) { + shipper.processShipment(order + ", fulfilled"); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/logging.properties b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/logging.properties new file mode 100644 index 0000000000..58407bd5a9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/logging.properties @@ -0,0 +1,27 @@ +# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/sca.module new file mode 100644 index 0000000000..e44798b89f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/main/resources/sca.module @@ -0,0 +1,48 @@ + + + + + + + + RetailerComponent + + + + + + + WarehouseComponent + + + + + + + ShipperComponent + + + + + + + CustomerComponent + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java new file mode 100644 index 0000000000..ecc3b17985 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/samples/sca/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package supplychain; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import supplychain.Customer; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate a simple HelloWorld service component and invoke it. + */ +public class SupplyChainClientTestCase extends TestCase { + + public void test() throws Exception { + + // Obtain Tuscany runtime + TuscanyRuntime tuscany = new TuscanyRuntime("hello", null); + + // Associate the application module component with this thread + tuscany.start(); + + // Obtain SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service component and invoke it + // Locate the CustomerComponent service component and invoke it + Customer customer = (Customer) moduleContext.locateService("CustomerComponent"); + System.out.println("Main thread " + Thread.currentThread()); + customer.purchaseGoods(); + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/pom.xml new file mode 100644 index 0000000000..f35a4735fb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/pom.xml @@ -0,0 +1,150 @@ + + + + + + org.apache.tuscany.sca.bindings + tuscany-sca-bindings + incubating-M1 + + + 4.0.0 + tuscany-binding-axis2 + Tuscany Axis2 Binding + Implementation of the SCA Web Services binding using Axis2. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + compile + + + + org.apache.tuscany.databinding + tuscany-databinding-sdo + ${pom.version} + compile + + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + test + + + + + axis2 + axis2-kernel + 1.0 + compile + + + + ws-commons + axiom-api + 1.0 + compile + + + + ws-commons + axiom-impl + 1.0 + compile + + + + ws-commons + neethi + 1.0.1 + runtime + + + + org.apache.ws.commons + XmlSchema + 1.0.2 + runtime + + + + commons-httpclient + commons-httpclient + 3.0 + runtime + + + + commons-codec + commons-codec + 1.3 + runtime + + + + wsdl4j + wsdl4j + 1.5.2 + + + + stax + stax-api + 1.0 + compile + + + + woodstox + wstx-asl + 2.9.3 + runtime + + + + + + tomcat + servlet-api + 5.0.18 + provided + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceAssemblyFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceAssemblyFactory.java new file mode 100644 index 0000000000..8114b348d1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceAssemblyFactory.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly; + +import org.apache.tuscany.model.assembly.AssemblyFactory; + +/** + * The Factory for the model. + */ +public interface WebServiceAssemblyFactory extends AssemblyFactory { + + /** + * Returns a new WebServiceBinding. + */ + WebServiceBinding createWebServiceBinding(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceBinding.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceBinding.java new file mode 100644 index 0000000000..ea9f3f116f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/WebServiceBinding.java @@ -0,0 +1,75 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly; + +import javax.wsdl.Definition; +import javax.wsdl.Port; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.model.assembly.Binding; + +import commonj.sdo.helper.TypeHelper; + +/** + * Represents a Web service binding. + */ +public interface WebServiceBinding extends Binding { + + /** + * Set the URI of the WSDL port for this binding. + * + * @param portURI + * the URI of the WSDL port + */ + void setPortURI(String portURI); + + /** + * Returns the WSDL port defining this binding. + */ + Port getWSDLPort(); + + /** + * Returns the WSDL definition containing the WSDL port. + * + * @return the WSDL definition containing the WSDL port + */ + Definition getWSDLDefinition(); + + /** + * Sets the WSDL port defining this binding. + */ + void setWSDLPort(Port value); + + /** + * Sets the WSDL definition containing the WSDL port. + * + * @param definition + */ + void setWSDLDefinition(Definition definition); + + TypeHelper getTypeHelper(); + + void setTypeHelper(TypeHelper typeHelper); + + ResourceLoader getResourceLoader(); + + void setResourceLoader(ResourceLoader resourceLoader); + + public void setWebAppName(String webAppName); + + public String getWebAppName(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceAssemblyFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceAssemblyFactoryImpl.java new file mode 100644 index 0000000000..5523d8fdc0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceAssemblyFactoryImpl.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.impl; + +import org.apache.tuscany.binding.axis2.assembly.WebServiceAssemblyFactory; +import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; +import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; + +/** + * An implementation of the model Factory. + */ +public class WebServiceAssemblyFactoryImpl extends AssemblyFactoryImpl implements WebServiceAssemblyFactory { + + /** + * Creates an instance of the factory. + */ + public WebServiceAssemblyFactoryImpl() { + super(); + } + + /** + * @see org.apache.tuscany.binding.axis2.assembly.WebServiceAssemblyFactory#createWebServiceBinding() + */ + public WebServiceBinding createWebServiceBinding() { + return new WebServiceBindingImpl(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceBindingImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceBindingImpl.java new file mode 100644 index 0000000000..5be1b87e01 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/assembly/impl/WebServiceBindingImpl.java @@ -0,0 +1,176 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.impl; + +import java.util.Collection; +import java.util.List; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; + +import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.impl.BindingImpl; + +import commonj.sdo.helper.TypeHelper; + +/** + * An implementation of WebServiceBinding. + */ +public class WebServiceBindingImpl extends BindingImpl implements WebServiceBinding { + + private Definition definition; + + private Port port; + + private String portURI; + + private TypeHelper typeHelper; + + private ResourceLoader resourceLoader; + + private String webAppName; + + /** + * Constructor + */ + protected WebServiceBindingImpl() { + } + + public TypeHelper getTypeHelper() { + return typeHelper; + } + + public void setTypeHelper(TypeHelper typeHelper) { + this.typeHelper = typeHelper; + } + + public ResourceLoader getResourceLoader() { + return resourceLoader; + } + + public void setResourceLoader(ResourceLoader resourceLoader) { + this.resourceLoader = resourceLoader; + } + + /** + * @see org.apache.tuscany.binding.axis2.assembly.WebServiceBinding#getWSDLPort() + */ + public Port getWSDLPort() { + return port; + } + + /** + * @see org.apache.tuscany.binding.axis2.assembly.WebServiceBinding#setWSDLPort(javax.wsdl.Port) + */ + public void setWSDLPort(Port value) { + checkNotFrozen(); + this.port = value; + } + + /** + * @see org.apache.tuscany.binding.axis2.assembly.WebServiceBinding#getWSDLDefinition() + */ + public Definition getWSDLDefinition() { + return definition; + } + + /** + */ + public void setWSDLDefinition(Definition pdefinition) { + checkNotFrozen(); + this.definition = pdefinition; + } + + /** + * @param portURI + * The portURI to set. + */ + public void setPortURI(String portURI) { + this.portURI = portURI; + } + + public void setWebAppName(String webAppName) { + this.webAppName = webAppName; + } + + public String getWebAppName() { + return webAppName; + } + + /** + */ + @SuppressWarnings("unchecked") + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) { + return; + } + super.initialize(modelContext); + + // Get the WSDL port namespace and name + // We currently support two syntaxes for specifying a WSDL port: + // namespace#portName, this is what we supported in the initial contribution, we will + // deprecate this after M1 + // namespace#wsdl.endpoint(serviceName/portName), this is the WSDL 2.0 syntax + if (port == null && portURI != null) { + int h = portURI.indexOf('#'); + String portNamespace = portURI.substring(0, h); + String serviceName; + String portName; + + String fragment = portURI.substring(h + 1); + if (fragment.startsWith("wsdl.endpoint(") && fragment.endsWith(")")) { + fragment = fragment.substring(14, fragment.length()-1); + int slash = fragment.indexOf('/'); + if (slash != -1) { + serviceName = fragment.substring(0, slash); + portName = fragment.substring(slash+1); + } else { + serviceName = null; + portName = fragment; + } + } else { + serviceName = null; + portName = fragment; + } + + // Load the WSDL definitions for the given namespace + List definitions = modelContext.getAssemblyLoader().loadDefinitions(portNamespace); + if (definitions == null) { + throw new IllegalArgumentException("Cannot find WSDL definition for " + portNamespace); + } + for (Definition def : definitions) { + + // Find the port with the given name + for (Service service : (Collection) def.getServices().values()) { + if (serviceName != null && !serviceName.equals(service.getQName().getLocalPart())) + continue; + Port prt = service.getPort(portName); + if (prt != null) { + this.definition = def; + this.port = prt; + return; + } + } + } + throw new IllegalArgumentException("Cannot find WSDL port " + portURI); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java new file mode 100644 index 0000000000..9b428f8be8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilder.java @@ -0,0 +1,146 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.builder; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Definition; +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.MessageContextConstants; +import org.apache.axis2.description.AxisService; +import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; +import org.apache.tuscany.binding.axis2.config.WSExternalServiceContextFactory; +import org.apache.tuscany.binding.axis2.externalservice.Axis2OperationInvoker; +import org.apache.tuscany.binding.axis2.externalservice.Axis2ServiceInvoker; +import org.apache.tuscany.binding.axis2.util.SDODataBinding; +import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator; +import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData; +import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.extension.ExternalServiceBuilderSupport; +import org.apache.tuscany.core.extension.ExternalServiceContextFactory; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.model.assembly.ExternalService; +import org.osoa.sca.annotations.Scope; + +import commonj.sdo.helper.TypeHelper; + +/** + * Creates a ContextFactory for an external service configured with the {@link WebServiceBinding} + */ +@Scope("MODULE") +public class ExternalWebServiceBuilder extends ExternalServiceBuilderSupport { + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.core.extension.ExternalServiceBuilderSupport#createExternalServiceContextFactory(org.apache.tuscany.model.assembly.ExternalService) + */ + @Override + protected ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService) { + + WebServiceBinding wsBinding = (WebServiceBinding) externalService.getBindings().get(0); + Definition wsdlDefinition = wsBinding.getWSDLDefinition(); + WebServicePortMetaData wsPortMetaData = new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(), false); + + ServiceClient serviceClient = createServiceClient(externalService.getName(), wsdlDefinition, wsPortMetaData); + + TypeHelper typeHelper = wsBinding.getTypeHelper(); + ClassLoader cl = wsBinding.getResourceLoader().getClassLoader(); + Class serviceInterface = externalService.getConfiguredService().getPort().getServiceContract().getInterface(); + Map invokers = createOperationInvokers(serviceInterface, typeHelper, cl, wsPortMetaData); + + Axis2ServiceInvoker axis2Client = new Axis2ServiceInvoker(serviceClient, invokers); + + return new WSExternalServiceContextFactory(externalService.getName(), new SingletonObjectFactory(axis2Client)); + + } + + /** + * Create an Axis2 ServiceClient configured for the externalService + */ + protected ServiceClient createServiceClient(String externalServiceName, Definition wsdlDefinition, WebServicePortMetaData wsPortMetaData) { + + TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator(null, null); + ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext(); + + QName serviceQName = wsPortMetaData.getServiceName(); + String portName = wsPortMetaData.getPortName().getLocalPart(); + + ServiceClient serviceClient; + try { + + AxisService axisService = AxisService.createClientSideAxisService(wsdlDefinition, serviceQName, portName, new Options()); + serviceClient = new ServiceClient(configurationContext, axisService); + + } catch (AxisFault e) { + BuilderConfigException bce = new BuilderConfigException("AxisFault creating external service", e); + bce.addContextName(externalServiceName); + throw bce; + } + + return serviceClient; + } + + /** + * Create and configure an Axis2OperationInvoker for each operation in the externalService + */ + protected Map createOperationInvokers(Class sc, TypeHelper typeHelper, ClassLoader cl, WebServicePortMetaData wsPortMetaData) { + SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory(); + String portTypeNS = wsPortMetaData.getPortTypeName().getNamespaceURI(); + Map invokers = new HashMap(); + + for (Method m : sc.getMethods()) { + String methodName = m.getName(); + + WebServiceOperationMetaData operationMetaData = wsPortMetaData.getOperationMetaData(methodName); + boolean isWrapped = operationMetaData.isDocLitWrapped(); + List sig = operationMetaData.getOperationSignature(); + SDODataBinding dataBinding = new SDODataBinding(cl, typeHelper, sig.size() > 0 ? (QName) sig.get(0) : null, isWrapped); + + Options options = new Options(); + options.setTo(new EndpointReference(wsPortMetaData.getEndpoint())); + options.setProperty(MessageContextConstants.CHUNKED, Boolean.FALSE); + + String wsdlOperationName = operationMetaData.getBindingOperation().getOperation().getName(); + + String soapAction = wsPortMetaData.getOperationMetaData(wsdlOperationName).getSOAPAction(); + if (soapAction != null && soapAction.length() > 1) { + options.setAction(soapAction); + } + + QName wsdlOperationQName = new QName(portTypeNS, wsdlOperationName); + Axis2OperationInvoker invoker = new Axis2OperationInvoker(wsdlOperationQName, options, dataBinding, soapFactory); + + invokers.put(methodName, invoker); + } + + return invokers; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java new file mode 100644 index 0000000000..be526a2a9a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceWireBuilder.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.builder; + +import java.lang.reflect.Method; + +import org.apache.tuscany.binding.axis2.config.WSExternalServiceContextFactory; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.extension.ExternalServiceTargetInvoker; +import org.apache.tuscany.core.extension.WireBuilderSupport; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.osoa.sca.annotations.Scope; + +@Scope("MODULE") +public class ExternalWebServiceWireBuilder extends WireBuilderSupport { + + @Override + protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) { + return new ExternalServiceTargetInvoker(targetName, operation, context); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java new file mode 100644 index 0000000000..de0d54f505 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/builder/WebServiceEntryPointBuilder.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.builder; + +import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; +import org.apache.tuscany.binding.axis2.config.WSEntryPointContextFactory; +import org.apache.tuscany.core.extension.EntryPointBuilderSupport; +import org.apache.tuscany.core.extension.EntryPointContextFactory; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.webapp.ServletHost; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.osoa.sca.annotations.Scope; + +/** + * Creates a ContextFactory for an entry point configured with the {@link WebServiceBinding} + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class WebServiceEntryPointBuilder extends EntryPointBuilderSupport { + + private ServletHost tomcatHost; + + @Autowire + public void setTomcatHost(ServletHost tomcatHost) { + this.tomcatHost = tomcatHost; + } + + protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) { + WebServiceBinding wsBinding = (WebServiceBinding) entryPoint.getBindings().get(0); + return new WSEntryPointContextFactory(entryPoint.getName(), messageFactory, tomcatHost, wsBinding); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSEntryPointContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSEntryPointContextFactory.java new file mode 100644 index 0000000000..9e836b43e5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSEntryPointContextFactory.java @@ -0,0 +1,276 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.config; + +import java.io.InputStream; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Enumeration; +import java.util.Set; +import java.util.Vector; + +import javax.servlet.RequestDispatcher; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.wsdl.Definition; +import javax.wsdl.Operation; +import javax.wsdl.PortType; +import javax.xml.namespace.QName; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.description.AxisOperation; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.WSDL2AxisServiceBuilder; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; +import org.apache.tuscany.binding.axis2.entrypoint.WebServiceEntryPointInOutSyncMessageReceiver; +import org.apache.tuscany.binding.axis2.entrypoint.WebServiceEntryPointServlet; +import org.apache.tuscany.binding.axis2.util.SDODataBinding; +import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData; +import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.extension.EntryPointContextFactory; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.webapp.ServletHost; + +import commonj.sdo.helper.TypeHelper; + +/** + * Creates instances of {@link org.apache.tuscany.core.context.EntryPointContext} configured with the appropriate wire chains and bindings. This + * implementation serves as a marker for + * + * @version $Rev$ $Date$ + */ +public class WSEntryPointContextFactory extends EntryPointContextFactory { + + private ServletHost tomcatHost; + + private WebServiceBinding wsBinding; + + public WSEntryPointContextFactory(String name, MessageFactory messageFactory, ServletHost tomcatHost, WebServiceBinding wsBinding) { + super(name, messageFactory); + this.tomcatHost = tomcatHost; + this.wsBinding = wsBinding; + } + + public EntryPointContext createContext() throws ContextCreationException { + EntryPointContext epc = super.createContext(); + initServlet(epc); + return epc; + } + + private void initServlet(EntryPointContext epc) { + AxisService axisService; + try { + axisService = createAxisService(epc, wsBinding); + } catch (AxisFault e) { + throw new BuilderConfigException(e); + } + WebServiceEntryPointServlet servlet = new WebServiceEntryPointServlet(axisService); + ServletConfig sc = createDummyServletConfig(); + try { + servlet.init(sc ); + } catch (ServletException e) { + throw new BuilderConfigException(e); + } + + String servletMapping = wsBinding.getWebAppName() + "/services/" + epc.getName(); + tomcatHost.registerMapping(servletMapping, servlet); + } + + private ServletConfig createDummyServletConfig() { + ServletConfig sc = new ServletConfig() { + + public String getServletName() { + return "TuscanyWSServlet"; + } + + public ServletContext getServletContext() { + return new ServletContext() { + + public ServletContext getContext(String arg0) { + return null; + } + + public int getMajorVersion() { + return 0; + } + + public int getMinorVersion() { + return 0; + } + + public String getMimeType(String arg0) { + return null; + } + + public Set getResourcePaths(String arg0) { + return null; + } + + public URL getResource(String arg0) throws MalformedURLException { + return null; + } + + public InputStream getResourceAsStream(String arg0) { + return null; + } + + public RequestDispatcher getRequestDispatcher(String arg0) { + return null; + } + + public RequestDispatcher getNamedDispatcher(String arg0) { + return null; + } + + public Servlet getServlet(String arg0) throws ServletException { + return null; + } + + public Enumeration getServlets() { + return null; + } + + public Enumeration getServletNames() { + return null; + } + + public void log(String arg0) { + } + + public void log(Exception arg0, String arg1) { + } + + public void log(String arg0, Throwable arg1) { + } + + public String getRealPath(String arg0) { + return null; + } + + public String getServerInfo() { + return null; + } + + public String getInitParameter(String arg0) { + return null; + } + + public Enumeration getInitParameterNames() { + return null; + } + + public Object getAttribute(String arg0) { + return null; + } + + public Enumeration getAttributeNames() { + return null; + } + + public void setAttribute(String arg0, Object arg1) { + } + + public void removeAttribute(String arg0) { + } + + public String getServletContextName() { + return null; + }}; + } + + public String getInitParameter(String arg0) { + return null; + } + + public Enumeration getInitParameterNames() { + return new Vector().elements(); + }}; + return sc; + } + + private AxisService createAxisService(EntryPointContext entryPointContext, WebServiceBinding wsBinding) throws AxisFault { + + String entryPointName = entryPointContext.getName(); + + Definition definition = wsBinding.getWSDLDefinition(); + WebServicePortMetaData wsdlPortInfo = new WebServicePortMetaData(definition, wsBinding.getWSDLPort(), null, false); + + // AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig); + // serviceGroup.setServiceGroupName(wsdlPortInfo.getServiceName().getLocalPart()); + // axisConfig.addServiceGroup(serviceGroup); + + WSDL2AxisServiceBuilder builder = new WSDL2AxisServiceBuilder(definition, wsdlPortInfo.getServiceName(), wsdlPortInfo.getPort().getName()); + builder.setServerSide(true); + AxisService axisService = builder.populateService(); + + axisService.setName(entryPointName); + // axisService.setParent(serviceGroup); + axisService.setServiceDescription("Tuscany configured AxisService for EntryPoint: '" + entryPointName + '\''); + + TypeHelper typeHelper = wsBinding.getTypeHelper(); + ClassLoader cl = wsBinding.getResourceLoader().getClassLoader(); + + Class serviceInterface = entryPointContext.getServiceInterface(); + + PortType wsdlPortType = wsdlPortInfo.getPortType(); + for (Object o : wsdlPortType.getOperations()) { + Operation wsdlOperation = (Operation) o; + String operationName = wsdlOperation.getName(); + QName operationQN = new QName(definition.getTargetNamespace(), operationName); + Object entryPointProxy = entryPointContext.getInstance(null); + + WebServiceOperationMetaData omd = wsdlPortInfo.getOperationMetaData(operationName); + QName responseTypeQN = omd.getOutputPart(0).getElementName(); + + Method operationMethod = getMethod(serviceInterface, operationName); + SDODataBinding dataBinding = new SDODataBinding(cl, typeHelper, responseTypeQN, omd.isDocLitWrapped()); + WebServiceEntryPointInOutSyncMessageReceiver msgrec = new WebServiceEntryPointInOutSyncMessageReceiver(entryPointProxy, operationMethod, + dataBinding, cl); + + AxisOperation axisOp = axisService.getOperation(operationQN); + axisOp.setMessageExchangePattern(WSDLConstants.MEP_URI_IN_OUT); + axisOp.setMessageReceiver(msgrec); + } + + return axisService; + } + + protected Method getMethod(Class serviceInterface, String operationName) { + // Note: this doesn't support overloaded operations + Method[] methods = serviceInterface.getMethods(); + for (Method m : methods) { + if (m.getName().equals(operationName)) { + return m; + } + // tolerate WSDL with capatalized operation name + StringBuilder sb = new StringBuilder(operationName); + sb.setCharAt(0, Character.toLowerCase(sb.charAt(0))); + if (m.getName().equals(sb.toString())) { + return m; + } + } + throw new BuilderConfigException("no operation named " + operationName + " found on service interface: " + serviceInterface.getName()); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSExternalServiceContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSExternalServiceContextFactory.java new file mode 100644 index 0000000000..0a2e308587 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/config/WSExternalServiceContextFactory.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.config; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.extension.ExternalServiceContextFactory; + +/** + * Creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} configured with the appropriate wire chains and bindings. This + * implementation serves as a marker for {@link org.apache.tuscany.binding.axis2.builder.ExternalWebServiceWireBuilder} + * + * @version $Rev$ $Date$ + */ +public class WSExternalServiceContextFactory extends ExternalServiceContextFactory { + + public WSExternalServiceContextFactory(String name, ObjectFactory objectFactory) { + super(name, objectFactory); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointInOutSyncMessageReceiver.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointInOutSyncMessageReceiver.java new file mode 100644 index 0000000000..bb9f0e307a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointInOutSyncMessageReceiver.java @@ -0,0 +1,101 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.entrypoint; + +import java.lang.reflect.Method; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver; +import org.apache.tuscany.binding.axis2.util.SDODataBinding; +import org.apache.tuscany.core.wire.InvocationRuntimeException; + +public class WebServiceEntryPointInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver { + + private Object entryPointProxy; + + protected Method operationMethod; + + protected SDODataBinding dataBinding; + + protected ClassLoader classLoader; + + public WebServiceEntryPointInOutSyncMessageReceiver(Object entryPointProxy, Method operationMethod, SDODataBinding dataBinding, ClassLoader classLoader) { + this.entryPointProxy = entryPointProxy; + this.operationMethod = operationMethod; + this.dataBinding = dataBinding; + this.classLoader = classLoader; + } + + @Override + public void invokeBusinessLogic(MessageContext inMC, MessageContext outMC) throws AxisFault { + try { + + OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement(); + Object[] request; + if (requestOM != null) { + request = dataBinding.fromOMElement(requestOM); + } else { + request = new Object[0]; + } + + Object response; + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(classLoader); + } + + response = operationMethod.invoke(entryPointProxy, request); + + } finally { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(tccl); + } + } + + SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope(); + + OMElement responseOM = null; + if (response != null) { + responseOM = dataBinding.toOMElement(new Object[] { response }); + soapEnvelope.getBody().addChild(responseOM); + } + + outMC.setEnvelope(soapEnvelope); + outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE); + + } catch (InvocationRuntimeException e) { + // throw new InvocationRuntimeException(e); + Throwable t = e.getCause(); + if(t instanceof Exception) { + + throw AxisFault.makeFault((Exception)t); + + } + throw e; + + + } catch (Exception e) { + throw AxisFault.makeFault(e); + } + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java new file mode 100644 index 0000000000..4e6173b671 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/entrypoint/WebServiceEntryPointServlet.java @@ -0,0 +1,113 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tuscany.binding.axis2.entrypoint; + +import java.io.IOException; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.axis2.description.AxisService; +import org.apache.axis2.transport.http.AxisServlet; + +/** + * @version $Rev: 383148 $ $Date: 2006-03-04 08:07:17 -0800 (Sat, 04 Mar 2006) $ + */ +public class WebServiceEntryPointServlet extends AxisServlet { + + private static final long serialVersionUID = 1L; + + private AxisService axisService; + + public WebServiceEntryPointServlet(AxisService axisService) { + this.axisService = axisService; + } + + public void init(final ServletConfig config) throws ServletException { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + ClassLoader scl = this.getClass().getClassLoader(); + try { + if (tccl != scl) { + Thread.currentThread().setContextClassLoader(scl); + } + + try { + + super.init(config); + + configContext.getAxisConfiguration().addService(axisService); + + } catch (Exception e) { + throw new ServletException(e); + } + + } finally { + if (tccl != scl) { + Thread.currentThread().setContextClassLoader(tccl); + } + } + } + + @Override + protected void doGet(final HttpServletRequest arg0, final HttpServletResponse arg1) throws ServletException, IOException { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + ClassLoader scl = this.getClass().getClassLoader(); + try { + if (tccl != scl) { + Thread.currentThread().setContextClassLoader(scl); + } + + try { + super.doGet(arg0, arg1); + } catch (Exception e) { + e.printStackTrace(); + throw new ServletException(e); + } + + } finally { + if (tccl != scl) { + Thread.currentThread().setContextClassLoader(tccl); + } + } + } + + @Override + protected void doPost(final HttpServletRequest arg0, final HttpServletResponse arg1) throws ServletException, IOException { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + ClassLoader scl = this.getClass().getClassLoader(); + try { + if (tccl != scl) { + Thread.currentThread().setContextClassLoader(scl); + } + + try { + super.doPost(arg0, arg1); + } catch (Exception e) { + e.printStackTrace(); + throw new ServletException(e); + } + + } finally { + if (tccl != scl) { + Thread.currentThread().setContextClassLoader(tccl); + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2OperationInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2OperationInvoker.java new file mode 100644 index 0000000000..32767012df --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2OperationInvoker.java @@ -0,0 +1,114 @@ +/** + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.externalservice; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axiom.soap.SOAPFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.Options; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.tuscany.binding.axis2.util.SDODataBinding; + +/** + * Axis2OperationInvoker uses an Axis2 OperationClient to invoke a remote web service + */ +public class Axis2OperationInvoker { + + public QName wsdlOperationName; + + public Options options; + + public SDODataBinding dataBinding; + + private SOAPFactory soapFactory; + + public Axis2OperationInvoker(QName wsdlOperationName, Options options, SDODataBinding dataBinding, SOAPFactory soapFactory) { + this.wsdlOperationName = wsdlOperationName; + this.options = options; + this.dataBinding = dataBinding; + this.soapFactory = soapFactory; + } + + /** + * Invoke a WS operation + * + * @param operationClient + * @param args + * @return + * @throws AxisFault + */ + protected Object invokeOperation(OperationClient operationClient, Object[] args) throws AxisFault { + + operationClient.setOptions(options); + + SOAPEnvelope env = soapFactory.getDefaultEnvelope(); + + if (args != null && args.length > 0) { + OMElement requestOM = dataBinding.toOMElement(args); + env.getBody().addChild(requestOM); + } + + MessageContext requestMC = new MessageContext(); + requestMC.setEnvelope(env); + + operationClient.addMessageContext(requestMC); + + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + ClassLoader scl = this.getClass().getClassLoader(); + try { + if (tccl != scl) { + Thread.currentThread().setContextClassLoader(scl); + } + + operationClient.execute(true); + + } finally { + if (tccl != scl) { + Thread.currentThread().setContextClassLoader(tccl); + } + } + + MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); + OMElement responseOM = responseMC.getEnvelope().getBody().getFirstElement(); + + Object[] os = null; + if (responseOM != null) { + os = dataBinding.fromOMElement(responseOM); + } + + Object response; + if (os == null || os.length < 1) { + response = null; + } else { + response = os[0]; + } + + return response; + } + + /** + * Get the WSDL operation name that this can invoke + */ + public QName getWSDLOperationName() { + return wsdlOperationName; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2ServiceInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2ServiceInvoker.java new file mode 100644 index 0000000000..38b9e40d2e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/externalservice/Axis2ServiceInvoker.java @@ -0,0 +1,60 @@ +/** + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.externalservice; + +import java.util.Map; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.ServiceClient; +import org.apache.tuscany.core.extension.ExternalServiceInvoker; +import org.osoa.sca.ServiceRuntimeException; + +/** + * Axis2ServiceInvoker uses Axis2 to invoke a remote web service + */ +public class Axis2ServiceInvoker implements ExternalServiceInvoker { + + private ServiceClient serviceClient; + + private Map operationInvokers; + + public Axis2ServiceInvoker(ServiceClient serviceClient, Map operationInvokers) { + this.serviceClient = serviceClient; + this.operationInvokers = operationInvokers; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.binding.axis2.handler.ExternalServiceInvoker#invoke(java.lang.String, java.lang.Object[]) + */ + public Object invoke(String methodName, Object[] args) { + try { + + Axis2OperationInvoker invoker = operationInvokers.get(methodName); + + // Axis2 operationClients can not be shared so create a new one for each request + OperationClient operationClient = serviceClient.createClient(invoker.getWSDLOperationName()); + + return invoker.invokeOperation(operationClient, args); + + } catch (AxisFault e) { + throw new ServiceRuntimeException(e); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceBindingLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceBindingLoader.java new file mode 100644 index 0000000000..b4a67d1ab2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceBindingLoader.java @@ -0,0 +1,72 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.loader; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.binding.axis2.assembly.WebServiceAssemblyFactory; +import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; +import org.apache.tuscany.binding.axis2.assembly.impl.WebServiceAssemblyFactoryImpl; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.StAXElementLoader; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class WebServiceBindingLoader implements StAXElementLoader { + public static final QName BINDING_WS = new QName("http://www.osoa.org/xmlns/sca/0.9", "binding.ws"); + + private static final WebServiceAssemblyFactory WS_FACTORY = new WebServiceAssemblyFactoryImpl(); + + protected StAXLoaderRegistry registry; + + @Autowire + public void setRegistry(StAXLoaderRegistry registry) { + this.registry = registry; + } + + @Init(eager = true) + public void start() { + registry.registerLoader(BINDING_WS, this); + } + + @Destroy + public void stop() { + registry.unregisterLoader(BINDING_WS, this); + } + + @SuppressWarnings("deprecation") + public WebServiceBinding load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + + WebServiceBinding binding = WS_FACTORY.createWebServiceBinding(); + binding.setURI(reader.getAttributeValue(null, "uri")); + binding.setPortURI(reader.getAttributeValue(null, "port")); + binding.setTypeHelper(registry.getContext().getTypeHelper()); + binding.setWebAppName(registry.getContext().getWebAppName()); + binding.setResourceLoader(loaderContext.getResourceLoader()); + return binding; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java new file mode 100644 index 0000000000..0caf2293d6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java @@ -0,0 +1,104 @@ +/** + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import javax.xml.namespace.QName; +import javax.xml.stream.FactoryConfigurationError; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMXMLParserWrapper; +import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory; +import org.apache.tuscany.core.wire.InvocationRuntimeException; +import org.apache.tuscany.databinding.sdo.SDOXMLHelper; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.osoa.sca.ServiceRuntimeException; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLHelper; + +/** + * DataBinding for converting between AXIOM OMElement and Java Objects + */ +public class SDODataBinding { + + private ClassLoader classLoader; + + private TypeHelper typeHelper; + + private QName elementQName; + + private boolean isWrapped; + + public SDODataBinding(ClassLoader classLoader, TypeHelper typeHelper, QName elementQName, boolean isWrapped) { + this.classLoader = classLoader; + this.typeHelper = typeHelper; + this.elementQName = elementQName; + this.isWrapped = isWrapped; + } + + public Object[] fromOMElement(OMElement omElement) { + try { + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + omElement.serialize(baos); + + baos.flush(); + baos.close(); + + return SDOXMLHelper.toObjects(classLoader,typeHelper, baos.toByteArray(), isWrapped); + + } catch (IOException e) { + throw new InvocationRuntimeException(e); + } catch (XMLStreamException e) { + throw new InvocationRuntimeException(e); + } + } + + public OMElement toOMElement(Object[] os) { + try { + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + DataObject dataObject = SDOXMLHelper.toDataObject(classLoader, typeHelper, os, elementQName, isWrapped); + XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper); + xmlHelper.save(dataObject, elementQName.getNamespaceURI(), elementQName.getLocalPart(), baos); + baos.close(); + + XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())); + OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), xsr); + OMElement omElement = builder.getDocumentElement(); + + return omElement; + + } catch (IOException e) { + throw new ServiceRuntimeException(e); + } catch (XMLStreamException e) { + throw new ServiceRuntimeException(e); + } catch (FactoryConfigurationError e) { + throw new ServiceRuntimeException(e); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java new file mode 100644 index 0000000000..a5795d076e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/TuscanyAxisConfigurator.java @@ -0,0 +1,88 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.util; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.deployment.AxisConfigBuilder; +import org.apache.axis2.deployment.DeploymentEngine; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.engine.AxisConfigurator; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; +import org.osoa.sca.ServiceRuntimeException; + +/** + * Helps configure Axis2 from a resource in binding.axis2 instead of Axis2.xml + * + * TODO: Review: should there be a single global Axis ConfigurationContext + */ +public class TuscanyAxisConfigurator implements AxisConfigurator { + + protected AxisConfiguration axisConfiguration; + + protected final ResourceLoader resourceLoader; + + /** + * @param resourceLoader + * desired resource loader if null use thread context. + * @param axisConfiguration + * Starting axis configuration, null then use uninitialized configuration. + */ + public TuscanyAxisConfigurator(ResourceLoader resourceLoader, AxisConfiguration axisConfiguration) { + this.resourceLoader = resourceLoader != null ? resourceLoader : new ResourceLoaderImpl(getClass().getClassLoader()); + this.axisConfiguration = axisConfiguration == null ? new AxisConfiguration() : axisConfiguration; + } + + public AxisConfiguration getAxisConfiguration() { + + return axisConfiguration; + } + + public ConfigurationContext getConfigurationContext() throws ServiceRuntimeException { + + try { + URL url = resourceLoader.getResource("org/apache/tuscany/binding/axis2/engine/config/axis2.xml"); + + InputStream serviceInputStream = url.openStream(); + AxisConfigBuilder axisConfigBuilder = new AxisConfigBuilder(serviceInputStream, new DeploymentEngine(), axisConfiguration); + axisConfigBuilder.populateConfig(); + serviceInputStream.close(); + return ConfigurationContextFactory.createConfigurationContext(this); + } catch (IOException e) { + + throw new ServiceRuntimeException(e); + } + + } + + public void loadServices() { + // TODO Auto-generated method stub + + } + + public void engageGlobalModules() throws AxisFault { + // TODO Auto-generated method stub + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java new file mode 100644 index 0000000000..1ebca5d3fc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServiceOperationMetaData.java @@ -0,0 +1,499 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.wsdl.Binding; +import javax.wsdl.BindingInput; +import javax.wsdl.BindingOperation; +import javax.wsdl.BindingOutput; +import javax.wsdl.Input; +import javax.wsdl.Message; +import javax.wsdl.Operation; +import javax.wsdl.Output; +import javax.wsdl.Part; +import javax.wsdl.extensions.soap.SOAPBinding; +import javax.wsdl.extensions.soap.SOAPHeader; +import javax.wsdl.extensions.soap.SOAPOperation; +import javax.xml.namespace.QName; + +/** + * Metadata for a WSDL operation + * + */ +public class WebServiceOperationMetaData { + // WSDL Binding and BindingOperation + private Binding binding; + + private BindingOperation bindingOperation; + + // Fields to cache derived metadata + private transient Set inputHeaderParts; + + private transient Set outputHeaderParts; + + private transient String style; + + private transient String use; + + private transient String soapAction; + + private transient List signature; + + private String encoding; + + private transient QName rpcOperationName; + + public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation) { + this.binding = binding; + this.bindingOperation = bindingOperation; + } + + public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation, String style, String use, String encoding, + String soapAction) { + this.binding = binding; + this.bindingOperation = bindingOperation; + this.style = style; + this.use = use; + this.encoding = encoding; + this.soapAction = soapAction; + } + + public Set getInputHeaderParts() { + if (inputHeaderParts == null) { + // Build a set of header parts that we need to exclude + inputHeaderParts = new HashSet(); + BindingInput bindingInput = bindingOperation.getBindingInput(); + + if (bindingInput != null) { + Operation operation = bindingOperation.getOperation(); + javax.wsdl.Message message = operation.getInput().getMessage(); + List elements = bindingInput.getExtensibilityElements(); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object extensibilityElement = i.next(); + Part part = getPartFromSOAPHeader(message, extensibilityElement); + if (part != null) { + inputHeaderParts.add(part); + } + } + } + } + return inputHeaderParts; + } + + public Set getOutputHeaderParts() { + if (outputHeaderParts == null) { + // Build a set of header parts that we need to exclude + outputHeaderParts = new HashSet(); + BindingOutput bindingOutput = bindingOperation.getBindingOutput(); + + if (bindingOutput != null) { + Operation operation = bindingOperation.getOperation(); + javax.wsdl.Message message = operation.getOutput().getMessage(); + List elements = bindingOutput.getExtensibilityElements(); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object extensibilityElement = i.next(); + Part part = getPartFromSOAPHeader(message, extensibilityElement); + if (part != null) { + outputHeaderParts.add(part); + } + } + } + } + return outputHeaderParts; + } + + private Part getPartFromSOAPHeader(Message message, Object extensibilityElement) { + Part part = null; + if (extensibilityElement instanceof SOAPHeader) { + SOAPHeader soapHeader = (SOAPHeader) extensibilityElement; + QName msgName = soapHeader.getMessage(); + if (message.getQName().equals(msgName)) { + part = message.getPart(soapHeader.getPart()); + } + } else if (extensibilityElement instanceof SOAPHeader) { + SOAPHeader soapHeader = (SOAPHeader) extensibilityElement; + QName msgName = soapHeader.getMessage(); + if (message.getQName().equals(msgName)) { + part = message.getPart(soapHeader.getPart()); + } + } + return part; + } + + public String getStyle() { + if (style == null) { + SOAPOperation soapOperation = (SOAPOperation) WebServicePortMetaData.getExtensibilityElement(bindingOperation.getExtensibilityElements(), + SOAPOperation.class); + if (soapOperation != null) { + style = soapOperation.getStyle(); + } + if (style == null) { + SOAPBinding soapBinding = WebServicePortMetaData.getExtensibilityElement(binding.getExtensibilityElements(), SOAPBinding.class); + if (soapBinding != null) { + style = soapBinding.getStyle(); + } + } + if (style == null) { + style = "document"; + } + } + return style; + } + + /** + * Returns the SOAP action for the given operation. + * + * @param wsdlBindingOperation + * @return + */ + public String getSOAPAction() { + if (soapAction == null) { + final List wsdlBindingOperationExtensions = bindingOperation.getExtensibilityElements(); + final SOAPOperation soapOp = WebServicePortMetaData.getExtensibilityElement(wsdlBindingOperationExtensions, SOAPOperation.class); + if (soapOp != null) { + soapAction = soapOp.getSoapActionURI(); + } + } + return soapAction; + } + + public QName getRPCOperationName() { + if (rpcOperationName == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + String ns = (soapBody != null) ? soapBody.getNamespaceURI() : binding.getPortType().getQName().getNamespaceURI(); + String name = bindingOperation.getOperation().getName(); + rpcOperationName = new QName(ns, name); + } + return rpcOperationName; + } + + private List getSOAPBodyParts(boolean input) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(input); + if (soapBody != null) { + List parts = soapBody.getParts(); + if (parts != null) { + List names = new ArrayList(); + for (Iterator i = parts.iterator(); i.hasNext();) { + Object part = i.next(); + if (part instanceof String) { + names.add((String) part); + } else if (part instanceof Part) { + names.add(((Part) part).getName()); + } + } + return names; + } else { + return null; + } + } else { + return null; + } + } + + private javax.wsdl.extensions.soap.SOAPBody getSOAPBody(boolean input) { + List elements = null; + if (input) { + BindingInput bindingInput = bindingOperation.getBindingInput(); + if (bindingInput == null) { + return null; + } + elements = bindingInput.getExtensibilityElements(); + } else { + BindingOutput bindingOutput = bindingOperation.getBindingOutput(); + if (bindingOutput == null) { + return null; + } + elements = bindingOutput.getExtensibilityElements(); + } + javax.wsdl.extensions.soap.SOAPBody soapBody = WebServicePortMetaData.getExtensibilityElement(elements, + javax.wsdl.extensions.soap.SOAPBody.class); + return soapBody; + } + + /** + * Returns the use attribute + * + * @param wsdlOperation + * @return + */ + public String getUse() { + if (use == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + if (soapBody != null) { + use = soapBody.getUse(); + } + if (use == null) { + use = "literal"; + } + } + return use; + } + + @SuppressWarnings("unchecked") + public String getEncoding() { + if (encoding == null) { + javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true); + if (soapBody != null) { + List styles = (List) soapBody.getEncodingStyles(); + if (styles != null && !styles.isEmpty()) { + encoding = styles.get(0); + } + } + if (encoding == null) { + encoding = ""; + } + } + return encoding; + } + + public boolean isDocLitWrapped() { + boolean flag = getStyle().equals("document") && getUse().equals("literal"); + if (!flag) { + return false; + } + Message msg = getMessage(true); + if (msg == null) { + return false; + } + List parts = msg.getOrderedParts(null); + if (parts.size() != 1) { + return false; + } + Part part = (Part) parts.get(0); + QName element = part.getElementName(); + if (element == null) { + return false; + } + return element.getLocalPart().equals(bindingOperation.getOperation().getName()); + } + + /* + * public SOAPMediator createMediator(boolean serverMode) throws SOAPException { // create a new mediator for each invoke for thread-safety + * boolean rpcStyle = getStyle().equals("rpc"); boolean rpcEncoded = isEncoded(); + * + * SOAPMediator mediator = null; + * + * if (!rpcStyle) { // Document mediator = new SOAPDocumentLiteralMediatorImpl(this, serverMode); } else { if (!rpcEncoded) mediator = new + * SOAPRPCLiteralMediatorImpl(this, serverMode); // RPC-literal else mediator = new SOAPRPCEncodedMediatorImpl(this, serverMode); // RPC-encoded } + * return mediator; } + */ + + /** + * Get the operation signature from the WSDL operation + * + * @param wsdlBinding + * @param bindingOperation + * @return + */ + public List getOperationSignature() { + if (signature == null) { + signature = new ArrayList(); + + Operation operation = bindingOperation.getOperation(); + if (operation == null) { + return signature; + } + + final Input input = operation.getInput(); + if (input == null) { + return signature; + } + + String sstyle = getStyle(); + + if ("rpc".equals(sstyle)) { + Collection partNames = input.getMessage().getParts().values(); + for (Iterator i = partNames.iterator(); i.hasNext();) { + Part part = (Part) i.next(); + signature.add(part.getName()); + } + } else { + /* + * WS-I Basic Profile 1.1 4.7.6 Operation Signatures Definition: operation signature + * + * The profile defines the "operation signature" to be the fully qualified name of the child element of SOAP body of the SOAP input + * message described by an operation in a WSDL binding. + * + * In the case of rpc-literal binding, the operation name is used as a wrapper for the part accessors. In the document-literal case, + * since a wrapper with the operation name is not present, the message signatures must be correctly designed so that they meet this + * requirement. + * + * An endpoint that supports multiple operations must unambiguously identify the operation being invoked based on the input message + * that it receives. This is only possible if all the operations specified in the wsdl:binding associated with an endpoint have a + * unique operation signature. + * + * R2710 The operations in a wsdl:binding in a DESCRIPTION MUST result in operation signatures that are different from one another. + */ + List bodyParts = getSOAPBodyParts(true); + + Collection parts = input.getMessage().getParts().values(); + // Exclude the parts to be transmitted in SOAP header + if (bodyParts == null) { + parts.removeAll(getInputHeaderParts()); + } + for (Iterator i = parts.iterator(); i.hasNext();) { + Part part = (Part) i.next(); + if (bodyParts == null) { + // All parts + QName elementName = part.getElementName(); + if (elementName == null) { + elementName = new QName("", part.getName()); + // TODO: [rfeng] throw new + // ServiceRuntimeException("Message part for + // document style must refer to an XSD element + // using a QName: " + part); + } + signature.add(elementName); + } else { + // "parts" in soap:body + if (bodyParts.contains(part.getName())) { + QName elementName = part.getElementName(); + if (elementName == null) { + elementName = new QName("", part.getName()); + // TODO: [rfeng] throw new + // ServiceRuntimeException("Message part for + // document style must refer to an XSD + // element using a QName: " + part); + } + signature.add(elementName); + } + + } + } + } + } + return signature; + } + + public Message getMessage(boolean isInput) { + Operation operation = bindingOperation.getOperation(); + if (operation == null) { + return null; + } + + if (isInput) { + final Input input = operation.getInput(); + return input == null ? null : input.getMessage(); + } else { + final Output output = operation.getOutput(); + return output == null ? null : output.getMessage(); + } + } + + public Part getInputPart(int index) { + Part part = null; + Message message = getMessage(true); + if (message == null) { + return part; + } + + List parts = message.getOrderedParts(null); + return (Part) parts.get(index); + + } + + public Part getOutputPart(int index) { + Part part = null; + Message message = getMessage(false); + if (message == null) { + return part; + } + + List parts = message.getOrderedParts(null); + return (Part) parts.get(index); + + } + + /** + * Get a list of indexes for each part in the SOAP body + * + * @param isInput + * TODO + * @return + */ + public List getBodyPartIndexes(boolean isInput) { + List indexes = new ArrayList(); + + Message message = getMessage(isInput); + if (message == null) { + return indexes; + } + + List bodyParts = getSOAPBodyParts(isInput); + List parts = message.getOrderedParts(null); + Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts(); + + int index = 0; + for (Iterator i = parts.iterator(); i.hasNext(); index++) { + Part part = (Part) i.next(); + if (headerParts.contains(part)) { + continue; + } + if (bodyParts == null) { + // All parts + indexes.add(index); + } else { + // "parts" in soap:body + if (bodyParts.contains(part.getName())) { + indexes.add(index); + } + } + } + return indexes; + } + + /** + * Get the corresponding index for a part in the SOAP header by element name + * + * @param elementName + * @param isInput + * TODO + * @return + */ + public int getHeaderPartIndex(QName elementName, boolean isInput) { + + Message message = getMessage(isInput); + if (message == null) { + return -1; + } + + List parts = message.getOrderedParts(null); + Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts(); + + int index = 0; + for (Iterator i = parts.iterator(); i.hasNext(); index++) { + Part part = (Part) i.next(); + // Test if the part is in header section + if (headerParts.contains(part) && elementName.equals(part.getElementName())) { + return index; + } + } + return -1; + } + + public BindingOperation getBindingOperation() { + return bindingOperation; + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java new file mode 100644 index 0000000000..694a8fbf5f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/WebServicePortMetaData.java @@ -0,0 +1,400 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import javax.wsdl.Binding; +import javax.wsdl.BindingOperation; +import javax.wsdl.Definition; +import javax.wsdl.Operation; +import javax.wsdl.Port; +import javax.wsdl.PortType; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap.SOAPBinding; +import javax.xml.namespace.QName; + +import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; + +/** + * Metadata for a WSDL port + * + */ +public class WebServicePortMetaData { + + private Service wsdlService; + + private QName wsdlServiceName; + + private Port wsdlPort; + + private Binding wsdlBinding; + + private QName wsdlPortName; + + private PortType wsdlPortType; + + private QName wsdlPortTypeName; + + private String endpoint; + + private boolean managed; + + private List allOperationMetaData; + + private WSDLServiceContract interfaceType; + + /** + * Constructor + * + * @param wsdlDefinition + * @param portName + */ + public WebServicePortMetaData(Definition wsdlDefinition, Port wsdlPort, String endpoint, boolean managed) { + + // Lookup the named port + this.wsdlPort = wsdlPort; + wsdlPortName = new QName(wsdlDefinition.getTargetNamespace(), wsdlPort.getName()); + + Collection services = wsdlDefinition.getServices().values(); + for (Object serviceObj : services) { + Service service = (Service) serviceObj; + if (service.getPorts().containsValue(wsdlPort)) { + wsdlService = service; + wsdlServiceName = service.getQName(); + break; + } + } + + // Save the binding + wsdlBinding = wsdlPort.getBinding(); + if (wsdlBinding == null) { + throw new IllegalArgumentException("WSDL binding cannot be found for " + wsdlPortName); + } + + // Save the portType + wsdlPortType = wsdlBinding.getPortType(); + if (wsdlPortType == null) { + throw new IllegalArgumentException("WSDL portType cannot be found for " + wsdlPortName); + } + wsdlPortTypeName = wsdlPortType.getQName(); + + // Save the endpoint + this.endpoint = endpoint; + + // Track if this endpoint is managed or not + this.managed = managed; + } + + /** + * Constructor + * + * @param serviceName + * @param portName + * @param portType + */ + public WebServicePortMetaData(QName serviceName, String portName, QName portTypeName, String endpoint) { + wsdlServiceName = serviceName; + wsdlPortName = new QName(serviceName.getNamespaceURI(), portName); + wsdlPortTypeName = portTypeName; + this.endpoint = endpoint; + } + + /** + * @return Returns the wsdlPort. + */ + public javax.wsdl.Port getPort() { + return wsdlPort; + } + + /** + * @return Returns the wsdlService. + */ + public QName getServiceName() { + return wsdlServiceName; + } + + /** + * @return Returns the wsdlService. + */ + public javax.wsdl.Service getService() { + return wsdlService; + } + + /** + * @return Returns the wsdlPortType. + */ + public PortType getPortType() { + return wsdlPortType; + } + + /** + * @return Returns the wsdlPortType. + */ + public QName getPortTypeName() { + return wsdlPortTypeName; + } + + /** + * @return Returns the wsdlBinding. + */ + public Binding getBinding() { + return wsdlBinding; + } + + /** + * @return Returns the wsdlPortName. + */ + public QName getPortName() { + return wsdlPortName; + } + + /** + * Returns the endpoint of a given port. + * + * @param wsdlPort + * @return + */ + public String getEndpoint() { + + // Return the specified endpoint + if (endpoint != null) { + return endpoint; + } + + // Find the target endpoint on the port + if (wsdlPort != null) { + final List wsdlPortExtensions = wsdlPort.getExtensibilityElements(); + for (Iterator i = wsdlPortExtensions.iterator(); i.hasNext();) { + final Object extension = i.next(); + if (extension instanceof SOAPAddress) { + return ((SOAPAddress) extension).getLocationURI(); + } + } + } + + return null; + } + + /** + * Returns the SOAP binding style. + * + * @return + */ + public String getStyle() { + + // Find the binding style + String style = null; + if (wsdlBinding != null) { + final List wsdlBindingExtensions = wsdlBinding.getExtensibilityElements(); + SOAPBinding soapBinding = getExtensibilityElement(wsdlBindingExtensions, SOAPBinding.class); + if (soapBinding != null) { + style = soapBinding.getStyle(); + } + } + + // Default to document + return (style == null) ? "document" : style; + } + + /** + * Returns the use attribute + * + * @return + */ + public String getUse() { + List list = getAllOperationMetaData(); + return list.get(0).getUse(); + } + + /** + * Returns the encoding attribute + * + * @return + */ + public String getEncoding() { + List list = getAllOperationMetaData(); + return list.get(0).getEncoding(); + } + + /** + * @return Returns true if this is a managed web service. + */ + public boolean isManaged() { + return managed; + } + + /** + * Returns the first extensibility element of the given type. + * + * @param elements + * @param type + * @return + */ + public static T getExtensibilityElement(List elements, Class type) { + for (Iterator i = elements.iterator(); i.hasNext();) { + Object element = i.next(); + if (type.isInstance(element)) { + return type.cast(element); + } + } + return null; + } + + /** + * Returns the extensibility elements of the given type. + * + * @param elements + * @param type + * @return + */ + public static List getExtensibilityElements(List elements, Class type) { + List result = new ArrayList(); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object element = i.next(); + if (type.isInstance(element)) { + result.add(type.cast(element)); + } + } + return result; + } + + /** + * Get the operation signature from the SOAP Body + * + * @param body + * @return A list of QNames + */ + // public static List getOperationSignature(javax.xml.soap.SOAPBody body) { + // List signature = new ArrayList(); + // for (Iterator i = body.getChildElements(); i.hasNext();) { + // Object child = i.next(); + // if (child instanceof SOAPBodyElement) { + // Name name = ((SOAPBodyElement) child).getElementName(); + // QName qname = new QName(name.getURI(), name.getLocalName(), name.getPrefix()); + // signature.add(qname); + // } + // } + // return signature; + // } + // public static List getRPCOperationSignature(javax.xml.soap.SOAPBody body) { + // List signature = new ArrayList(); + // for (Iterator i = body.getChildElements(); i.hasNext();) { + // Object child = i.next(); + // if (child instanceof SOAPBodyElement) { + // SOAPBodyElement op = ((SOAPBodyElement) child); + // for (Iterator j = op.getChildElements(); j.hasNext();) { + // Object part = i.next(); + // if (part instanceof SOAPElement) { + // SOAPElement p = (SOAPElement) part; + // signature.add(p.getLocalName()); + // } + // } + // } + // } + // return signature; + // } + // public WebServiceOperationMetaData getOperationMetaData(javax.xml.soap.SOAPBody body) { + // List s1 = getOperationSignature(body); + // // List rpcParts = getRPCOperationSignature(body); + // for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) { + // WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next(); + // + // String style = descriptor.getStyle(); + // + // if (style.equals("document")) { + // List s2 = descriptor.getOperationSignature(); + // if (s1.equals(s2)) + // return descriptor; + // } else { + // QName op1 = (QName) s1.get(0); + // QName op2 = descriptor.getRPCOperationName(); + // if (op1.equals(op2)) { + // /* + // * // FIXME: [rfeng] We don't support method overloading + // * List partNames = getOperationSignature(binding, + // * bindingOperation); if (rpcParts.equals(partNames)) + // */ + // return descriptor; + // } + // } + // } + // return null; + // } + public List getAllOperationMetaData() { + if (allOperationMetaData == null) { + allOperationMetaData = new ArrayList(); + for (Iterator it = wsdlBinding.getBindingOperations().iterator(); it.hasNext();) { + final BindingOperation bindingOperation = (BindingOperation) it.next(); + if (bindingOperation.getOperation() != null) { + allOperationMetaData.add(new WebServiceOperationMetaData(wsdlBinding, bindingOperation)); + } + } + } + return allOperationMetaData; + } + + public WebServiceOperationMetaData getOperationMetaData(String operationName) { + StringBuilder sb = new StringBuilder(operationName); + sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); + String capatalizedOpName = sb.toString(); + + for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) { + WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next(); + String opName = descriptor.getBindingOperation().getOperation().getName(); + + if (opName.equals(operationName) || opName.equals(capatalizedOpName)) { + return descriptor; + } + } + return null; + } + + /** + * Returns the WSDL service contract + * + * @return + */ + public WSDLServiceContract getInterfaceType() { + return interfaceType; + } + + /** + * Get the WSDL operation name for a Java method name + */ + public String getWSDLOperationName(String methodName) { + StringBuilder sb = new StringBuilder(methodName); + sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); + String capatalizedOpName = sb.toString(); + for (Object o : wsdlPortType.getOperations()) { + Operation operation = (Operation) o; + String wsdlOpName = operation.getName(); + if (wsdlOpName.equals(methodName)) { + return wsdlOpName; + } + if (wsdlOpName.equals(capatalizedOpName)) { + return wsdlOpName; + } + } + return null; + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml new file mode 100644 index 0000000000..3c9e2988ef --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml @@ -0,0 +1,183 @@ + + + + + + + false + false + false + + + + + admin + axis2 + + . + + 127.0.0.1 + 5555 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6060 + + + + + + + + + + + + + + + + + HTTP/1.1 + chunked + + + HTTP/1.1 + chunked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/system.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/system.fragment new file mode 100644 index 0000000000..716019992b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/main/resources/system.fragment @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java new file mode 100644 index 0000000000..0600e14f8d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account; + +import java.util.List; + +/** + * @model + */ + +public interface AccountReport { + + /** + * @model type="services.account.AccountSummary" + */ + + List getAccountSummaries(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java new file mode 100644 index 0000000000..b605d19f09 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface AccountService { + + AccountReport getAccountReport(String customerID); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java new file mode 100644 index 0000000000..cd3fcfe1f5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account; + + +import org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata.AccountDataService; +import org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.stockquote.StockQuoteService; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +public class AccountServiceImpl implements AccountService { + + @Property + private String currency = "USD"; + @Reference + private AccountDataService accountDataService; + @Reference + private StockQuoteService stockQuoteService; + + public AccountServiceImpl() { + } + + public AccountReport getAccountReport(String customerID) { + return null; + } + + + //methods to access the fields + protected StockQuoteService getStockQuoteService() { + return stockQuoteService; + } + protected AccountDataService getAccountDataService() { + return accountDataService; + } + protected String getCurrency() { + return currency; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java new file mode 100644 index 0000000000..9000e4ba19 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account; + +/** + * @model + */ + +public interface AccountSummary { + + /** + * @model + */ + String getAccountNumber(); + + void setAccountNumber(String accountNumber); + + /** + * @model + */ + String getAccountType(); + + void setAccountType(String accountType); + + /** + * @model + */ + float getBalance(); + + void setBalance(float balance); +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java new file mode 100644 index 0000000000..d2dc72e868 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata; + +public interface AccountDataService { + + CheckingAccount getCheckingAccount(String customerID); + + SavingsAccount getSavingsAccount(String customerID); + + StockAccount getStockAccount(String customerID); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..d945ee1f34 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata; + +public class AccountDataServiceImpl implements AccountDataService { + + public CheckingAccount getCheckingAccount(String customerID) { + + CheckingAccount checkingAccount = new CheckingAccount(); + checkingAccount.setAccountNumber(customerID + "_" + "CHA12345"); + checkingAccount.setBalance(1500.0f); + + return checkingAccount; + } + + public SavingsAccount getSavingsAccount(String customerID) { + + SavingsAccount savingsAccount = new SavingsAccount(); + savingsAccount.setAccountNumber(customerID + "_" + "SAA12345"); + savingsAccount.setBalance(1500.0f); + + return savingsAccount; + } + + public StockAccount getStockAccount(String customerID) { + + StockAccount stockAccount = new StockAccount(); + stockAccount.setAccountNumber(customerID + "_" + "STA12345"); + stockAccount.setSymbol("IBM"); + stockAccount.setQuantity(100); + + return stockAccount; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java new file mode 100644 index 0000000000..6b75194b98 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata; + +public class CheckingAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java new file mode 100644 index 0000000000..a37b504829 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata; + +public class SavingsAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/StockAccount.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/StockAccount.java new file mode 100644 index 0000000000..2a5ac5f4a3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/StockAccount.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata; + +public class StockAccount { + + private String accountNumber; + private String symbol; + private int quantity; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..021b19d14d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.stockquote; + +public interface StockQuoteService { + + float getQuote(String symbol); +} + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilderTestCase.java new file mode 100644 index 0000000000..d040b87b86 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/builder/ExternalWebServiceBuilderTestCase.java @@ -0,0 +1,379 @@ +/** + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.builder; + +import java.net.URL; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding; +import org.apache.tuscany.binding.axis2.externalservice.Axis2OperationInvoker; +import org.apache.tuscany.binding.axis2.externalservice.Axis2ServiceInvoker; +import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; +import org.apache.tuscany.core.extension.ExternalServiceContextFactory; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyInitializationException; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.Composite; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.OverrideOption; +import org.apache.tuscany.model.assembly.Part; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceContract; + +import commonj.sdo.helper.TypeHelper; + +public class ExternalWebServiceBuilderTestCase extends TestCase { + + private Definition definition; + + private static final QName SERVICE_NAME = new QName("http://helloworldaxis.samples.tuscany.apache.org", "HelloWorldServiceImplService"); + + private static final String PORTNAME = "helloworld"; + + private static final QName GET_GREETINGS_QN = new QName(SERVICE_NAME.getNamespaceURI(), "getGreetings"); + + public void testCreateOperationInvokers() { + ExternalWebServiceBuilder builder = new ExternalWebServiceBuilder(); + + Port port = definition.getService(SERVICE_NAME).getPort(PORTNAME); + WebServicePortMetaData wspmd = new WebServicePortMetaData(definition, port, null, false); + + Map invokers = builder.createOperationInvokers(Foo.class, null, getClass().getClassLoader(),wspmd); + assertNotNull(invokers); + assertEquals(1, invokers.size()); + + Axis2OperationInvoker opInvoker = invokers.get(GET_GREETINGS_QN.getLocalPart()); + assertNotNull(opInvoker); + assertEquals(GET_GREETINGS_QN, opInvoker.getWSDLOperationName()); + } + + public void testCreateExternalServiceContextFactory() { + ExternalWebServiceBuilder builder = new ExternalWebServiceBuilder(); + ExternalService es = createMockExternalService(); + ExternalServiceContextFactory cf = builder.createExternalServiceContextFactory(es); + assertNotNull(cf); + Axis2ServiceInvoker si = (Axis2ServiceInvoker) cf.createContext().getHandler(); + assertNotNull(si); + } + + protected void setUp() throws Exception { + super.setUp(); + WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); + reader.setFeature("javax.wsdl.verbose", false); + URL url = getClass().getResource("helloworld.wsdl"); + this.definition = reader.readWSDL(url.toString()); + } + + interface Foo { + public void getGreetings(); + }; + + private ExternalService createMockExternalService() { + ExternalService es = new ExternalService() { + + public List getBindings() { + return Arrays.asList(new Binding[] { createMockBinding() }); + } + + public OverrideOption getOverrideOption() { + + return null; + } + + public void setOverrideOption(OverrideOption value) { + + } + + public ConfiguredService getConfiguredService() { + return new ConfiguredService() { + + public String getName() { + + return null; + } + + public void setName(String name) { + + } + + public Service getPort() { + return new Service() { + + public ServiceContract getServiceContract() { + return new ServiceContract() { + + public Class getInterface() { + return Foo.class; + } + + public void setInterface(Class value) { + + } + + public Class getCallbackInterface() { + + return null; + } + + public void setCallbackInterface(Class value) { + + } + + public Scope getScope() { + + return null; + } + + public void setScope(Scope scope) { + + } + + public List getExtensibilityElements() { + + return null; + } + + public List getExtensibilityAttributes() { + + return null; + } + + public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException { + + } + + public void freeze() { + + } + + public boolean accept(AssemblyVisitor visitor) { + + return false; + } + }; + } + + public void setServiceContract(ServiceContract contract) { + + } + + public String getName() { + + return null; + } + + public void setName(String name) { + + } + + public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException { + + } + + public void freeze() { + + } + + public boolean accept(AssemblyVisitor visitor) { + + return false; + } + }; + } + + public void setPort(Service port) { + + } + + public Part getPart() { + + return null; + } + + public void setPart(Part part) { + + } + + public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException { + + } + + public void freeze() { + + } + + public boolean accept(AssemblyVisitor visitor) { + + return false; + } + + public void setProxyFactory(Object proxyFactory) { + + } + + public Object getProxyFactory() { + + return null; + } + }; + } + + public void setConfiguredService(ConfiguredService configuredService) { + + } + + public String getName() { + + return "myService"; + } + + public void setName(String value) { + + } + + public Composite getComposite() { + + return null; + } + + public void setComposite(Composite composite) { + + } + + public List getExtensibilityElements() { + + return null; + } + + public List getExtensibilityAttributes() { + + return null; + } + + public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException { + + } + + public void freeze() { + + } + + public boolean accept(AssemblyVisitor visitor) { + + return false; + } + + public void setContextFactory(Object contextFactory) { + + } + + public Object getContextFactory() { + + return null; + } + }; + return es; + } + + private Binding createMockBinding() { + WebServiceBinding b = new WebServiceBinding() { + + public void setPortURI(String portURI) { + + } + + public Port getWSDLPort() { + return definition.getService(SERVICE_NAME).getPort(PORTNAME); + } + + public Definition getWSDLDefinition() { + return definition; + } + + public void setWSDLPort(Port value) { + + } + + public void setWSDLDefinition(Definition definition) { + + } + + public TypeHelper getTypeHelper() { + + return null; + } + + public void setTypeHelper(TypeHelper typeHelper) { + + } + + public ResourceLoader getResourceLoader() { + return new ResourceLoaderImpl(Thread.currentThread().getContextClassLoader()); + } + + public void setResourceLoader(ResourceLoader resourceLoader) { + + } + + public String getURI() { + + return null; + } + + public void setURI(String value) { + + } + + public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException { + + } + + public void freeze() { + + } + + public boolean accept(AssemblyVisitor visitor) { + + return false; + } + + public void setWebAppName(String webAppName) { + } + + public String getWebAppName() { + return null; + } + + }; + return b; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldService.java new file mode 100644 index 0000000000..6d046d84c4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.handler; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldService { + + String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldServiceComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldServiceComponentImpl.java new file mode 100644 index 0000000000..972b94e5a7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/handler/HelloWorldServiceComponentImpl.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.handler; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldService.class) +//FIXME workaround for JIRA TUSCANY-41 +@Scope("MODULE") +public class HelloWorldServiceComponentImpl implements HelloWorldService { + + @Reference + // Injected by the SCA container. + private HelloWorldService hellowWorldService; + + /** + * @see org.apache.tuscany.samples.helloworldwsclient.HelloWorldService#getGreetings(java.lang.String) + */ + public String getGreetings(final String name) { + assert null != hellowWorldService : "helloWorldService was not set by the SCA runtime!"; + + return hellowWorldService.getGreetings(name); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/util/SDODataBindingTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/util/SDODataBindingTestCase.java new file mode 100644 index 0000000000..621f12068c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/util/SDODataBindingTestCase.java @@ -0,0 +1,123 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.axis2.util; + +import java.net.URL; + +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.axiom.om.OMElement; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XSDHelper; + +public class SDODataBindingTestCase extends TestCase { + public static final QName DOCLITWRAPPED_QN = new QName("http://www.example.org/creditscore/doclitwrapped/", "getCreditScore"); + + public static final QName DOCLIT_QN = new QName("http://www.example.org/creditscore/doclit/", "getCreditScoreRequest"); + + public static final QName GREETING_QN = new QName("http://helloworldaxis.samples.tuscany.apache.org", "getGreetings"); + + private TypeHelper typeHelper; + + private SDODataBinding docLitWrappedDB; + + private SDODataBinding docLitDB; + + private SDODataBinding greetingDB; + + public void testToOMElement() { + String s = "petra"; + + OMElement omElement = greetingDB.toOMElement(new Object[] { s }); + assertNotNull(omElement); + + Object[] os = greetingDB.fromOMElement(omElement); + assertNotNull(os); + assertEquals(1, os.length); + assertEquals(s, os[0]); + } + + public void testDocLit() { + DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper); + DataObject dataObject = dataFactory.create("http://www.example.org/creditscore/doclit/", "Customer"); + dataObject.setString(0, "111-22-3333"); + dataObject.setString(1, "John"); + dataObject.setString(2, "Smith"); + + OMElement omElement = docLitDB.toOMElement(new Object[] { dataObject }); + assertNotNull(omElement); + + Object[] os = docLitDB.fromOMElement(omElement); + assertNotNull(os); + assertEquals(os.length, 1); + assertTrue(os[0] instanceof DataObject); + + dataObject = (DataObject) os[0]; + assertEquals(dataObject.getString(0), "111-22-3333"); + assertEquals(dataObject.getString(1), "John"); + assertEquals(dataObject.getString(2), "Smith"); + } + + public void testDocLitWrapped() { + Object[] args = new Object[] { "111-22-3333", "John", "Smith" }; + + OMElement omElement = docLitWrappedDB.toOMElement(args); + assertNotNull(omElement); + + Object[] os = docLitWrappedDB.fromOMElement(omElement); + assertNotNull(os); + assertEquals(os.length, 3); + + assertEquals(os[0], "111-22-3333"); + assertEquals(os[1], "John"); + assertEquals(os[2], "Smith"); + } + + protected void setUp() throws Exception { + super.setUp(); + DataObjectUtil.initRuntime(); + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); + + typeHelper = SDOUtil.createTypeHelper(); + XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper); + URL url = getClass().getResource("helloworld.wsdl"); + xsdHelper.define(url.openStream(), null); + url = getClass().getResource("CreditScoreDocLitWrapped.wsdl"); + xsdHelper.define(url.openStream(), null); + url = getClass().getResource("CreditScoreDocLit.wsdl"); + xsdHelper.define(url.openStream(), null); + + this.greetingDB = new SDODataBinding(getClass().getClassLoader(),typeHelper, GREETING_QN, true); + this.docLitWrappedDB = new SDODataBinding(getClass().getClassLoader(),typeHelper, DOCLITWRAPPED_QN, true); + + this.docLitDB = new SDODataBinding(getClass().getClassLoader(),typeHelper, DOCLIT_QN, false); + + } finally { + Thread.currentThread().setContextClassLoader(cl); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.wsdl new file mode 100644 index 0000000000..b62a2c09da --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl new file mode 100644 index 0000000000..6af61ef80e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/sca.module new file mode 100644 index 0000000000..6c0b70b25e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/assembly/tests/sca.module @@ -0,0 +1,60 @@ + + + + + + + + + + + AccountExternalService + + + + + + AccountExternalService + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/builder/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/builder/helloworld.wsdl new file mode 100644 index 0000000000..465f1fd4af --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/builder/helloworld.wsdl @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/helloworld.wsdl new file mode 100644 index 0000000000..465f1fd4af --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/helloworld.wsdl @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/sca.module new file mode 100644 index 0000000000..f1433f4648 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/handler/sca.module @@ -0,0 +1,34 @@ + + + + + + + + + + HelloWorldService + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLit.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLit.wsdl new file mode 100644 index 0000000000..4aec526803 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLit.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLitWrapped.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLitWrapped.wsdl new file mode 100644 index 0000000000..7839d3ea71 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/DocLitWrapped.wsdl @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/RpcLit.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/RpcLit.wsdl new file mode 100644 index 0000000000..8f94f9c66f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/RpcLit.wsdl @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/sca.module new file mode 100644 index 0000000000..7d8bb7861f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/mediator/tests/sca.module @@ -0,0 +1,20 @@ + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLit.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLit.wsdl new file mode 100644 index 0000000000..09d1a58589 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLit.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLitWrapped.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLitWrapped.wsdl new file mode 100644 index 0000000000..3952c74809 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/CreditScoreDocLitWrapped.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/helloworld.wsdl new file mode 100644 index 0000000000..c1d4cdccda --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.axis2/src/test/resources/org/apache/tuscany/binding/axis2/util/helloworld.wsdl @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.checkstyle b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.checkstyle new file mode 100644 index 0000000000..048a1cef2e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.checkstyle @@ -0,0 +1,6 @@ + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.pmd b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.pmd new file mode 100644 index 0000000000..03e6ecf065 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.pmd @@ -0,0 +1,2 @@ + +true \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.ruleset b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.ruleset new file mode 100644 index 0000000000..0bead9a61c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/.ruleset @@ -0,0 +1,172 @@ + + + PMD Plugin preferences rule set + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/checkstyle.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/checkstyle.xml new file mode 100644 index 0000000000..9fa44fb41d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/checkstyle.xml @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/pom.xml new file mode 100644 index 0000000000..a33141e5f2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/pom.xml @@ -0,0 +1,165 @@ + + + + + + org.apache.tuscany.sca.bindings + tuscany-sca-bindings + incubating-M1 + + + 4.0.0 + tuscany-binding-celtix + Tuscany Celtix Binding + Implementation of the SCA Web Services binding using Celtix. + incubating-M1 + + + 1.0 + -Xlint:unchecked,deprecation,fallthrough,finally + + + + objectweb + ObjectWeb repo + http://maven.objectweb.org/maven2 + + true + + + false + + + + + + + org.apache.tuscany + tuscany-core + ${pom.version} + compile + + + org.apache.tuscany.databinding + tuscany-databinding-sdo + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + test + + + + junit + junit + 3.8.1 + test + + + + + org.easymock + easymockclassextension + 2.2 + test + + + + + org.objectweb.celtix + celtix-rt + ${celtix.version} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + true + ${compile.flags} + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + process-sources + process-sources + + ${basedir}/checkstyle.xml + true + true + + + checkstyle + + + + + + + + org.apache.maven.plugins + maven-eclipse-plugin + + true + + org.eclipse.jdt.core.javabuilder + com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder + net.sourceforge.pmd.eclipse.pmdBuilder + + + org.eclipse.jdt.core.javanature + com.atlassw.tools.eclipse.checkstyle.CheckstyleNature + net.sourceforge.pmd.eclipse.pmdNature + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactory.java new file mode 100644 index 0000000000..46d5cac4dd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactory.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.assembly; + +import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; +import org.apache.tuscany.model.assembly.AssemblyFactory; + +/** + * The Factory for the model. + */ +public interface WebServiceAssemblyFactory extends AssemblyFactory { + + /** + * Returns a new WebServiceBinding. + */ + WebServiceBinding createWebServiceBinding(WSDLDefinitionRegistry wsdlRegistry); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java new file mode 100644 index 0000000000..82dd08ef0d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/WebServiceBinding.java @@ -0,0 +1,80 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.assembly; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; + +import commonj.sdo.helper.TypeHelper; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.model.assembly.Binding; +import org.objectweb.celtix.Bus; + +/** + * Represents a Web service binding. + */ +public interface WebServiceBinding extends Binding { + + /** + * Set the URI of the WSDL port for this binding. + * + * @param portURI the URI of the WSDL port + */ + void setPortURI(String portURI); + + /** + * Returns the WSDL port defining this binding. + */ + Port getWSDLPort(); + + /** + * Returns the WSDL service defining this binding. + */ + Service getWSDLService(); + + /** + * Returns the WSDL definition containing the WSDL port. + * + * @return the WSDL definition containing the WSDL port + */ + Definition getWSDLDefinition(); + + /** + * Sets the WSDL port defining this binding. + */ + void setWSDLPort(Port value); + + /** + * Sets the WSDL definition containing the WSDL port. + * + * @param definition + */ + void setWSDLDefinition(Definition definition); + + TypeHelper getTypeHelper(); + + void setTypeHelper(TypeHelper typeHelper); + + ResourceLoader getResourceLoader(); + + void setResourceLoader(ResourceLoader resourceLoader); + + Bus getBus(); + void setBus(Bus b); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceAssemblyFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceAssemblyFactoryImpl.java new file mode 100644 index 0000000000..1288f67719 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceAssemblyFactoryImpl.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.assembly.impl; + +import org.apache.tuscany.binding.celtix.assembly.WebServiceAssemblyFactory; +import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; +import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; +import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; + +/** + * An implementation of the model Factory. + */ +public class WebServiceAssemblyFactoryImpl extends AssemblyFactoryImpl implements WebServiceAssemblyFactory { + + /** + * Creates an instance of the factory. + */ + public WebServiceAssemblyFactoryImpl() { + super(); + } + + /** + * @see org.apache.tuscany.binding.celtix.assembly.WebServiceAssemblyFactory#createWebServiceBinding() + */ + public WebServiceBinding createWebServiceBinding(WSDLDefinitionRegistry wsdlRegistry) { + return new WebServiceBindingImpl(wsdlRegistry); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java new file mode 100644 index 0000000000..477d2b656a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/assembly/impl/WebServiceBindingImpl.java @@ -0,0 +1,184 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.assembly.impl; + +import java.util.Collection; +import java.util.List; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.xml.namespace.QName; + +import commonj.sdo.helper.TypeHelper; +import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.impl.BindingImpl; +import org.objectweb.celtix.Bus; + +/** + * An implementation of WebServiceBinding. + */ +public class WebServiceBindingImpl extends BindingImpl implements WebServiceBinding { + + private WSDLDefinitionRegistry wsdlRegistry; + + private Definition definition; + private Port port; + private Service service; + private String portURI; + private TypeHelper typeHelper; + private ResourceLoader resourceLoader; + private Bus bus; + + /** + * Constructor + */ + protected WebServiceBindingImpl(WSDLDefinitionRegistry reg) { + wsdlRegistry = reg; + } + + /** + * @see org.apache.tuscany.binding.celtix.assembly.WebServiceBinding#getWSDLPort() + */ + public Port getWSDLPort() { + return port; + } + + public Service getWSDLService() { + return service; + } + + + + /** + * @see org.apache.tuscany.binding.celtix.assembly.WebServiceBinding#setWSDLPort(javax.wsdl.Port) + */ + public void setWSDLPort(Port value) { + checkNotFrozen(); + port = value; + } + + /** + * @see org.apache.tuscany.binding.celtix.assembly.WebServiceBinding#getWSDLDefinition() + */ + public Definition getWSDLDefinition() { + return definition; + } + + /** + * @see WebServiceBinding#setWSDLDefinition(javax.wsdl.Definition) + */ + public void setWSDLDefinition(Definition def) { + checkNotFrozen(); + definition = def; + } + + /** + * @param uri The portURI to set. + */ + public void setPortURI(String uri) { + portURI = uri; + } + + public TypeHelper getTypeHelper() { + return typeHelper; + } + + public void setTypeHelper(TypeHelper pTypeHelper) { + this.typeHelper = pTypeHelper; + } + + public ResourceLoader getResourceLoader() { + return resourceLoader; + } + + public void setResourceLoader(ResourceLoader resourceLoader) { + this.resourceLoader = resourceLoader; + } + + /** + * @see BindingImpl#initialize(org.apache.tuscany.model.assembly.AssemblyContext) + */ + @SuppressWarnings("unchecked") + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) { + return; + } + super.initialize(modelContext); + + // Get the WSDL port namespace and name + if (port == null && portURI != null) { + int h = portURI.indexOf('#'); + String portNamespace = portURI.substring(0, h); + String serviceName; + String portName; + + String fragment = portURI.substring(h + 1); + if (fragment.startsWith("wsdl.endpoint(") && fragment.endsWith(")")) { + fragment = fragment.substring(14, fragment.length() - 1); + int slash = fragment.indexOf('/'); + if (slash != -1) { + serviceName = fragment.substring(0, slash); + portName = fragment.substring(slash + 1); + } else { + serviceName = null; + portName = fragment; + } + } else { + serviceName = null; + portName = fragment; + } + + // Load the WSDL definitions for the given namespace + List definitions = wsdlRegistry.getDefinitionsForNamespace(portNamespace, resourceLoader); + if (definitions == null) { + throw new IllegalArgumentException("Cannot find WSDL definition for " + portNamespace); + } + for (Definition def : definitions) { + + // Find the port with the given name + for (Service serv : (Collection)def.getServices().values()) { + QName sqn = serv.getQName(); + if (serviceName != null + && !serviceName.equals(sqn.getLocalPart())) { + continue; + } + + Port p = serv.getPort(portName); + if (p != null) { + service = serv; + definition = def; + port = p; + return; + } + } + } + throw new IllegalArgumentException("Cannot find WSDL port " + portURI); + } + } + + public Bus getBus() { + return bus; + } + + public void setBus(Bus b) { + bus = b; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceBuilder.java new file mode 100644 index 0000000000..99ffaa5d8a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceBuilder.java @@ -0,0 +1,48 @@ +/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.builder; + +import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; +import org.apache.tuscany.binding.celtix.config.ExternalWebServiceContextFactory; +import org.apache.tuscany.binding.celtix.handler.ExternalWebServiceClient; +import org.apache.tuscany.core.extension.ExternalServiceBuilderSupport; +import org.apache.tuscany.core.extension.ExternalServiceContextFactory; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.model.assembly.ExternalService; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + + +/** + * Creates a ContextFactoryBuilder for an external service configured with the {@link + * WebServiceBinding} + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ExternalWebServiceBuilder extends ExternalServiceBuilderSupport { + + @Init(eager = true) + public void init() throws Exception { + super.init(); + } + + protected ExternalServiceContextFactory createExternalServiceContextFactory( + ExternalService externalService) { + ExternalWebServiceClient externalWebServiceClient = new ExternalWebServiceClient(externalService); + return new ExternalWebServiceContextFactory(externalService.getName(), + new SingletonObjectFactory(externalWebServiceClient)); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceWireBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceWireBuilder.java new file mode 100644 index 0000000000..e16456f80c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/ExternalWebServiceWireBuilder.java @@ -0,0 +1,35 @@ +/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.builder; + +import java.lang.reflect.Method; + +import org.apache.tuscany.binding.celtix.config.ExternalWebServiceContextFactory; +import org.apache.tuscany.binding.celtix.handler.ExternalWebServiceTargetInvoker; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.extension.WireBuilderSupport; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.osoa.sca.annotations.Scope; + + +@Scope("MODULE") +public class ExternalWebServiceWireBuilder extends WireBuilderSupport { + + protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, + ScopeContext context, boolean downScope) { + return new ExternalWebServiceTargetInvoker(targetName, operation, context); + } +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/WebServiceEntryPointBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/WebServiceEntryPointBuilder.java new file mode 100644 index 0000000000..705b8c9784 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/builder/WebServiceEntryPointBuilder.java @@ -0,0 +1,47 @@ +/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.builder; + +import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; +import org.apache.tuscany.binding.celtix.config.WebServiceEntryPointContextFactory; + +import org.apache.tuscany.core.extension.EntryPointBuilderSupport; +import org.apache.tuscany.core.extension.EntryPointContextFactory; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.webapp.ServletHost; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.osoa.sca.annotations.Scope; + +/** + * Creates a ContextFactory for an entry point configured with the {@link WebServiceBinding} + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class WebServiceEntryPointBuilder extends EntryPointBuilderSupport { + ServletHost tomcatHost; + + @Autowire + public void setTomcatHost(ServletHost tomcatHost) { + this.tomcatHost = tomcatHost; + } + + + protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, + MessageFactory msgFactory) { + return new WebServiceEntryPointContextFactory(tomcatHost, entryPoint, msgFactory); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/ExternalWebServiceContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/ExternalWebServiceContextFactory.java new file mode 100644 index 0000000000..52fedd4b56 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/ExternalWebServiceContextFactory.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.config; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.extension.ExternalServiceContextFactory; + +/** + * Creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} configured with the + * appropriate invocation chains and bindings. This implementation serves as a marker for {@link + * org.apache.tuscany.binding.celtix.builder.ExternalWebServiceWireBuilder} + * + * @version $Rev$ $Date$ + */ +public class ExternalWebServiceContextFactory extends ExternalServiceContextFactory { + + public ExternalWebServiceContextFactory(String name, ObjectFactory objectFactory) { + super(name, objectFactory); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/WebServiceEntryPointContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/WebServiceEntryPointContextFactory.java new file mode 100644 index 0000000000..39e0b10053 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/config/WebServiceEntryPointContextFactory.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.config; + +import org.apache.tuscany.binding.celtix.handler.CeltixEntryPointContextImpl; +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.extension.EntryPointContextFactory; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.webapp.ServletHost; +import org.apache.tuscany.model.assembly.EntryPoint; + +/** + * Creates instances of {@link org.apache.tuscany.core.context.EntryPointContext} configured with the + * appropriate invocation chains and bindings. This implementation serves as a marker for + * + * @version $Rev$ $Date$ + */ +public class WebServiceEntryPointContextFactory extends EntryPointContextFactory { + MessageFactory messageFactory; + EntryPoint entryPoint; + ServletHost servlet; + + public WebServiceEntryPointContextFactory(ServletHost tomcatHost, + EntryPoint entryPoint, + MessageFactory mf) { + super(entryPoint.getName(), mf); + messageFactory = mf; + this.entryPoint = entryPoint; + servlet = tomcatHost; + } + + public EntryPointContext createContext() throws ContextCreationException { + if (servlet == null) { + return new CeltixEntryPointContextImpl(entryPoint, + getSourceWireFactories().get(0), + messageFactory); + } else { + //REVISIT - running in tomcat + return null; + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/CeltixEntryPointContextImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/CeltixEntryPointContextImpl.java new file mode 100644 index 0000000000..5b2e0df3d6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/CeltixEntryPointContextImpl.java @@ -0,0 +1,263 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.handler; + +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executor; + +import javax.jws.soap.SOAPBinding.Style; +import javax.wsdl.Binding; +import javax.wsdl.BindingInput; +import javax.wsdl.BindingOperation; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.extensions.ExtensibilityElement; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap.SOAPBody; +import javax.xml.namespace.QName; +import javax.xml.ws.WebServiceProvider; + +import commonj.sdo.helper.TypeHelper; + +import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; +import org.apache.tuscany.binding.celtix.handler.io.SCAServerDataBindingCallback; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.context.ContextInitException; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.impl.EntryPointContextImpl; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.objectweb.celtix.Bus; +import org.objectweb.celtix.bindings.DataBindingCallback; +import org.objectweb.celtix.bindings.ServerBinding; +import org.objectweb.celtix.bindings.ServerBindingEndpointCallback; +import org.objectweb.celtix.bindings.ServerDataBindingCallback; +import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache; +import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; +import org.objectweb.celtix.context.ObjectMessageContext; +import org.objectweb.celtix.ws.addressing.AttributedURIType; +import org.objectweb.celtix.ws.addressing.EndpointReferenceType; +import org.objectweb.celtix.wsdl.EndpointReferenceUtils; +import org.osoa.sca.annotations.Destroy; +import org.xmlsoap.schemas.wsdl.http.AddressType; + +public class CeltixEntryPointContextImpl extends EntryPointContextImpl + implements ServerBindingEndpointCallback { + + EntryPoint entry; + private Bus bus; + private Port port; + private TypeHelper typeHelper; + private WSDLMetaDataCache wsdlCache; + private ServerBinding serverBinding; + private Object entryPointProxy; + private WebServiceBinding wsBinding; + + private Map opMap = + new ConcurrentHashMap(); + + + public CeltixEntryPointContextImpl(EntryPoint entry, + SourceWireFactory sourceWireFactory, + MessageFactory messageFactory) + throws ContextInitException { + + super(entry.getName(), sourceWireFactory, messageFactory); + this.entry = entry; + } + + public void start() throws ContextInitException { + super.start(); + + entryPointProxy = getInstance(null); + wsBinding = (WebServiceBinding)entry.getBindings().get(0); + bus = wsBinding.getBus(); + typeHelper = wsBinding.getTypeHelper(); + Definition wsdlDef = wsBinding.getWSDLDefinition(); + port = wsBinding.getWSDLPort(); + wsdlCache = new WSDLMetaDataCache(wsdlDef, wsBinding.getWSDLPort()); + + initOperationMap(wsdlDef); + + String key = wsdlDef.getDocumentBaseURI(); + URL url; + try { + url = new URL(key); + } catch (MalformedURLException e) { + throw new ContextInitException(e); + } + + EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url, + wsBinding.getWSDLService().getQName(), + wsBinding.getWSDLPort().getName()); + + AttributedURIType address = new AttributedURIType(); + + String bindingId = null; + Binding binding = wsBinding.getWSDLPort().getBinding(); + if (null != binding) { + List list = binding.getExtensibilityElements(); + if (!list.isEmpty()) { + bindingId = ((ExtensibilityElement)list.get(0)).getElementType().getNamespaceURI(); + } + } + List list = wsBinding.getWSDLPort().getExtensibilityElements(); + for (Object ep : list) { + ExtensibilityElement ext = (ExtensibilityElement)ep; + if (ext instanceof SOAPAddress) { + if (bindingId == null) { + bindingId = ((SOAPAddress)ext).getLocationURI(); + } + address.setValue(((SOAPAddress)ext).getLocationURI()); + } + if (ext instanceof AddressType) { + if (bindingId == null) { + bindingId = ((AddressType)ext).getLocation(); + } + address.setValue(((AddressType)ext).getLocation()); + } + } + if (reference.getAddress() == null) { + //REVIST - bug in Celtix that the HTTP transport won't find the address correctly + reference.setAddress(address); + } + + try { + serverBinding = bus.getBindingManager().getBindingFactory(bindingId).createServerBinding( + reference, this); + serverBinding.activate(); + } catch (Exception e) { + throw new ContextInitException(e); + } + } + + @Destroy + public void stop() throws CoreRuntimeException { + System.out.println("In stop"); + super.stop(); + } + + private void initOperationMap(Definition def) { + List ops = port.getBinding().getBindingOperations(); + Iterator opIt = ops.iterator(); + while (opIt.hasNext()) { + BindingOperation op = (BindingOperation)opIt.next(); + BindingInput bindingInput = op.getBindingInput(); + List elements = bindingInput.getExtensibilityElements(); + QName qn = new QName(def.getTargetNamespace(), op.getName()); + for (Iterator i = elements.iterator(); i.hasNext();) { + Object element = i.next(); + if (SOAPBody.class.isInstance(element)) { + SOAPBody body = (SOAPBody)element; + if (body.getNamespaceURI() != null) { + qn = new QName(body.getNamespaceURI(), op.getName()); + } + } + } + + ServerDataBindingCallback cb = getDataBindingCallback(qn, null, + DataBindingCallback.Mode.PARTS); + opMap.put(qn, cb); + if (!"".equals(cb.getRequestWrapperQName().getLocalPart())) { + opMap.put(cb.getRequestWrapperQName(), cb); + } + } + } + public ServerDataBindingCallback getDataBindingCallback(QName operationName, + ObjectMessageContext objContext, + DataBindingCallback.Mode mode) { + if (opMap.containsKey(operationName)) { + return opMap.get(operationName); + } + WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName.getLocalPart()); + if (opInfo == null) { + //REVISIT - really map the operation name to a WSDL operation + for (String opName : wsdlCache.getAllOperationInfo().keySet()) { + if (operationName.getLocalPart().equalsIgnoreCase(opName)) { + opInfo = wsdlCache.getOperationInfo(opName); + break; + } + } + } + boolean inout = false; + + + Class serviceInterface = getServiceInterface(); + Method meth = getMethod(serviceInterface, operationName.getLocalPart()); + + return new SCAServerDataBindingCallback(opInfo, + typeHelper, + wsBinding.getResourceLoader(), + inout, + meth, + entryPointProxy); + } + protected Method getMethod(Class serviceInterface, String operationName) { + // Note: this doesn't support overloaded operations + Method[] methods = serviceInterface.getMethods(); + for (Method m : methods) { + if (m.getName().equals(operationName)) { + return m; + } + // tolerate WSDL with capatalized operation name + StringBuilder sb = new StringBuilder(operationName); + sb.setCharAt(0, Character.toLowerCase(sb.charAt(0))); + if (m.getName().equals(sb.toString())) { + return m; + } + } + throw new BuilderConfigException("no operation named " + operationName + + " found on service interface: " + serviceInterface.getName()); + } + + + public DataBindingCallback getFaultDataBindingCallback(ObjectMessageContext objContext) { + // REVISIT - what to do about faults + return null; + } + + public Map getOperations() { + return opMap; + } + + public Style getStyle() { + return wsdlCache.getStyle(); + } + public DataBindingCallback.Mode getServiceMode() { + return DataBindingCallback.Mode.PARTS; + } + + public WebServiceProvider getWebServiceProvider() { + //not needed I think + return null; + } + + public Executor getExecutor() { + //Let the transport handle it (or it goes to the Bus default wq + //if the transport cannot handle it + return null; + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java new file mode 100644 index 0000000000..01c571a611 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceClient.java @@ -0,0 +1,199 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.handler; + + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import javax.jws.WebParam.Mode; +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.WSDLException; +import javax.wsdl.extensions.ExtensibilityElement; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.xml.ws.Holder; +import javax.xml.ws.ProtocolException; + +import commonj.sdo.helper.TypeHelper; +import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; +import org.apache.tuscany.binding.celtix.handler.io.SCADataBindingCallback; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.BuilderInitException; +import org.apache.tuscany.model.assembly.ExternalService; +import org.objectweb.celtix.Bus; +import org.objectweb.celtix.BusException; +import org.objectweb.celtix.bindings.ClientBinding; +import org.objectweb.celtix.bindings.DataBindingCallback; +import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache; +import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; +import org.objectweb.celtix.context.ObjectMessageContext; +import org.objectweb.celtix.ws.addressing.EndpointReferenceType; +import org.objectweb.celtix.wsdl.EndpointReferenceUtils; +import org.xmlsoap.schemas.wsdl.http.AddressType; + + +/** + * An ExternalWebServiceClient using Celtix + */ +public class ExternalWebServiceClient { + + private Bus bus; + private TypeHelper typeHelper; + private WSDLMetaDataCache wsdlCache; + private ClientBinding clientBinding; + private WebServiceBinding wsBinding; + + + + public ExternalWebServiceClient(ExternalService externalService) throws BuilderException { + wsBinding = (WebServiceBinding)externalService.getBindings().get(0); + bus = wsBinding.getBus(); + typeHelper = wsBinding.getTypeHelper(); + Definition wsdlDef = wsBinding.getWSDLDefinition(); + wsdlCache = new WSDLMetaDataCache(wsdlDef, wsBinding.getWSDLPort()); + + try { + String key = wsdlDef.getDocumentBaseURI(); + URL url = new URL(key); + + EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url, + wsBinding.getWSDLService().getQName(), + wsBinding.getWSDLPort().getName()); + + String bindingId = null; + Binding binding = wsBinding.getWSDLPort().getBinding(); + if (null != binding) { + List list = binding.getExtensibilityElements(); + if (!list.isEmpty()) { + bindingId = ((ExtensibilityElement)list.get(0)).getElementType().getNamespaceURI(); + } + } + if (bindingId == null) { + List list = wsBinding.getWSDLPort().getExtensibilityElements(); + for (Object ep : list) { + ExtensibilityElement ext = (ExtensibilityElement)ep; + if (ext instanceof SOAPAddress) { + bindingId = ((SOAPAddress)ext).getLocationURI(); + } + if (ext instanceof AddressType) { + bindingId = ((AddressType)ext).getLocation(); + } + } + + } + clientBinding = bus.getBindingManager().getBindingFactory(bindingId).createClientBinding( + reference); + } catch (MalformedURLException e) { + throw new BuilderInitException(e); + } catch (BusException e) { + throw new BuilderInitException(e); + } catch (WSDLException e) { + throw new BuilderInitException(e); + } catch (IOException e) { + throw new BuilderInitException(e); + } + } + + /** + * Invoke an operation on the external Web service. + * + * @param operationName the name of the WS operation to invoke + * @param args the Java object arguments to the WS operation + * @return the response from the WS as a Java object + */ + public Object invoke(String operationName, Object[] args) { + WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName); + if (opInfo == null) { + //REVISIT - really map the operation name to a WSDL operation + for (String opName : wsdlCache.getAllOperationInfo().keySet()) { + if (operationName.equalsIgnoreCase(opName)) { + opInfo = wsdlCache.getOperationInfo(opName); + break; + } + } + } + ObjectMessageContext objMsgContext = clientBinding.createObjectContext(); + + boolean hasInOut = false; + int inOutCount = 0; + Object realArgs[] = new Object[args.length]; + if (opInfo.getParamsLength() == 0) { + //REVISIT - opInfo doesn't return the needed info for the wrapped doc/lit case. + //Bug in Celtix + realArgs = args; + } else { + for (int x = 0; x < args.length; x++) { + if (opInfo.getWebParam(x).mode() == Mode.IN) { + realArgs[x] = args[x]; + } else { + realArgs[x] = new Holder(args[x]); + inOutCount++; + hasInOut = true; + } + } + } + + objMsgContext.setMessageObjects(realArgs); + + boolean isOneway = opInfo.isOneWay(); + DataBindingCallback callback = new SCADataBindingCallback(opInfo, typeHelper, + wsBinding.getResourceLoader(), + hasInOut); + + try { + if (isOneway) { + clientBinding.invokeOneWay(objMsgContext, + callback); + } else { + objMsgContext = clientBinding.invoke(objMsgContext, + callback); + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + if (objMsgContext.getException() != null) { + //REVISIT - Exceptions + /* + if (isValidException(objMsgContext)) { + throw (Exception)objMsgContext.getException(); + } else { + throw new ProtocolException(objMsgContext.getException()); + } + */ + throw new ProtocolException(objMsgContext.getException()); + } + + if (hasInOut) { + Object ret[] = new Object[inOutCount + 1]; + ret[0] = objMsgContext.getReturn(); + inOutCount = 1; + for (int x = 0; x < args.length; x++) { + if (opInfo.getWebParam(x).mode() != Mode.IN) { + Holder holder = (Holder)realArgs[x]; + ret[inOutCount] = holder.value; + inOutCount++; + } + } + return ret; + } + return objMsgContext.getReturn(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java new file mode 100644 index 0000000000..06786ca76d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/ExternalWebServiceTargetInvoker.java @@ -0,0 +1,115 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.handler; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.ExternalServiceContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.TargetInvoker; + + +/** + * Responsible for invoking an external web service + * + * @version $Rev$ $Date$ + */ +public class ExternalWebServiceTargetInvoker implements TargetInvoker { + + private QualifiedName serviceName; + private String esName; + private Method method; + private ScopeContext container; + + private ExternalServiceContext context; + + /** + * Constructs a new ExternalWebServiceTargetInvoker. + */ + public ExternalWebServiceTargetInvoker(QualifiedName servicename, + Method meth, + ScopeContext cont) { + assert servicename != null : "No service name specified"; + assert meth != null : "No method specified"; + assert cont != null : "No scope container specified"; + this.serviceName = servicename; + this.esName = serviceName.getPartName(); + this.method = meth; + this.container = cont; + } + + public Object invokeTarget(Object payload) throws InvocationTargetException { + if (context == null) { + Context iContext = container.getContext(esName); + if (!(iContext instanceof ExternalServiceContext)) { + TargetException te = new TargetException("Unexpected target context type"); + te.setIdentifier(iContext.getClass().getName()); + te.addContextName(iContext.getName()); + throw te; + } + context = (ExternalServiceContext)iContext; + } + ExternalWebServiceClient client = (ExternalWebServiceClient)context.getHandler(); + if (payload != null) { + return client.invoke(method.getName(), (Object[])payload); + } else { + return client.invoke(method.getName(), new Object[0]); + } + } + + public boolean isCacheable() { + return false; + } + + public Message invoke(Message msg) { + try { + Object resp = invokeTarget(msg.getBody()); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBody(e.getCause()); + } catch (Throwable e) { + msg.setBody(e); + } + return msg; + } + + public void setNext(Interceptor next) { + throw new UnsupportedOperationException(); + } + + public Object clone() throws CloneNotSupportedException { + try { + ExternalWebServiceTargetInvoker invoker = (ExternalWebServiceTargetInvoker)super.clone(); + invoker.container = container; + invoker.context = this.context; + invoker.esName = this.esName; + invoker.method = this.method; + invoker.serviceName = this.serviceName; + return invoker; + } catch (CloneNotSupportedException e) { + // will not happen + return null; + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java new file mode 100644 index 0000000000..d1b13f6e17 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataReader.java @@ -0,0 +1,170 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.handler.io; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.ws.WebServiceException; + +import org.w3c.dom.Node; +import org.w3c.dom.bootstrap.DOMImplementationRegistry; +import org.w3c.dom.ls.DOMImplementationLS; +import org.w3c.dom.ls.LSOutput; +import org.w3c.dom.ls.LSSerializer; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.helper.XMLDocument; + +import org.apache.tuscany.databinding.sdo.SDOXMLHelper; +import org.apache.tuscany.sdo.helper.XMLHelperImpl; +import org.objectweb.celtix.bindings.DataReader; +import org.objectweb.celtix.context.ObjectMessageContext; + +public class NodeDataReader implements DataReader { + + SCADataBindingCallback callback; + + public NodeDataReader(SCADataBindingCallback cb) { + callback = cb; + } + + public Object read(int idx, Node input) { + return read(null, idx, input); + } + + public Object read(QName name, int idx, Node input) { + try { + byte bytes[] = getNodeBytes(input); + Object os[] = SDOXMLHelper.toObjects(callback.getResourceClassLoader(), + callback.getTypeHelper(), bytes, false); + return os[0]; + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new WebServiceException(e); + } + + } + + public void readWrapper(ObjectMessageContext objCtx, boolean isOutBound, Node input) { + try { + QName wrapperName; + if (isOutBound) { + wrapperName = callback.getOperationInfo().getResponseWrapperQName(); + } else { + wrapperName = callback.getOperationInfo().getRequestWrapperQName(); + } + + Node nd = input.getFirstChild(); + while (nd != null + && !wrapperName.getNamespaceURI().equals(nd.getNamespaceURI()) + && !wrapperName.getLocalPart().equals(nd.getLocalName())) { + nd = nd.getNextSibling(); + } + + //REVISIT - This is SUCH a HACK. This needs to be done with StAX or something + //a bit better than streaming and reparsing + InputStream in = getNodeStream(nd); + XMLDocument document = new XMLHelperImpl(callback.getTypeHelper()).load(in); + DataObject object = document.getRootObject(); + + List ips = object.getInstanceProperties(); + Object[] os = new Object[object.getInstanceProperties().size()]; + for (int i = 0; i < os.length; i++) { + os[i] = object.get((Property)ips.get(i)); + } + + if (callback.hasInOut()) { + //REVISIT - inOuts + } else { + if (isOutBound) { + objCtx.setReturn(os[0]); + } else { + objCtx.setMessageObjects(os); + } + } + } catch (IOException e) { + throw new WebServiceException(e); + } catch (ClassCastException e) { + throw new WebServiceException(e); + } catch (ClassNotFoundException e) { + throw new WebServiceException(e); + } catch (InstantiationException e) { + throw new WebServiceException(e); + } catch (IllegalAccessException e) { + throw new WebServiceException(e); + } + } + private byte[] getNodeBytes(Node node) + throws ClassCastException, ClassNotFoundException, + InstantiationException, IllegalAccessException { + + //This is also a hack, the JDK should already have this set, but it doesn't + DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); + if (registry == null) { + System.setProperty(DOMImplementationRegistry.PROPERTY, + "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); + registry = DOMImplementationRegistry.newInstance(); + } + DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); + if (impl == null) { + System.setProperty(DOMImplementationRegistry.PROPERTY, + "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); + registry = DOMImplementationRegistry.newInstance(); + impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); + } + LSOutput output = impl.createLSOutput(); + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + output.setByteStream(bout); + LSSerializer writer = impl.createLSSerializer(); + writer.write(node, output); + + return bout.toByteArray(); + } + + private InputStream getNodeStream(Node node) + throws ClassCastException, ClassNotFoundException, + InstantiationException, IllegalAccessException { + + DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); + if (registry == null) { + //This is also a hack, the JDK should already have this set, but it doesn't + System.setProperty(DOMImplementationRegistry.PROPERTY, + "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); + registry = DOMImplementationRegistry.newInstance(); + } + DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); + if (impl == null) { + System.setProperty(DOMImplementationRegistry.PROPERTY, + "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl"); + registry = DOMImplementationRegistry.newInstance(); + impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); + } + LSOutput output = impl.createLSOutput(); + RawByteArrayOutputStream bout = new RawByteArrayOutputStream(); + output.setByteStream(bout); + LSSerializer writer = impl.createLSSerializer(); + writer.write(node, output); + + return new ByteArrayInputStream(bout.getBytes(), 0, bout.size()); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java new file mode 100644 index 0000000000..27c2276c2a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriter.java @@ -0,0 +1,179 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.handler.io; + + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.List; +import javax.xml.namespace.QName; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.ws.Holder; +import javax.xml.ws.WebServiceException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XSDHelper; + +import org.apache.tuscany.databinding.sdo.SDOXMLHelper; +import org.apache.tuscany.sdo.helper.DataFactoryImpl; +import org.apache.tuscany.sdo.helper.XMLHelperImpl; +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.objectweb.celtix.bindings.DataWriter; +import org.objectweb.celtix.context.ObjectMessageContext; + +public class NodeDataWriter implements DataWriter { + SCADataBindingCallback callback; + + public NodeDataWriter(SCADataBindingCallback cb) { + callback = cb; + } + + public void write(Object obj, Node output) { + write(obj, null, output); + } + + public void write(Object obj, QName elName, Node output) { + byte bytes[] = SDOXMLHelper.toXMLBytes( + callback.getResourceClassLoader(), + callback.getTypeHelper(), + new Object[] {obj}, + elName, + false); + ByteArrayInputStream bin = new ByteArrayInputStream(bytes); + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + try { + SAXParser parser = factory.newSAXParser(); + parser.parse(bin, new NodeContentHandler(output)); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new WebServiceException(e); + } + + } + + public void writeWrapper(ObjectMessageContext objCtx, boolean isOutbound, Node nd) { + QName wrapperName; + if (isOutbound) { + wrapperName = callback.getOperationInfo().getResponseWrapperQName(); + } else { + wrapperName = callback.getOperationInfo().getRequestWrapperQName(); + } + + DataObject obj = toWrappedDataObject(callback.getTypeHelper(), + isOutbound ? objCtx.getReturn() : null, + objCtx.getMessageObjects(), + wrapperName); + + try { + //REVISIT - this is SUCH a hack. SDO needs to be able to + //go directly to some formats other than streams. They are working + //on stax, but not there yet. + RawByteArrayOutputStream bout = new RawByteArrayOutputStream(); + new XMLHelperImpl(callback.getTypeHelper()).save(obj, + wrapperName.getNamespaceURI(), + wrapperName.getLocalPart(), + bout); + + ByteArrayInputStream bin = new ByteArrayInputStream(bout.getBytes(), + 0, + bout.size()); + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + SAXParser parser = factory.newSAXParser(); + parser.parse(bin, new NodeContentHandler(nd)); + } catch (IOException e) { + throw new WebServiceException(e); + } catch (ParserConfigurationException e) { + throw new WebServiceException(e); + } catch (SAXException e) { + throw new WebServiceException(e); + } + } + + + public static DataObject toWrappedDataObject(TypeHelper typeHelper, + Object ret, + Object[] os, + QName typeQN) { + XSDHelper xsdHelper = new XSDHelperImpl(typeHelper); + Property property = xsdHelper.getGlobalProperty(typeQN.getNamespaceURI(), + typeQN.getLocalPart(), true); + DataObject dataObject = new DataFactoryImpl(typeHelper).create(property.getType()); + List ips = dataObject.getInstanceProperties(); + int offset = 0; + if (ret != null) { + dataObject.set(0, ret); + offset = 1; + } + for (int i = offset; i < ips.size(); i++) { + if (os[i - offset] instanceof Holder) { + Holder holder = (Holder)os[i - offset]; + dataObject.set(i, holder.value); + } else { + dataObject.set(i, os[i - offset]); + } + } + return dataObject; + } + + private class NodeContentHandler extends DefaultHandler { + Node current; + Document doc; + + public NodeContentHandler(Node nd) { + doc = nd.getOwnerDocument(); + if (doc == null && nd instanceof Document) { + doc = (Document)nd; + } + current = nd; + } + + public void characters(char[] ch, int start, int length) { + current.appendChild(doc.createTextNode(new String(ch, start, length))); + } + + public void startElement(String uri, String localName, + String qName, Attributes attributes) { + Element newEl = doc.createElementNS(uri, qName); + current.appendChild(newEl); + current = newEl; + for (int x = 0; x < attributes.getLength(); x++) { + newEl.setAttributeNS(attributes.getURI(x), + attributes.getQName(x), + attributes.getValue(x)); + } + } + + public void endElement(String uri, String localName, String qName) { + current = current.getParentNode(); + } + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/RawByteArrayOutputStream.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/RawByteArrayOutputStream.java new file mode 100644 index 0000000000..902a3e618c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/RawByteArrayOutputStream.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.handler.io; + +import java.io.ByteArrayOutputStream; + +/** + * Just to allow raw access to the byte[] to avoid a copy + */ +class RawByteArrayOutputStream extends ByteArrayOutputStream { + public byte[] getBytes() { + return buf; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java new file mode 100644 index 0000000000..00dc403f2c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCADataBindingCallback.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.handler.io; + + +import org.w3c.dom.Node; +import commonj.sdo.helper.TypeHelper; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.objectweb.celtix.bindings.DataReader; +import org.objectweb.celtix.bindings.DataWriter; +import org.objectweb.celtix.bus.bindings.AbstractWSDLOperationDataBindingCallback; +import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; +import org.objectweb.celtix.context.ObjectMessageContext; + +public class SCADataBindingCallback extends AbstractWSDLOperationDataBindingCallback { + + protected TypeHelper typeHelper; + protected boolean hasInOut; + protected ResourceLoader loader; + + public SCADataBindingCallback(WSDLOperationInfo op, + TypeHelper helper, + ResourceLoader l, + boolean inout) { + super(op); + typeHelper = helper; + hasInOut = inout; + loader = l; + } + + public ResourceLoader getResourceLoader() { + return loader; + } + public ClassLoader getResourceClassLoader() { + return loader.getClassLoader(); + } + + public TypeHelper getTypeHelper() { + return typeHelper; + } + + public boolean hasInOut() { + return hasInOut; + } + + public Mode getMode() { + return Mode.PARTS; + } + + public Class[] getSupportedFormats() { + return new Class[]{Node.class}; + } + + @SuppressWarnings("unchecked") + public DataWriter createWriter(Class cls) { + if (cls == Node.class) { + return (DataWriter)new NodeDataWriter(this); + } + return null; + } + + @SuppressWarnings("unchecked") + public DataReader createReader(Class cls) { + if (cls == Node.class) { + return (DataReader)new NodeDataReader(this); + } + //REVISIT - need to figure out what to do with Faults + return null; + } + + public void initObjectContext(ObjectMessageContext octx) { + //REVISIT - is this even used? + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCAServerDataBindingCallback.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCAServerDataBindingCallback.java new file mode 100644 index 0000000000..5926e066c2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/handler/io/SCAServerDataBindingCallback.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.handler.io; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import commonj.sdo.helper.TypeHelper; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.objectweb.celtix.bindings.ServerDataBindingCallback; +import org.objectweb.celtix.bus.bindings.WSDLOperationInfo; +import org.objectweb.celtix.context.ObjectMessageContext; + +public class SCAServerDataBindingCallback extends SCADataBindingCallback + implements ServerDataBindingCallback { + Method method; + Object targetObject; + + public SCAServerDataBindingCallback(WSDLOperationInfo op, TypeHelper helper, + ResourceLoader l, + boolean inout, Method meth, Object target) { + super(op, helper, l, inout); + method = meth; + targetObject = target; + } + + + public void invoke(ObjectMessageContext octx) throws InvocationTargetException { + Object ret; + try { + ret = method.invoke(targetObject, octx.getMessageObjects()); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new InvocationTargetException(e); + } + octx.setReturn(ret); + } + + public void initObjectContext(ObjectMessageContext octx) { + Object o[] = new Object[method.getParameterTypes().length]; + //REVIST - holders? + octx.setMessageObjects(o); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/TuscanyWSDLManager.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/TuscanyWSDLManager.java new file mode 100644 index 0000000000..913b43cfeb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/TuscanyWSDLManager.java @@ -0,0 +1,88 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.loader; + +import java.io.IOException; +import java.net.URL; + +import javax.wsdl.Definition; +import javax.wsdl.WSDLException; +import javax.wsdl.extensions.ExtensionRegistry; +import javax.wsdl.factory.WSDLFactory; + +import org.w3c.dom.Element; + +import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; + +import org.objectweb.celtix.BusException; +import org.objectweb.celtix.wsdl.WSDLManager; + +public class TuscanyWSDLManager implements WSDLManager { + WSDLDefinitionRegistry wsdlDefinitionRegistry; + + public TuscanyWSDLManager(WSDLDefinitionRegistry w) throws BusException { + wsdlDefinitionRegistry = w; + } + + public WSDLFactory getWSDLFactory() { + //Not supported + return null; + } + + public ExtensionRegistry getExtenstionRegistry() { + return wsdlDefinitionRegistry.getExtensionRegistry(); + } + + public Definition getDefinition(URL url) throws WSDLException { + try { + //FIXME pass the current ResourceLoader + return wsdlDefinitionRegistry.loadDefinition(null, url, null); + } catch (IOException e) { + throw new WSDLException(WSDLException.CONFIGURATION_ERROR, e.getMessage()); + } + } + + public Definition getDefinition(String url) throws WSDLException { + try { + //The namespace is the wsdl targetNamesapce, it is only used + //when the wsdl is created into cache. we are ok here to set it to null. + //FIXME pass the current ResourceLoader + return wsdlDefinitionRegistry.loadDefinition(null, new URL(url), null); + } catch (IOException e) { + throw new WSDLException(WSDLException.CONFIGURATION_ERROR, e.getMessage()); + } + } + + public Definition getDefinition(Element el) throws WSDLException { + //Not supported + return null; + } + + public Definition getDefinition(Class sei) throws WSDLException { + //Not supported + return null; + } + + public void addDefinition(Object key, Definition wsdl) { + //Not supported + } + + public void shutdown() { + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java new file mode 100644 index 0000000000..3520203523 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoader.java @@ -0,0 +1,99 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.loader; + +import java.util.Map; +import java.util.WeakHashMap; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.binding.celtix.assembly.WebServiceAssemblyFactory; +import org.apache.tuscany.binding.celtix.assembly.WebServiceBinding; +import org.apache.tuscany.binding.celtix.assembly.impl.WebServiceAssemblyFactoryImpl; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.StAXElementLoader; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.objectweb.celtix.Bus; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class WebServiceBindingLoader implements StAXElementLoader { + public static final QName BINDING_WS = new QName("http://www.osoa.org/xmlns/sca/0.9", "binding.ws"); + + private static final WebServiceAssemblyFactory WS_FACTORY = new WebServiceAssemblyFactoryImpl(); + + protected StAXLoaderRegistry registry; + protected WSDLDefinitionRegistry wsdlRegistry; + + private Bus bus; + + @Autowire + public void setRegistry(StAXLoaderRegistry reg) { + this.registry = reg; + } + + @Autowire + public void setWsdlRegistry(WSDLDefinitionRegistry wsdlReg) { + try { + Map properties = new WeakHashMap(); + properties.put("celtix.WSDLManager", new TuscanyWSDLManager(wsdlReg)); + bus = Bus.init(new String[0], properties); + wsdlRegistry = wsdlReg; + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Init(eager = true) + public void start() { + registry.registerLoader(BINDING_WS, this); + } + + @Destroy + public void stop() { + try { + registry.unregisterLoader(BINDING_WS, this); + bus.shutdown(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @SuppressWarnings("deprecation") + public WebServiceBinding load(XMLStreamReader reader, LoaderContext loaderContext) + throws XMLStreamException, ConfigurationLoadException { + + WebServiceBinding binding = WS_FACTORY.createWebServiceBinding(wsdlRegistry); + binding.setURI(reader.getAttributeValue(null, "uri")); + binding.setPortURI(reader.getAttributeValue(null, "port")); + binding.setTypeHelper(registry.getContext().getTypeHelper()); + binding.setResourceLoader(loaderContext.getResourceLoader()); + binding.setBus(bus); + return binding; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/system.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/system.fragment new file mode 100644 index 0000000000..2c89c47dd0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/main/resources/system.fragment @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java new file mode 100644 index 0000000000..dc6389ef93 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/assembly/WebServiceAssemblyFactoryTestCase.java @@ -0,0 +1,110 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.assembly; + +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import javax.wsdl.Definition; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; + +import junit.framework.TestCase; + +import org.apache.tuscany.binding.celtix.assembly.impl.WebServiceAssemblyFactoryImpl; +import org.apache.tuscany.binding.celtix.assembly.impl.WebServiceBindingImpl; +import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.easymock.EasyMock; + +public class WebServiceAssemblyFactoryTestCase extends TestCase { + + + private void setupMocks(WSDLDefinitionRegistry reg, + List wsdlList) { + EasyMock.reset(new Object[] {reg}); + + //FIXME pass the current ResourceLoader + reg.getDefinitionsForNamespace("http://objectweb.org/hello_world_soap_http", null); + EasyMock.expectLastCall().andReturn(wsdlList); + + EasyMock.replay(new Object[] {reg}); + } + + public void testCreate() throws Exception { + WSDLDefinitionRegistry reg = EasyMock.createNiceMock(WSDLDefinitionRegistry.class); + + WebServiceAssemblyFactoryImpl impl = new WebServiceAssemblyFactoryImpl(); + WebServiceBinding bind = impl.createWebServiceBinding(reg); + assertNotNull("Did not create the binding", bind); + assertTrue("bind object wrong class: " + bind.getClass(), + bind instanceof WebServiceBindingImpl); + + assertNull("Should be initialized with null WSDL", bind.getWSDLDefinition()); + assertNull("Should be initialized with null port", bind.getWSDLPort()); + assertNull("Should be initialized with null service", bind.getWSDLService()); + assertNull("Should be initialized with null URI", bind.getURI()); + assertNull("Should be initialized with null TypeHelper", + bind.getTypeHelper()); + assertNull("Should be initialized with null ResourceLoader", + bind.getResourceLoader()); + + bind.setURI("http://objectweb.org/hello_world_soap_http"); + bind.setPortURI("http://objectweb.org/hello_world_soap_http#SoapPort"); + + AssemblyContext modelContext = EasyMock.createNiceMock(AssemblyContext.class); + + WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); + reader.setFeature("javax.wsdl.verbose", false); + URL url = getClass().getResource("/wsdl/hello_world.wsdl"); + Definition definition = reader.readWSDL(url.toString()); + + List wsdlList = new ArrayList(); + + setupMocks(reg, wsdlList); + try { + bind.initialize(modelContext); + fail("Should have failed getting the wsdl"); + } catch (IllegalArgumentException ex) { + //expected + } + + setupMocks(reg, wsdlList); + + + wsdlList.add(definition); + bind = impl.createWebServiceBinding(reg); + bind.setURI("http://objectweb.org/hello_world_soap_http"); + bind.setPortURI("http://objectweb.org/hello_world_soap_http#SoapPort"); + bind.initialize(modelContext); + + setupMocks(reg, wsdlList); + + wsdlList.add(definition); + bind = impl.createWebServiceBinding(reg); + bind.setURI("http://objectweb.org/hello_world_soap_http"); + bind.setPortURI("http://objectweb.org/hello_world_soap_http#FooPort"); + + try { + bind.initialize(modelContext); + fail("Should have failed finding the port"); + } catch (IllegalArgumentException ex) { + //expected + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java new file mode 100644 index 0000000000..be4d910069 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/handler/io/NodeDataWriterTestCase.java @@ -0,0 +1,103 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.handler.io; + +import java.net.URL; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + + +import commonj.sdo.helper.TypeHelper; + +import junit.framework.TestCase; + +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.objectweb.celtix.bindings.DataReader; +import org.objectweb.celtix.bindings.DataWriter; +import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache; +import org.objectweb.celtix.context.ObjectMessageContext; +import org.objectweb.celtix.context.ObjectMessageContextImpl; + + + +public class NodeDataWriterTestCase extends TestCase { + + private TypeHelper typeHelper; + + protected void setUp() throws Exception { + super.setUp(); + DataObjectUtil.initRuntime(); + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); + typeHelper = SDOUtil.createTypeHelper(); + URL url = getClass().getResource("/wsdl/hello_world.wsdl"); + new XSDHelperImpl(typeHelper).define(url.openStream(), null); + } finally { + Thread.currentThread().setContextClassLoader(cl); + } + + + } + + public void testWriteWrapper() throws Exception { + WSDLReader wreader = WSDLFactory.newInstance().newWSDLReader(); + wreader.setFeature("javax.wsdl.verbose", false); + URL url = getClass().getResource("/wsdl/hello_world.wsdl"); + Definition definition = wreader.readWSDL(url.toString()); + Port port = definition.getService(new QName("http://objectweb.org/hello_world_soap_http", + "SOAPService")).getPort("SoapPort"); + + WSDLMetaDataCache wsdlCache = new WSDLMetaDataCache(definition, + port); + + + ResourceLoaderImpl loader = new ResourceLoaderImpl(getClass().getClassLoader()); + SCADataBindingCallback callback = new SCADataBindingCallback(wsdlCache.getOperationInfo("greetMe"), + typeHelper, + loader, + false); + + DataWriter writer = callback.createWriter(Node.class); + Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Element element = doc.createElement("ROOT"); + + ObjectMessageContext objCtx = new ObjectMessageContextImpl(); + objCtx.setMessageObjects(new Object[] {"Hello"}); + writer.writeWrapper(objCtx , false, element); + + assertEquals("Value not written", "Hello", element.getFirstChild().getTextContent().trim()); + + DataReader reader = callback.createReader(Node.class); + reader.readWrapper(objCtx , true, element); + + assertEquals("Hello", objCtx.getReturn()); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java new file mode 100644 index 0000000000..a27d866191 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/loader/WebServiceBindingLoaderTestCase.java @@ -0,0 +1,54 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.celtix.loader; + +import javax.xml.stream.XMLStreamReader; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.easymock.EasyMock; + +public class WebServiceBindingLoaderTestCase extends TestCase { + + @SuppressWarnings("deprecation") + public void testLoad() throws Exception { + + WebServiceBindingLoader loader = new WebServiceBindingLoader(); + StAXLoaderRegistry reg = EasyMock.createNiceMock(StAXLoaderRegistry.class); + reg.getContext(); + EasyMock.expectLastCall().andReturn(EasyMock.createNiceMock(AssemblyContext.class)); + EasyMock.replay(reg); + + loader.setRegistry(reg); + + XMLStreamReader reader = EasyMock.createNiceMock(XMLStreamReader.class); + reader.getAttributeValue(null, "uri"); + EasyMock.expectLastCall().andReturn("http://objectweb.org/hello_world_soap_http"); + reader.getAttributeValue(null, "port"); + EasyMock.expectLastCall().andReturn("SoapPort"); + EasyMock.replay(reader); + + LoaderContext loaderContext = new LoaderContext(null); + + assertNotNull("Did not load binding", loader.load(reader, loaderContext)); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world.wsdl new file mode 100644 index 0000000000..a1d40daf26 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world.wsdl @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/pom.xml new file mode 100644 index 0000000000..a97f09375a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/pom.xml @@ -0,0 +1,79 @@ + + + + + + org.apache.tuscany.sca.bindings + tuscany-sca-bindings + incubating-M1 + + + 4.0.0 + tuscany-binding-jsonrpc + Tuscany JSON-RPC Binding + Implementation of an SCA JSON-RPC binding + incubating-M1 + + + + ant + http://people.apache.org/~antelder/maven2 + + true + + + + + + + org.apache.tuscany + tuscany-core + ${pom.version} + compile + + + + org.apache.tuscany + tuscany-tomcat + ${pom.version} + provided + + + + metaparadigm + jsonrpc + 1.0 + provided + + + + tomcat + servlet-api + 5.0.18 + provided + + + + junit + junit + 3.8.1 + test + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/assembly/JSONRPCBinding.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/assembly/JSONRPCBinding.java new file mode 100644 index 0000000000..3629bbe98c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/assembly/JSONRPCBinding.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.assembly; + +import org.apache.tuscany.model.assembly.impl.BindingImpl; + +/** + * An Binding implementation for JSON-RPC. + */ +public class JSONRPCBinding extends BindingImpl { + + private String webAppName; + + public JSONRPCBinding() { + } + + public void setWebAppName(String webAppName) { + this.webAppName = webAppName; + } + + public String getWebAppName() { + return webAppName; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java new file mode 100644 index 0000000000..b0725c464b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/builder/JSONRPCEntryPointBuilder.java @@ -0,0 +1,41 @@ +/** + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.builder; + +import org.apache.tuscany.binding.jsonrpc.assembly.JSONRPCBinding; +import org.apache.tuscany.binding.jsonrpc.config.JSONEntryPointContextFactory; +import org.apache.tuscany.core.extension.EntryPointBuilderSupport; +import org.apache.tuscany.core.extension.EntryPointContextFactory; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.webapp.ServletHost; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.osoa.sca.annotations.Scope; + +@Scope("MODULE") +public class JSONRPCEntryPointBuilder extends EntryPointBuilderSupport { + + private ServletHost tomcatHost; + + @Autowire + public void setTomcatHost(ServletHost tomcatHost) { + this.tomcatHost = tomcatHost; + } + + @Override + protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) { + String webAppName = ((JSONRPCBinding) entryPoint.getBindings().get(0)).getWebAppName(); + return new JSONEntryPointContextFactory(entryPoint.getName(), msgFactory, webAppName, tomcatHost); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/config/JSONEntryPointContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/config/JSONEntryPointContextFactory.java new file mode 100644 index 0000000000..7c36f83e6b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/config/JSONEntryPointContextFactory.java @@ -0,0 +1,60 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.config; + +import org.apache.tuscany.binding.jsonrpc.handler.JSONRPCEntryPointServlet; +import org.apache.tuscany.binding.jsonrpc.handler.ScriptGetterServlet; +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.extension.EntryPointContextFactory; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.webapp.ServletHost; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class JSONEntryPointContextFactory extends EntryPointContextFactory { + + private ServletHost tomcatHost; + + private String webAppName; + + public JSONEntryPointContextFactory(String name, MessageFactory msgFactory, String webAppName, ServletHost tomcatHost) { + super(name, msgFactory); + this.webAppName = webAppName; + this.tomcatHost = tomcatHost; + } + + public EntryPointContext createContext() throws ContextCreationException { + EntryPointContext epc = super.createContext(); + JSONRPCEntryPointServlet jsonrpcServlet = getServlet(); + jsonrpcServlet.addEntryPoint(epc); + return epc; + } + + private JSONRPCEntryPointServlet getServlet() { + String jsonrpcServletMapping = webAppName + "/SCA/jsonrpc"; + JSONRPCEntryPointServlet servlet; + synchronized (tomcatHost) { + servlet = (JSONRPCEntryPointServlet) tomcatHost.getMapping(jsonrpcServletMapping); + if (servlet == null) { + servlet = new JSONRPCEntryPointServlet(); + tomcatHost.registerMapping(jsonrpcServletMapping, servlet); + tomcatHost.registerMapping(webAppName + "/SCA/scripts/*", new ScriptGetterServlet()); + } + } + return servlet; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServlet.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServlet.java new file mode 100644 index 0000000000..f59867b725 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServlet.java @@ -0,0 +1,76 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tuscany.binding.jsonrpc.handler; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.tuscany.core.context.EntryPointContext; + +import com.metaparadigm.jsonrpc.JSONRPCBridge; +import com.metaparadigm.jsonrpc.JSONRPCServlet; + +/** + * + * + */ +public class JSONRPCEntryPointServlet extends JSONRPCServlet { + private static final long serialVersionUID = 1L; + + private transient List entryPoints; + + public JSONRPCEntryPointServlet() { + entryPoints = new ArrayList(); + } + + /* + * (non-Javadoc) + * + * @see com.metaparadigm.jsonrpc.JSONRPCServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + public void service(HttpServletRequest request, HttpServletResponse response) throws IOException, ClassCastException { + + /* + * Create a new bridge for every request to aviod all the problems with JSON-RPC-Java storing the bridge in the session + */ + HttpSession session = request.getSession(); + try { + + JSONRPCBridge jsonrpcBridge = new JSONRPCBridge(); + for (EntryPointContext epc : entryPoints) { + jsonrpcBridge.registerObject(epc.getName(), epc.getInstance(null)); + } + session.setAttribute("JSONRPCBridge", jsonrpcBridge); + + super.service(request, response); + + } finally { + session.removeAttribute("JSONRPCBridge"); + } + } + + public void addEntryPoint(EntryPointContext epc) { + entryPoints.add(epc); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/ScriptGetterServlet.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/ScriptGetterServlet.java new file mode 100644 index 0000000000..9177462de0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/ScriptGetterServlet.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.handler; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ScriptGetterServlet extends HttpServlet { + + private static final long serialVersionUID = 1L; + + private static final String SCA_INIT_JS = "SCA = new JSONRpcClient(\"SCA/jsonrpc\");"; + + public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { + URL url = getClass().getResource("jsonrpc.js"); + InputStream is = url.openStream(); + writeToStream(response, is); + + writeToStream(response, new ByteArrayInputStream(SCA_INIT_JS.getBytes())); + } + + private void writeToStream(HttpServletResponse response, InputStream is) throws IOException { + ServletOutputStream os = response.getOutputStream(); + int i; + while ((i = is.read()) != -1) { + os.write(i); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/loader/JSONRPCBindingLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/loader/JSONRPCBindingLoader.java new file mode 100644 index 0000000000..64cefc9ea3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/loader/JSONRPCBindingLoader.java @@ -0,0 +1,65 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.loader; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.binding.jsonrpc.assembly.JSONRPCBinding; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.StAXElementLoader; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class JSONRPCBindingLoader implements StAXElementLoader { + + public static final QName BINDING_JSONRPC = new QName("http://org.apache.tuscany/xmlns/jsonrpc/0.9", "binding.jsonrpc"); + + protected StAXLoaderRegistry registry; + + @Autowire + public void setRegistry(StAXLoaderRegistry registry) { + this.registry = registry; + } + + @Init(eager = true) + public void start() { + registry.registerLoader(BINDING_JSONRPC, this); + } + + @Destroy + public void stop() { + registry.unregisterLoader(BINDING_JSONRPC, this); + } + + @SuppressWarnings("deprecation") + public JSONRPCBinding load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + JSONRPCBinding binding = new JSONRPCBinding(); + binding.setURI(reader.getAttributeValue(null, "uri")); + binding.setWebAppName(registry.getContext().getWebAppName()); + return binding; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/org/apache/tuscany/binding/jsonrpc/handler/jsonrpc.js b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/org/apache/tuscany/binding/jsonrpc/handler/jsonrpc.js new file mode 100644 index 0000000000..2b9efbb55c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/org/apache/tuscany/binding/jsonrpc/handler/jsonrpc.js @@ -0,0 +1,484 @@ +/* + * JSON-RPC JavaScript client + * + * $Id: jsonrpc.js,v 1.36.2.3 2006/03/08 15:09:37 mclark Exp $ + * + * Copyright (c) 2003-2004 Jan-Klaas Kollhof + * Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd + * + * This code is based on Jan-Klaas' JavaScript o lait library (jsolait). + * + * 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. + * + */ + + +/* escape a character */ + +escapeJSONChar = +function escapeJSONChar(c) +{ + if(c == "\"" || c == "\\") return "\\" + c; + else if (c == "\b") return "\\b"; + else if (c == "\f") return "\\f"; + else if (c == "\n") return "\\n"; + else if (c == "\r") return "\\r"; + else if (c == "\t") return "\\t"; + var hex = c.charCodeAt(0).toString(16); + if(hex.length == 1) return "\\u000" + hex; + else if(hex.length == 2) return "\\u00" + hex; + else if(hex.length == 3) return "\\u0" + hex; + else return "\\u" + hex; +}; + + +/* encode a string into JSON format */ + +escapeJSONString = +function escapeJSONString(s) +{ + /* The following should suffice but Safari's regex is b0rken + (doesn't support callback substitutions) + return "\"" + s.replace(/([^\u0020-\u007f]|[\\\"])/g, + escapeJSONChar) + "\""; + */ + + /* Rather inefficient way to do it */ + var parts = s.split(""); + for(var i=0; i < parts.length; i++) { + var c =parts[i]; + if(c == '"' || + c == '\\' || + c.charCodeAt(0) < 32 || + c.charCodeAt(0) >= 128) + parts[i] = escapeJSONChar(parts[i]); + } + return "\"" + parts.join("") + "\""; +}; + + +/* Marshall objects to JSON format */ + +toJSON = function toJSON(o) +{ + if(o == null) { + return "null"; + } else if(o.constructor == String) { + return escapeJSONString(o); + } else if(o.constructor == Number) { + return o.toString(); + } else if(o.constructor == Boolean) { + return o.toString(); + } else if(o.constructor == Date) { + return '{javaClass: "java.util.Date", time: ' + o.valueOf() +'}'; + } else if(o.constructor == Array) { + var v = []; + for(var i = 0; i < o.length; i++) v.push(toJSON(o[i])); + return "[" + v.join(", ") + "]"; + } else { + var v = []; + for(attr in o) { + if(o[attr] == null) v.push("\"" + attr + "\": null"); + else if(typeof o[attr] == "function"); /* skip */ + else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr])); + } + return "{" + v.join(", ") + "}"; + } +}; + + +/* JSONRpcClient constructor */ + +JSONRpcClient = +function JSONRpcClient_ctor(serverURL, user, pass, objectID) +{ + this.serverURL = serverURL; + this.user = user; + this.pass = pass; + this.objectID = objectID; + + /* Add standard methods */ + if(this.objectID) { + this._addMethods(["listMethods"]); + var req = this._makeRequest("listMethods", []); + } else { + this._addMethods(["system.listMethods"]); + var req = this._makeRequest("system.listMethods", []); + } + var m = this._sendRequest(req); + this._addMethods(m); +}; + + +/* JSONRpcCLient.Exception */ + +JSONRpcClient.Exception = +function JSONRpcClient_Exception_ctor(code, message, javaStack) +{ + this.code = code; + var name; + if(javaStack) { + this.javaStack = javaStack; + var m = javaStack.match(/^([^:]*)/); + if(m) name = m[0]; + } + if(name) this.name = name; + else this.name = "JSONRpcClientException"; + this.message = message; +}; + +JSONRpcClient.Exception.CODE_REMOTE_EXCEPTION = 490; +JSONRpcClient.Exception.CODE_ERR_CLIENT = 550; +JSONRpcClient.Exception.CODE_ERR_PARSE = 590; +JSONRpcClient.Exception.CODE_ERR_NOMETHOD = 591; +JSONRpcClient.Exception.CODE_ERR_UNMARSHALL = 592; +JSONRpcClient.Exception.CODE_ERR_MARSHALL = 593; + +JSONRpcClient.Exception.prototype = new Error(); + +JSONRpcClient.Exception.prototype.toString = +function JSONRpcClient_Exception_toString(code, msg) +{ + return this.name + ": " + this.message; +}; + + +/* Default top level exception handler */ + +JSONRpcClient.default_ex_handler = +function JSONRpcClient_default_ex_handler(e) { alert(e); }; + + +/* Client settable variables */ + +JSONRpcClient.toplevel_ex_handler = JSONRpcClient.default_ex_handler; +JSONRpcClient.profile_async = false; +JSONRpcClient.max_req_active = 1; +JSONRpcClient.requestId = 1; + + +/* JSONRpcClient implementation */ + +JSONRpcClient.prototype._createMethod = +function JSONRpcClient_createMethod(methodName) +{ + var fn=function() + { + var args = []; + var callback = null; + for(var i=0;i 0) { + var res = JSONRpcClient.async_responses.shift(); + if(res.canceled) continue; + if(res.profile) res.profile.dispatch = new Date(); + try { + res.cb(res.result, res.ex, res.profile); + } catch(e) { + JSONRpcClient.toplevel_ex_handler(e); + } + } + + while(JSONRpcClient.async_requests.length > 0 && + JSONRpcClient.num_req_active < JSONRpcClient.max_req_active) { + var req = JSONRpcClient.async_requests.shift(); + if(req.canceled) continue; + req.client._sendRequest.call(req.client, req); + } +}; + +JSONRpcClient.kick_async = +function JSONRpcClient_kick_async() +{ + if(JSONRpcClient.async_timeout == null) + JSONRpcClient.async_timeout = + setTimeout(JSONRpcClient._async_handler, 0); +}; + +JSONRpcClient.cancelRequest = +function JSONRpcClient_cancelRequest(requestId) +{ + /* If it is in flight then mark it as canceled in the inflight map + and the XMLHttpRequest callback will discard the reply. */ + if(JSONRpcClient.async_inflight[requestId]) { + JSONRpcClient.async_inflight[requestId].canceled = true; + return true; + } + + /* If its not in flight yet then we can just mark it as canceled in + the the request queue and it will get discarded before being sent. */ + for(var i in JSONRpcClient.async_requests) { + if(JSONRpcClient.async_requests[i].requestId == requestId) { + JSONRpcClient.async_requests[i].canceled = true; + return true; + } + } + + /* It may have returned from the network and be waiting for its callback + to be dispatched, so mark it as canceled in the response queue + and the response will get discarded before calling the callback. */ + for(var i in JSONRpcClient.async_responses) { + if(JSONRpcClient.async_responses[i].requestId == requestId) { + JSONRpcClient.async_responses[i].canceled = true; + return true; + } + } + + return false; +}; + +JSONRpcClient.prototype._makeRequest = +function JSONRpcClient_makeRequest(methodName, args, cb) +{ + var req = {}; + req.client = this; + req.requestId = JSONRpcClient.requestId++; + + var obj = {}; + obj.id = req.requestId; + if (this.objectID) + obj.method = ".obj#" + this.objectID + "." + methodName; + else + obj.method = methodName; + obj.params = args; + + if (cb) req.cb = cb; + if (JSONRpcClient.profile_async) + req.profile = { "submit": new Date() }; + req.data = toJSON(obj); + + return req; +}; + +JSONRpcClient.prototype._sendRequest = +function JSONRpcClient_sendRequest(req) +{ + if(req.profile) req.profile.start = new Date(); + + /* Get free http object from the pool */ + var http = JSONRpcClient.poolGetHTTPRequest(); + JSONRpcClient.num_req_active++; + + /* Send the request */ + if (typeof(this.user) == "undefined") { + http.open("POST", this.serverURL, (req.cb != null)); + } else { + http.open("POST", this.serverURL, (req.cb != null), this.user, this.pass); + } + + /* setRequestHeader is missing in Opera 8 Beta */ + try { http.setRequestHeader("Content-type", "text/plain"); } catch(e) {} + + /* Construct call back if we have one */ + if(req.cb) { + var self = this; + http.onreadystatechange = function() { + if(http.readyState == 4) { + http.onreadystatechange = function () {}; + var res = { "cb": req.cb, "result": null, "ex": null}; + if (req.profile) { + res.profile = req.profile; + res.profile.end = new Date(); + } + try { res.result = self._handleResponse(http); } + catch(e) { res.ex = e; } + if(!JSONRpcClient.async_inflight[req.requestId].canceled) + JSONRpcClient.async_responses.push(res); + delete JSONRpcClient.async_inflight[req.requestId]; + JSONRpcClient.kick_async(); + } + }; + } else { + http.onreadystatechange = function() {}; + } + + JSONRpcClient.async_inflight[req.requestId] = req; + + try { + http.send(req.data); + } catch(e) { + JSONRpcClient.poolReturnHTTPRequest(http); + JSONRpcClient.num_req_active--; + throw new JSONRpcClient.Exception + (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed"); + } + + if(!req.cb) return this._handleResponse(http); +}; + +JSONRpcClient.prototype._handleResponse = +function JSONRpcClient_handleResponse(http) +{ + /* Get the charset */ + if(!this.charset) { + this.charset = JSONRpcClient._getCharsetFromHeaders(http); + } + + /* Get request results */ + var status, statusText, data; + try { + status = http.status; + statusText = http.statusText; + data = http.responseText; + } catch(e) { + JSONRpcClient.poolReturnHTTPRequest(http); + JSONRpcClient.num_req_active--; + JSONRpcClient.kick_async(); + throw new JSONRpcClient.Exception + (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed"); + } + + /* Return http object to the pool; */ + JSONRpcClient.poolReturnHTTPRequest(http); + JSONRpcClient.num_req_active--; + + /* Unmarshall the response */ + if(status != 200) { + throw new JSONRpcClient.Exception(status, statusText); + } + var obj; + try { + eval("obj = " + data); + } catch(e) { + throw new JSONRpcClient.Exception(550, "error parsing result"); + } + if(obj.error) + throw new JSONRpcClient.Exception(obj.error.code, obj.error.msg, + obj.error.trace); + var res = obj.result; + + /* Handle CallableProxy */ + if(res && res.objectID && res.JSONRPCType == "CallableReference") + return new JSONRpcClient(this.serverURL, this.user, + this.pass, res.objectID); + + return res; +}; + + +/* XMLHttpRequest wrapper code */ + +/* XMLHttpRequest pool globals */ +JSONRpcClient.http_spare = []; +JSONRpcClient.http_max_spare = 8; + +JSONRpcClient.poolGetHTTPRequest = +function JSONRpcClient_pool_getHTTPRequest() +{ + if(JSONRpcClient.http_spare.length > 0) { + return JSONRpcClient.http_spare.pop(); + } + return JSONRpcClient.getHTTPRequest(); +}; + +JSONRpcClient.poolReturnHTTPRequest = +function JSONRpcClient_poolReturnHTTPRequest(http) +{ + if(JSONRpcClient.http_spare.length >= JSONRpcClient.http_max_spare) + delete http; + else + JSONRpcClient.http_spare.push(http); +}; + +JSONRpcClient.msxmlNames = [ "MSXML2.XMLHTTP.5.0", + "MSXML2.XMLHTTP.4.0", + "MSXML2.XMLHTTP.3.0", + "MSXML2.XMLHTTP", + "Microsoft.XMLHTTP" ]; + +JSONRpcClient.getHTTPRequest = +function JSONRpcClient_getHTTPRequest() +{ + /* Mozilla XMLHttpRequest */ + try { + JSONRpcClient.httpObjectName = "XMLHttpRequest"; + return new XMLHttpRequest(); + } catch(e) {} + + /* Microsoft MSXML ActiveX */ + for (var i=0;i < JSONRpcClient.msxmlNames.length; i++) { + try { + JSONRpcClient.httpObjectName = JSONRpcClient.msxmlNames[i]; + return new ActiveXObject(JSONRpcClient.msxmlNames[i]); + } catch (e) {} + } + + /* None found */ + JSONRpcClient.httpObjectName = null; + throw new JSONRpcClient.Exception(0, "Can't create XMLHttpRequest object"); +}; + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/system.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/system.fragment new file mode 100644 index 0000000000..ee3078a39f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/main/resources/system.fragment @@ -0,0 +1,28 @@ + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServletTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServletTestCase.java new file mode 100644 index 0000000000..bbf2ff4397 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServletTestCase.java @@ -0,0 +1,80 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.handler; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import junit.framework.TestCase; + +import org.apache.tuscany.binding.jsonrpc.mocks.MockConfigUtils; +import org.apache.tuscany.binding.jsonrpc.mocks.servlet.MockHttpServletRequest; +import org.apache.tuscany.binding.jsonrpc.mocks.servlet.MockHttpServletResponse; + +public class JSONRPCEntryPointServletTestCase extends TestCase { + + private static final String JSON_REQUEST = "{\"id\": 2, \"method\": \"MyEntryPoint.concat\", \"params\": [\" world\"]}"; + + private static final String JSON_RESPONSE = "{\"result\":\"hello world\",\"id\":2}"; + + public void testService() throws ServletException, ClassCastException, IOException { +// JSONRPCEntryPointServlet servlet = new JSONRPCEntryPointServlet("MyEntryPoint", "hello"); +// ServletConfig servletConfig = MockConfigUtils.createMockServletConfig("MyEntryPoint", "hello"); +// servlet.init(servletConfig); +// +// HttpServletRequest request = new MockHttpServletRequest(JSON_REQUEST.getBytes()); +// ByteArrayOutputStream os = new ByteArrayOutputStream(); +// HttpServletResponse response = new MockHttpServletResponse(os); +// +// servlet.service(request, response); +// +// String responseString = new String(os.toByteArray()); +// assertEquals(JSON_RESPONSE, responseString); + } + + public void testInit() throws ServletException { +// JSONRPCEntryPointServlet servlet = new JSONRPCEntryPointServlet("MyEntryPoint", "hello"); +// ServletConfig servletConfig = MockConfigUtils.createMockServletConfig("MyEntryPoint", "hello"); +// +// servlet.init(servletConfig); +// +// assertEquals("MyEntryPoint", servlet.getEntryPointName()); +// assertEquals("hello", servlet.getEntryPointProxy()); + } + +// public void testHasJSONRPCBinding() { +// JSONRPCEntryPointServlet servlet = new JSONRPCEntryPointServlet("MyEntryPoint", "hello"); +// +// EntryPoint entryPoint = MockConfigUtils.createMockEntryPoint("MyEntryPoint"); +// assertFalse(servlet.hasJSONRPCBinding(entryPoint)); +// +// MockConfigUtils.addNonJSONRPCBinding(entryPoint); +// assertFalse(servlet.hasJSONRPCBinding(entryPoint)); +// +// MockConfigUtils.addJSONRPCBinding(entryPoint); +// assertTrue(servlet.hasJSONRPCBinding(entryPoint)); +// +// assertEquals(2, entryPoint.getBindings().size()); +// +// } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/MockConfigUtils.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/MockConfigUtils.java new file mode 100644 index 0000000000..b36330aa19 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/MockConfigUtils.java @@ -0,0 +1,88 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.mocks; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; + +import org.apache.tuscany.binding.jsonrpc.assembly.JSONRPCBinding; +import org.apache.tuscany.binding.jsonrpc.mocks.servlet.MockServletConfig; +import org.apache.tuscany.binding.jsonrpc.mocks.tuscany.MockBinding; +import org.apache.tuscany.binding.jsonrpc.mocks.tuscany.MockCompositeContextImpl; +import org.apache.tuscany.binding.jsonrpc.mocks.tuscany.MockEntryPointContext; +import org.apache.tuscany.binding.jsonrpc.mocks.tuscany.MockScopeContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.webapp.TuscanyServletListener; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.impl.EntryPointImpl; + +public class MockConfigUtils { + + public static ServletConfig createMockServletConfig(String entryPointName, Object instance) { + ServletConfig servletConfig = new MockServletConfig(); + ServletContext context = servletConfig.getServletContext(); + context.setAttribute(TuscanyServletListener.MODULE_COMPONENT_NAME, createModuleWithJSONRPCEntryPoint(entryPointName, instance)); + return servletConfig; + } + + public static CompositeContext createModuleWithJSONRPCEntryPoint(String entryPointName, Object instance) { + MockCompositeContextImpl cci = new MockCompositeContextImpl(); + Module module = (Module) cci.getComposite(); + List entryPoints = module.getEntryPoints(); + EntryPoint ep = createMockEntryPoint(entryPointName); + addJSONRPCBinding(ep); + entryPoints.add(ep); + cci.start(); + + Map ics = new HashMap(); + ics.put(entryPointName, new MockEntryPointContext(instance)); + + ScopeContext sc = new MockScopeContext(ics); + sc.start(); + + Map scopeIndex = cci.getScopeIndex(); + scopeIndex.put(entryPointName, sc); + + return cci; + } + + public static EntryPoint createMockEntryPoint(String name) { + EntryPoint entryPoint = new EntryPointImpl() { + }; + entryPoint.setName(name); + return entryPoint; + } + + public static void addJSONRPCBinding(EntryPoint entryPoint) { + List bindings = entryPoint.getBindings(); + bindings.add(new JSONRPCBinding()); + } + + public static void addNonJSONRPCBinding(EntryPoint entryPoint) { + List bindings = entryPoint.getBindings(); + bindings.add(new MockBinding()); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletRequest.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletRequest.java new file mode 100644 index 0000000000..707268ec00 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletRequest.java @@ -0,0 +1,263 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.mocks.servlet; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.Principal; +import java.util.Enumeration; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletInputStream; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +public class MockHttpServletRequest implements HttpServletRequest { + + private byte[] inputBytes; + + public MockHttpServletRequest(byte[] inputBytes) { + this.inputBytes = inputBytes; + } + + public String getAuthType() { + return null; + } + + public Cookie[] getCookies() { + return null; + } + + public long getDateHeader(String arg0) { + return 0; + } + + public String getHeader(String arg0) { + return null; + } + + public Enumeration getHeaders(String arg0) { + return null; + } + + public Enumeration getHeaderNames() { + return null; + } + + public int getIntHeader(String arg0) { + return 0; + } + + public String getMethod() { + return null; + } + + public String getPathInfo() { + return null; + } + + public String getPathTranslated() { + return null; + } + + public String getContextPath() { + return null; + } + + public String getQueryString() { + return null; + } + + public String getRemoteUser() { + return null; + } + + public boolean isUserInRole(String arg0) { + return false; + } + + public Principal getUserPrincipal() { + return null; + } + + public String getRequestedSessionId() { + return null; + } + + public String getRequestURI() { + return null; + } + + public StringBuffer getRequestURL() { + return null; + } + + public String getServletPath() { + return null; + } + + public HttpSession getSession(boolean arg0) { + return null; + } + + HttpSession session = new MockHttpSession(); + + public HttpSession getSession() { + return session; + } + + public boolean isRequestedSessionIdValid() { + return false; + } + + public boolean isRequestedSessionIdFromCookie() { + return false; + } + + public boolean isRequestedSessionIdFromURL() { + return false; + } + + public boolean isRequestedSessionIdFromUrl() { + return false; + } + + public Object getAttribute(String arg0) { + return null; + } + + public Enumeration getAttributeNames() { + return null; + } + + public String getCharacterEncoding() { + return null; + } + + public void setCharacterEncoding(String arg0) throws UnsupportedEncodingException { + } + + public int getContentLength() { + return 0; + } + + public String getContentType() { + return null; + } + + public ServletInputStream getInputStream() throws IOException { + final ByteArrayInputStream is = new ByteArrayInputStream(inputBytes); + ServletInputStream sis = new ServletInputStream() { + @Override + public int read() throws IOException { + return is.read(); + } + }; + return sis; + } + + public String getParameter(String arg0) { + return null; + } + + public Enumeration getParameterNames() { + return null; + } + + public String[] getParameterValues(String arg0) { + return null; + } + + public Map getParameterMap() { + return null; + } + + public String getProtocol() { + return null; + } + + public String getScheme() { + return null; + } + + public String getServerName() { + return null; + } + + public int getServerPort() { + return 0; + } + + public BufferedReader getReader() throws IOException { + return null; + } + + public String getRemoteAddr() { + return null; + } + + public String getRemoteHost() { + return null; + } + + public void setAttribute(String arg0, Object arg1) { + } + + public void removeAttribute(String arg0) { + } + + public Locale getLocale() { + return null; + } + + public Enumeration getLocales() { + return null; + } + + public boolean isSecure() { + return false; + } + + public RequestDispatcher getRequestDispatcher(String arg0) { + return null; + } + + public String getRealPath(String arg0) { + return null; + } + + public int getRemotePort() { + return 0; + } + + public String getLocalName() { + return null; + } + + public String getLocalAddr() { + return null; + } + + public int getLocalPort() { + return 0; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletResponse.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletResponse.java new file mode 100644 index 0000000000..f8aaceff33 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpServletResponse.java @@ -0,0 +1,180 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.mocks.servlet; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Locale; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; + +public class MockHttpServletResponse implements HttpServletResponse { + + ByteArrayOutputStream outputStream; + + public MockHttpServletResponse(ByteArrayOutputStream outputStream) { + this.outputStream = outputStream; + } + + public void addCookie(Cookie arg0) { + + } + + public boolean containsHeader(String arg0) { + + return false; + } + + public String encodeURL(String arg0) { + + return null; + } + + public String encodeRedirectURL(String arg0) { + + return null; + } + + public String encodeUrl(String arg0) { + + return null; + } + + public String encodeRedirectUrl(String arg0) { + + return null; + } + + public void sendError(int arg0, String arg1) throws IOException { + + } + + public void sendError(int arg0) throws IOException { + + } + + public void sendRedirect(String arg0) throws IOException { + + } + + public void setDateHeader(String arg0, long arg1) { + + } + + public void addDateHeader(String arg0, long arg1) { + + } + + public void setHeader(String arg0, String arg1) { + + } + + public void addHeader(String arg0, String arg1) { + + } + + public void setIntHeader(String arg0, int arg1) { + + } + + public void addIntHeader(String arg0, int arg1) { + + } + + public void setStatus(int arg0) { + + } + + public void setStatus(int arg0, String arg1) { + + } + + public String getCharacterEncoding() { + + return null; + } + + public String getContentType() { + + return null; + } + + public ServletOutputStream getOutputStream() throws IOException { + ServletOutputStream sos = new ServletOutputStream() { + @Override + public void write(int arg0) throws IOException { + outputStream.write(arg0); + } + }; + return sos; + } + + public PrintWriter getWriter() throws IOException { + + return null; + } + + public void setCharacterEncoding(String arg0) { + + } + + public void setContentLength(int arg0) { + + } + + public void setContentType(String arg0) { + + } + + public void setBufferSize(int arg0) { + + } + + public int getBufferSize() { + + return 0; + } + + public void flushBuffer() throws IOException { + + } + + public void resetBuffer() { + + } + + public boolean isCommitted() { + + return false; + } + + public void reset() { + + } + + public void setLocale(Locale arg0) { + + } + + public Locale getLocale() { + + return null; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpSession.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpSession.java new file mode 100644 index 0000000000..542269c52f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockHttpSession.java @@ -0,0 +1,93 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.mocks.servlet; + +import java.util.Enumeration; +import java.util.HashMap; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpSession; + +public class MockHttpSession implements HttpSession { + + public long getCreationTime() { + return 0; + } + + public String getId() { + return null; + } + + public long getLastAccessedTime() { + return 0; + } + + public ServletContext getServletContext() { + return null; + } + + public void setMaxInactiveInterval(int arg0) { + } + + public int getMaxInactiveInterval() { + return 0; + } + + @SuppressWarnings("deprecation") + public javax.servlet.http.HttpSessionContext getSessionContext() { + return null; + } + + public Object getAttribute(String arg0) { + return attributes.get(arg0); + } + + public Object getValue(String arg0) { + return null; + } + + public Enumeration getAttributeNames() { + return null; + } + + public String[] getValueNames() { + return null; + } + + HashMap attributes = new HashMap(); + + public void setAttribute(String arg0, Object arg1) { + attributes.put(arg0, arg1); + } + + public void putValue(String arg0, Object arg1) { + } + + public void removeAttribute(String arg0) { + } + + public void removeValue(String arg0) { + } + + public void invalidate() { + } + + public boolean isNew() { + return false; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletConfig.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletConfig.java new file mode 100644 index 0000000000..0ece32ca4a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletConfig.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.mocks.servlet; + +import java.util.Enumeration; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; + +public class MockServletConfig implements ServletConfig { + + public String getServletName() { + return null; + } + + ServletContext servletContext = new MockServletContext(); + + public ServletContext getServletContext() { + return servletContext; + } + + public String getInitParameter(String arg0) { + return null; + } + + public Enumeration getInitParameterNames() { + return null; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletContext.java new file mode 100644 index 0000000000..1d9189805d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/servlet/MockServletContext.java @@ -0,0 +1,148 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.mocks.servlet; + +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Set; + +import javax.servlet.RequestDispatcher; +import javax.servlet.Servlet; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; + +public class MockServletContext implements ServletContext { + + public ServletContext getContext(String arg0) { + + return null; + } + + public int getMajorVersion() { + + return 0; + } + + public int getMinorVersion() { + + return 0; + } + + public String getMimeType(String arg0) { + + return null; + } + + public Set getResourcePaths(String arg0) { + + return null; + } + + public URL getResource(String arg0) throws MalformedURLException { + + return null; + } + + public InputStream getResourceAsStream(String arg0) { + + return null; + } + + public RequestDispatcher getRequestDispatcher(String arg0) { + + return null; + } + + public RequestDispatcher getNamedDispatcher(String arg0) { + + return null; + } + + public Servlet getServlet(String arg0) throws ServletException { + + return null; + } + + public Enumeration getServlets() { + + return null; + } + + public Enumeration getServletNames() { + + return null; + } + + public void log(String arg0) { + + } + + public void log(Exception arg0, String arg1) { + + } + + public void log(String arg0, Throwable arg1) { + + } + + public String getRealPath(String arg0) { + + return null; + } + + public String getServerInfo() { + + return null; + } + + public String getInitParameter(String arg0) { + + return null; + } + + public Enumeration getInitParameterNames() { + + return null; + } + + HashMap attributes = new HashMap(); + + public Object getAttribute(String arg0) { + return attributes.get(arg0); + } + + public Enumeration getAttributeNames() { + return null; + } + + public void setAttribute(String arg0, Object arg1) { + attributes.put(arg0, arg1); + } + + public void removeAttribute(String arg0) { + + } + + public String getServletContextName() { + + return null; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockBinding.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockBinding.java new file mode 100644 index 0000000000..8f9a556a00 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockBinding.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.mocks.tuscany; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyInitializationException; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Binding; + +public class MockBinding implements Binding { + + public String getURI() { + + return null; + } + + public void setURI(String value) { + + } + + public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException { + + } + + public void freeze() { + + } + + public boolean accept(AssemblyVisitor visitor) { + + return false; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockCompositeContextImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockCompositeContextImpl.java new file mode 100644 index 0000000000..bce958238b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockCompositeContextImpl.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.mocks.tuscany; + +import java.util.Map; + +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; + +public class MockCompositeContextImpl extends CompositeContextImpl { + public Map getScopeIndex() { + return scopeIndex; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockEntryPointContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockEntryPointContext.java new file mode 100644 index 0000000000..48489eca01 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockEntryPointContext.java @@ -0,0 +1,87 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.mocks.tuscany; + +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.context.EventFilter; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.RuntimeEventListener; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.event.Event; + +public class MockEntryPointContext implements EntryPointContext { + + private Object instance; + + public MockEntryPointContext(Object instance) { + this.instance = instance; + } + + public Object getHandler() throws TargetException { + + return null; + } + + public Class getServiceInterface() { + return null; + } + + public String getName() { + + return null; + } + + public void setName(String name) { + + } + + public int getLifecycleState() { + + return 0; + } + + public void start() throws CoreRuntimeException { + + } + + public void stop() throws CoreRuntimeException { + + } + + public Object getInstance(QualifiedName qName) throws TargetException { + + return instance; + } + + public void publish(Event object) { + + } + + public void addListener(RuntimeEventListener listener) { + + } + + public void addListener(EventFilter filter, RuntimeEventListener listener) { + + } + + public void removeListener(RuntimeEventListener listener) { + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockScopeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockScopeContext.java new file mode 100644 index 0000000000..71f1a3615c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/java/org/apache/tuscany/binding/jsonrpc/mocks/tuscany/MockScopeContext.java @@ -0,0 +1,119 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.binding.jsonrpc.mocks.tuscany; + +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.EventFilter; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.RuntimeEventListener; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.ScopeRuntimeException; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.event.Event; + +public class MockScopeContext implements ScopeContext { + + private Map instanceContexts; + + public MockScopeContext(Map instanceContexts) { + this.instanceContexts = instanceContexts; + } + + public boolean isCacheable() { + + return false; + } + + public void registerFactories(List> configurations) { + + } + + public void registerFactory(ContextFactory configuration) { + + } + + public Context getContext(String name) { + + return instanceContexts.get(name); + } + + public Context getContextByKey(String name, Object key) { + + return null; + } + + public void removeContext(String name) throws ScopeRuntimeException { + + } + + public void removeContextByKey(String name, Object key) throws ScopeRuntimeException { + + } + + public String getName() { + + return null; + } + + public void setName(String name) { + + } + + public int getLifecycleState() { + + return 0; + } + + public void start() throws CoreRuntimeException { + + } + + public void stop() throws CoreRuntimeException { + + } + + public Object getInstance(QualifiedName qName) throws TargetException { + + return null; + } + + public void publish(Event object) { + + } + + public void addListener(RuntimeEventListener listener) { + + } + + public void addListener(EventFilter filter, RuntimeEventListener listener) { + + } + + public void removeListener(RuntimeEventListener listener) { + + } + + public void onEvent(Event event) { + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/resources/org/apache/tuscany/binding/jsonrpc/assembly/tests/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/resources/org/apache/tuscany/binding/jsonrpc/assembly/tests/sca.module new file mode 100644 index 0000000000..e331f04c5a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/binding.jsonrpc/src/test/resources/org/apache/tuscany/binding/jsonrpc/assembly/tests/sca.module @@ -0,0 +1,27 @@ + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/pom.xml new file mode 100644 index 0000000000..d2aa27a50b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/pom.xml @@ -0,0 +1,43 @@ + + + + + + org.apache.tuscany + tuscany-sca + incubating-M1 + + + 4.0.0 + org.apache.tuscany.sca.bindings + tuscany-sca-bindings + pom + Tuscany SCA Bindings + incubating-M1 + + + + sunjars + + binding.axis2 + binding.jsonrpc + binding.celtix + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/sunjars/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/sunjars/build.xml new file mode 100644 index 0000000000..59b9553bc1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/sunjars/build.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/sunjars/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/sunjars/pom.xml new file mode 100644 index 0000000000..38fe58884f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/bindings/sunjars/pom.xml @@ -0,0 +1,105 @@ + + + + 4.0.0 + org.apache.tuscany.sca.bindings + tuscany-sunjars + pom + incubating-M1 + Project to install the Sun jars + + + org.apache.tuscany.sca.bindings + tuscany-sca-bindings + incubating-M1 + + + + + 1.0 + + + + objectweb + ObjectWeb repo + http://maven.objectweb.org/maven2 + + true + + + false + + + + + + + + + + + org.codehaus.mojo + dependency-maven-plugin + + + getdeps + validate + + unpack + + + ${project.build.directory}/celtix-install + + + org.objectweb.celtix + celtix-distribution + ${celtix.version} + bin-epl + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + install + install + + run + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/pom.xml new file mode 100644 index 0000000000..861c33c7e1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/pom.xml @@ -0,0 +1,37 @@ + + + + + org.apache.tuscany + tuscany-sca + incubating-M1 + + 4.0.0 + tuscany-common + Tuscany Common + Tuscany classes common to runtime and tools. + incubating-M1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyException.java new file mode 100644 index 0000000000..2bf802520d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyException.java @@ -0,0 +1,133 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common; + +import java.util.ArrayList; +import java.util.List; + +/** + * The root checked exception for the Tuscany runtime. + * + * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ + */ +public abstract class TuscanyException extends Exception { + private static final long serialVersionUID = -7847121698339635268L; + private List contextStack; + private String identifier; + + /** + * Override constructor from Exception. + * + * @see Exception + */ + public TuscanyException() { + super(); + } + + /** + * Override constructor from Exception. + * + * @param message passed to Exception + * @see Exception + */ + public TuscanyException(String message) { + super(message); + } + + /** + * Override constructor from Exception. + * + * @param message passed to Exception + * @param cause passed to Exception + * @see Exception + */ + public TuscanyException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Override constructor from Exception. + * + * @param cause passed to Exception + * @see Exception + */ + public TuscanyException(Throwable cause) { + super(cause); + } + + /** + * Returns a collection of names representing the context call stack where the error occured. + * The top of the stack is the first element in the collection. + * + * @return a collection of names representing the context call stack + */ + public List returnContextNames() { + if (contextStack == null) { + contextStack = new ArrayList(); + } + return contextStack; + } + + /** + * Pushes a context name where an error occured onto the call stack. + * + * @param name the name of a context to push on the stack + */ + public void addContextName(String name) { + if (contextStack == null) { + contextStack = new ArrayList(); + } + contextStack.add(name); + } + + /** + * Returns a string representing additional error information referred to in the error message. + * + * @return additional error information + */ + public String getIdentifier() { + return identifier; + } + + /** + * Sets an additional error information referred to in the error message. + * + * @param identifier additional error information + */ + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public String getMessage() { + if (identifier == null && contextStack == null) { + return super.getMessage(); + } + StringBuilder b = new StringBuilder(256); + b.append(super.getMessage()); + + if (identifier != null) { + b.append(" [").append(identifier).append(']'); + } + if (contextStack != null) { + b.append("\nContext stack trace: "); + for (int i = contextStack.size() - 1; i >= 0; i--) { + b.append('[').append(contextStack.get(i)).append(']'); + } + } + return b.toString(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyRuntimeException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyRuntimeException.java new file mode 100644 index 0000000000..60f2e2287a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/TuscanyRuntimeException.java @@ -0,0 +1,134 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common; + +import java.util.ArrayList; +import java.util.List; + +/** + * The root unchecked exception for the Tuscany runtime. + * + * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ + */ + +public abstract class TuscanyRuntimeException extends RuntimeException { + private static final long serialVersionUID = -759677431966121786L; + private List contextStack; + private String identifier; + + /** + * Override constructor from RuntimeException. + * + * @see RuntimeException + */ + public TuscanyRuntimeException() { + super(); + } + + /** + * Override constructor from RuntimeException. + * + * @param message passed to RuntimeException + * @see RuntimeException + */ + public TuscanyRuntimeException(String message) { + super(message); + } + + /** + * Override constructor from RuntimeException. + * + * @param message passed to RuntimeException + * @param cause passed to RuntimeException + * @see RuntimeException + */ + public TuscanyRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Override constructor from RuntimeException. + * + * @param cause passed to RuntimeException + * @see RuntimeException + */ + public TuscanyRuntimeException(Throwable cause) { + super(cause); + } + + /** + * Returns a collection of names representing the context call stack where the error occured. + * The top of the stack is the first element in the collection. + * + * @return a collection of names representing the context call stack + */ + public List returnContextNames() { + if (contextStack == null) { + contextStack = new ArrayList(); + } + return contextStack; + } + + /** + * Pushes a context name where an error occured onto the call stack. + * + * @param name the name of a context to push on the stack + */ + public void addContextName(String name) { + if (contextStack == null) { + contextStack = new ArrayList(); + } + contextStack.add(name); + } + + /** + * Returns a string representing additional error information referred to in the error message. + * + * @return additional error information + */ + public String getIdentifier() { + return identifier; + } + + /** + * Sets an additional error information referred to in the error message. + * + * @param identifier additional error information + */ + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public String getMessage() { + if (identifier == null && contextStack == null) { + return super.getMessage(); + } + StringBuilder b = new StringBuilder(256); + b.append(super.getMessage()); + + if (identifier != null) { + b.append(" [").append(identifier).append(']'); + } + if (contextStack != null) { + b.append("\nContext stack trace: "); + for (int i = contextStack.size() - 1; i >= 0; i--) { + b.append('[').append(contextStack.get(i)).append(']'); + } + } + return b.toString(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/LogLevel.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/LogLevel.java new file mode 100644 index 0000000000..45134c7556 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/LogLevel.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common.monitor; + +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation that can be applied to methods in a monitoring interface + * to indicate to logging frameworks the severity of the event. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface LogLevel { + + /** + * The log level as specified by {@link java.util.logging.Level}. + */ + @SuppressWarnings({"JavaDoc"}) String value(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/MonitorFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/MonitorFactory.java new file mode 100644 index 0000000000..aa92092005 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/MonitorFactory.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common.monitor; + +/** + * A MonitorFactory creates implementations of components' monitor interfaces + * that interface with a its monitoring scheme. For example, a implementation + * may create versions that emit appropriate logging events or which send + * notifications to a management API. + * + * @version $Rev$ $Date$ + */ +public interface MonitorFactory { + /** + * Return a monitor for a component's monitor interface. + * + * @param monitorInterface the component's monitoring interface + * @return an implementation of the monitoring interface; will not be null + */ + T getMonitor(Class monitorInterface); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/InvalidLevelException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/InvalidLevelException.java new file mode 100644 index 0000000000..baf4e8b7cc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/InvalidLevelException.java @@ -0,0 +1,60 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common.monitor.impl; + +/** + * Exception indicating an invalid log level has been passed. + * + * @version $Rev$ $Date$ + */ +public class InvalidLevelException extends IllegalArgumentException { + private static final long serialVersionUID = 7767234706427841915L; + private final String method; + private final String level; + + /** + * Constructor specifying the method name and the level affected. + * + * @param method the name of the method being monitored + * @param level the invalid log level value + */ + public InvalidLevelException(String method, String level) { + super(); + this.method = method; + this.level = level; + } + + /** + * Returns the name of the method being monitored. + * @return the name of the method being monitored + */ + public String getMethod() { + return method; + } + + /** + * Returns the invalid log level specified. + * @return the invalid log level that was specified + */ + public String getLevel() { + return level; + } + + public String getMessage() { + return "Invalid level for method " + method + " : " + level; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/JavaLoggingMonitorFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/JavaLoggingMonitorFactory.java new file mode 100644 index 0000000000..daef77d4ae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/JavaLoggingMonitorFactory.java @@ -0,0 +1,186 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common.monitor.impl; + +import java.lang.ref.WeakReference; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.WeakHashMap; +import java.util.ResourceBundle; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.LogRecord; + +import org.apache.tuscany.common.monitor.LogLevel; +import org.apache.tuscany.common.monitor.MonitorFactory; + +/** + * A factory for monitors that forwards events to a {@link java.util.logging.Logger Java Logging (JSR47) Logger}. + * + * @version $Rev$ $Date$ + * @see java.util.logging + */ +public class JavaLoggingMonitorFactory implements MonitorFactory { + private final String bundleName; + private final Level defaultLevel; + private final Map levels; + + private final Map, WeakReference> proxies = new WeakHashMap, WeakReference>(); + + /** + * Construct a MonitorFactory that will monitor the specified methods at the specified levels + * and generate messages using java.util.logging. + *

+ * The supplied Properties can be used to specify custom log levels for specific monitor + * methods. The key should be the method name in form returned by + * Class.getName() + '#' + Method.getName() and the value the log level to use + * as defined by {@link java.util.logging.Level}. + * + * @param levels definition of custom levels for specific monitored methods + * @param defaultLevel the default log level to use + * @param bundleName the name of a resource bundle that will be passed to the logger + * @see java.util.logging.Logger + */ + public JavaLoggingMonitorFactory(Properties levels, Level defaultLevel, String bundleName) { + this.defaultLevel = defaultLevel; + this.bundleName = bundleName; + this.levels = new HashMap(levels.size()); + for (Map.Entry entry : levels.entrySet()) { + String method = (String) entry.getKey(); + String level = (String) entry.getValue(); + try { + this.levels.put(method, Level.parse(level)); + } catch (IllegalArgumentException e) { + throw new InvalidLevelException(method, level); + } + } + } + + public synchronized T getMonitor(Class monitorInterface) { + T proxy = getCachedMonitor(monitorInterface); + if (proxy == null) { + proxy = createMonitor(monitorInterface, bundleName); + proxies.put(monitorInterface, new WeakReference(proxy)); + } + return proxy; + } + + private T getCachedMonitor(Class monitorInterface) { + WeakReference ref = proxies.get(monitorInterface); + return (ref != null) ? monitorInterface.cast(ref.get()) : null; + } + + private T createMonitor(Class monitorInterface, String bundleName) { + String className = monitorInterface.getName(); + Logger logger = Logger.getLogger(className); + Method[] methods = monitorInterface.getMethods(); + Map levels = new HashMap(methods.length); + for (Method method : methods) { + String key = className + '#' + method.getName(); + Level level = this.levels.get(key); + + // if not specified the in config properties, look for an annotation on the method + if (level == null) { + LogLevel annotation = method.getAnnotation(LogLevel.class); + if (annotation != null && annotation.value() != null) { + try { + level = Level.parse(annotation.value()); + } catch (IllegalArgumentException e) { + // bad value, just use the default + level = defaultLevel; + } + } + } + if (level == null) { + level = defaultLevel; + } + levels.put(method.getName(), level); + } + + ResourceBundle bundle = locateBundle(monitorInterface, bundleName); + + InvocationHandler handler = new LoggingHandler(logger, levels, bundle); + return monitorInterface.cast(Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class[]{monitorInterface}, handler)); + } + + private static ResourceBundle locateBundle(Class monitorInterface, String bundleName) { + Locale locale = Locale.getDefault(); + ClassLoader cl = monitorInterface.getClassLoader(); + String packageName = monitorInterface.getPackage().getName(); + while (true) { + try { + return ResourceBundle.getBundle(packageName + '.' + bundleName, locale, cl); + } catch (MissingResourceException e) { + } + int index = packageName.lastIndexOf('.'); + if (index == -1) { + break; + } + packageName = packageName.substring(0, index); + } + try { + return ResourceBundle.getBundle(bundleName, locale, cl); + } catch (Exception e) { + return null; + } + } + + private static final class LoggingHandler implements InvocationHandler { + private final Logger logger; + private final Map methodLevels; + private final ResourceBundle bundle; + + public LoggingHandler(Logger logger, Map methodLevels, ResourceBundle bundle) { + this.logger = logger; + this.methodLevels = methodLevels; + this.bundle = bundle; + } + + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + String sourceMethod = method.getName(); + Level level = methodLevels.get(sourceMethod); + if (level != null && logger.isLoggable(level)) { + // construct the key for the resource bundle + String className = logger.getName(); + String key = className + '#' + sourceMethod; + + LogRecord logRecord = new LogRecord(level, key); + logRecord.setLoggerName(className); + logRecord.setSourceClassName(className); + logRecord.setSourceMethodName(sourceMethod); + logRecord.setParameters(args); + if (args != null) { + for (Object o : args) { + if (o instanceof Throwable) { + logRecord.setThrown((Throwable) o); + break; + } + } + } + logRecord.setResourceBundle(bundle); + logger.log(logRecord); + } + return null; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/NullMonitorFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/NullMonitorFactory.java new file mode 100644 index 0000000000..827aeec84c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/monitor/impl/NullMonitorFactory.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common.monitor.impl; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; + +import org.apache.tuscany.common.monitor.MonitorFactory; + +/** + * Implementation of a {@link MonitorFactory} that produces implementations that simply return. + * + * @version $Rev$ $Date$ + */ +public class NullMonitorFactory implements MonitorFactory { + public T getMonitor(Class monitorInterface) { + /* + * This uses a reflection proxy to implement the monitor interface which + * is a simple but perhaps not very performant solution. Performance + * might be improved by code generating an implementation with empty methods. + */ + return monitorInterface.cast(Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class[]{monitorInterface}, NULL_MONITOR)); + } + + /** + * Singleton wire hander that does nothing. + */ + private static final InvocationHandler NULL_MONITOR = new InvocationHandler() { + public Object invoke(Object proxy, Method method, Object[] args) { + return null; + } + }; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/ResourceLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/ResourceLoader.java new file mode 100644 index 0000000000..897c5e06c0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/ResourceLoader.java @@ -0,0 +1,90 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common.resource; + +import java.io.IOException; +import java.net.URL; +import java.util.Iterator; +import java.util.List; + +/** + * Interface which abstracts the implementation of something that is able to + * load resources (such as a ClassLoader). All Tuscany code should use this + * API rather than a ClassLoader directly in order to reduce the risk of + * memory leaks due to ClassLoader references. + * + * @version $Rev: 379878 $ $Date: 2006-02-22 12:45:50 -0800 (Wed, 22 Feb 2006) $ + */ +public interface ResourceLoader { + + /** + * Returns the parent resource loaders. + * + * @return resource loaders that are parents to this one + */ + List getParents(); + + /** + * Loads the class with the specified binary name. + * + * @param name the binary name of the class + * @return the resulting Class object + * @throws ClassNotFoundException if the class was not found + * @see ClassLoader#loadClass(String) + */ + Class loadClass(String name) throws ClassNotFoundException; + + /** + * Converts an array of bytes into a Class. + * + * @param bytes the bytecode for the class; must match the class file format + * @return a Class defined from the supplied bytecode + */ + Class addClass(byte[] bytes); + + /** + * Finds the first resource with the given name. + *

+ * Each parent is searched first (in the order returned by {@link #getParents()}) + * and the first resource located is found. If no parent returns a resource then + * the first resource defined by this ResourceLoader is returned. + * + * @param name the resource name + * @return a {@link URL} that can be used to read the resource, or null if no resource could be found + */ + URL getResource(String name); + + /** + * Find resources with the given name that are available from this + * ResourceLoader or any of its parents. + * + * @param name the resource name + * @return an Iterator of {@link URL} objects for the resource + * @throws IOException if there was a problem locating the resources + */ + Iterator getResources(String name) throws IOException; + + //FIXME this is temporary to work around classloader problems with SDO when running in Tomcat + + /** + * Returns the underlying classloader this loader is wrapping. + * + * @return the underlying classloader this loader is wrapping + */ + ClassLoader getClassLoader(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/GeneratedClassLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/GeneratedClassLoader.java new file mode 100644 index 0000000000..953908b9f2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/GeneratedClassLoader.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common.resource.impl; + +/** + * A class loader that allows new classes to be defined from an array of bytes. + * + * @version $Rev: 369102 $ $Date: 2006-01-14 13:48:56 -0800 (Sat, 14 Jan 2006) $ + */ +@SuppressWarnings({"CustomClassloader"}) +class GeneratedClassLoader extends ClassLoader { + + /** + * Constructs a new GeneratedClassLoader. + * @param classLoader the parent classloader + */ + GeneratedClassLoader(ClassLoader classLoader) { + super(classLoader); + } + + /** + * Converts an array of bytes into a Class. + * + * @param bytes the bytecode for the class; must match the class file format + * @return a Class defined from the supplied bytecode + */ + Class addClass(byte[] bytes) { + return defineClass(null, bytes, 0, bytes.length); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/ResourceLoaderImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/ResourceLoaderImpl.java new file mode 100644 index 0000000000..d306edf3b4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/java/org/apache/tuscany/common/resource/impl/ResourceLoaderImpl.java @@ -0,0 +1,137 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common.resource.impl; + +import java.io.IOException; +import java.lang.ref.WeakReference; +import java.net.URL; +import java.util.Collections; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; + +import org.apache.tuscany.common.resource.ResourceLoader; + +/** + * Default implementation of the ResourceLoader interface + * + * @version $Rev: 369102 $ $Date: 2006-01-14 13:48:56 -0800 (Sat, 14 Jan 2006) $ + */ +@SuppressWarnings({"ClassLoader2Instantiation"}) +public class ResourceLoaderImpl implements ResourceLoader { + private final WeakReference classLoaderReference; + private WeakReference generatedClassLoaderReference; + private final List parents; + + /** + * Constructs a new ResourceLoaderImpl to wrap a ClassLoader. + * + * @param classLoader the classloader to wrap + */ + public ResourceLoaderImpl(ClassLoader classLoader) { + classLoaderReference = new WeakReference(classLoader); + generatedClassLoaderReference = new WeakReference(new GeneratedClassLoader(classLoader)); + ClassLoader parentCL = classLoader.getParent(); + if (null == parentCL) { + parents = Collections.emptyList(); + } else { + parents = Collections.singletonList((ResourceLoader) new ResourceLoaderImpl(parentCL)); + } + } + + + public ClassLoader getClassLoader() throws IllegalStateException { + ClassLoader cl = classLoaderReference.get(); + if (cl == null) { + throw new IllegalStateException("Referenced ClassLoader has been garbage collected"); + } + return cl; + } + + public List getParents() { + return parents; + } + + public Class loadClass(String name) throws ClassNotFoundException { + GeneratedClassLoader cl = generatedClassLoaderReference.get(); + if (cl != null) { + return Class.forName(name, true, cl); + } else { + return Class.forName(name, true, getClassLoader()); + } + } + + public Class addClass(byte[] bytes) { + GeneratedClassLoader cl = generatedClassLoaderReference.get(); + if (cl == null) { + cl = new GeneratedClassLoader(getClassLoader()); + generatedClassLoaderReference = new WeakReference(cl); + } + return cl.addClass(bytes); + } + + public Iterator getResources(String name) throws IOException { + return new EnumerationIterator(getClassLoader().getResources(name)); + } + + public URL getResource(String name) { + return getClassLoader().getResource(name); + } + + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof ResourceLoaderImpl)) { + return false; + } + final ResourceLoaderImpl other = (ResourceLoaderImpl) obj; + return getClassLoader() == other.getClassLoader(); + } + + public int hashCode() { + return getClassLoader().hashCode(); + } + + private static class EnumerationIterator implements Iterator { + private final Enumeration e; + + public EnumerationIterator(Enumeration e) { + this.e = e; + } + + public boolean hasNext() { + return e.hasMoreElements(); + } + + public E next() { + // the try/catch is needed here to get IDEA to shut up + // there should be no performance overhead here except when the Exception is thrown + // so I am going to leave it in - feel free to remove if there is any issue + try { + return e.nextElement(); + } catch (NoSuchElementException e1) { + throw e1; + } + } + + public void remove() { + throw new UnsupportedOperationException(); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.logging.LogProvider b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.logging.LogProvider new file mode 100644 index 0000000000..6cf181502c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.logging.LogProvider @@ -0,0 +1 @@ +org.apache.tuscany.common.logging.impl.JSR47LogProviderImpl \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.resource.loader.ResourceLoaderProvider b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.resource.loader.ResourceLoaderProvider new file mode 100644 index 0000000000..70456ec1d0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/main/resources/META-INF/services/org.apache.tuscany.common.resource.loader.ResourceLoaderProvider @@ -0,0 +1 @@ +org.apache.tuscany.common.resource.loader.impl.ResourceLoaderProviderImpl \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/java/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/java/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase.java new file mode 100644 index 0000000000..985f7ef9b6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/java/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase.java @@ -0,0 +1,163 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.common.monitor.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; + +import junit.framework.TestCase; + +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.LogLevel; + +/** + * Test case for the JavaLoggingMonitorFactory. + * + * @version $Rev$ $Date$ + */ +public class JavaLoggingTestCase extends TestCase { + private static final Logger logger = Logger.getLogger(Monitor.class.getName()); + private static final MockHandler handler = new MockHandler(); + + private MonitorFactory factory; + + /** + * Smoke test to ensure the logger is working. + */ + public void testLogger() { + logger.info("test"); + assertEquals(1, handler.logs.size()); + } + + /** + * Test that no record is logged. + */ + public void testUnloggedEvent() { + Monitor mon = factory.getMonitor(Monitor.class); + mon.eventNotToLog(); + assertEquals(0, handler.logs.size()); + } + + /** + * Test the correct record is written for an event with no arguments. + */ + public void testEventWithNoArgs() { + Monitor mon = factory.getMonitor(Monitor.class); + mon.eventWithNoArgs(); + assertEquals(1, handler.logs.size()); + LogRecord record = handler.logs.get(0); + assertEquals(Level.INFO, record.getLevel()); + assertEquals(logger.getName(), record.getLoggerName()); + assertEquals(Monitor.class.getName() + "#eventWithNoArgs", record.getMessage()); + } + + /** + * Test the correct record is written for an event defined by annotation. + */ + public void testEventWithAnnotation() { + Monitor mon = factory.getMonitor(Monitor.class); + mon.eventWithAnnotation(); + assertEquals(1, handler.logs.size()); + LogRecord record = handler.logs.get(0); + assertEquals(Level.INFO, record.getLevel()); + assertEquals(logger.getName(), record.getLoggerName()); + assertEquals(Monitor.class.getName() + "#eventWithAnnotation", record.getMessage()); + } + + /** + * Test a Throwable is logged when passed to an event. + */ + public void testEventWithThrowable() { + Exception e = new Exception(); + Monitor mon = factory.getMonitor(Monitor.class); + mon.eventWithThrowable(e); + assertEquals(1, handler.logs.size()); + LogRecord record = handler.logs.get(0); + assertEquals(Level.WARNING, record.getLevel()); + assertEquals(logger.getName(), record.getLoggerName()); + assertEquals(Monitor.class.getName() + "#eventWithThrowable", record.getMessage()); + assertSame(e, record.getThrown()); + } + + /** + * Test the argument is logged. + */ + public void testEventWithOneArg() { + Monitor mon = factory.getMonitor(Monitor.class); + mon.eventWithOneArg("ARG"); + assertEquals(1, handler.logs.size()); + LogRecord record = handler.logs.get(0); + assertEquals(Monitor.class.getName() + "#eventWithOneArg", record.getMessage()); + } + + protected void setUp() throws Exception { + super.setUp(); + logger.setUseParentHandlers(false); + logger.addHandler(handler); + handler.flush(); + + String sourceClass = Monitor.class.getName(); + Properties levels = new Properties(); + levels.setProperty(sourceClass + "#eventWithNoArgs", "INFO"); + levels.setProperty(sourceClass + "#eventWithOneArg", "INFO"); + levels.setProperty(sourceClass + "#eventWithThrowable", "WARNING"); + factory = new JavaLoggingMonitorFactory(levels, Level.FINE, "TestMessages"); + } + + protected void tearDown() throws Exception { + logger.removeHandler(handler); + handler.flush(); + super.tearDown(); + } + + /** + * Mock log handler to capture records. + */ + public static class MockHandler extends Handler { + List logs = new ArrayList(); + + public void publish(LogRecord record) { + logs.add(record); + } + + public void flush() { + logs.clear(); + } + + public void close() throws SecurityException { + } + } + + @SuppressWarnings({"JavaDoc"}) + public static interface Monitor { + void eventNotToLog(); + + void eventWithNoArgs(); + + void eventWithOneArg(String msg); + + void eventWithThrowable(Exception e); + + @LogLevel("INFO") + void eventWithAnnotation(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/resources/org/apache/tuscany/common/TestMessages.properties b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/resources/org/apache/tuscany/common/TestMessages.properties new file mode 100644 index 0000000000..e765ad2e0f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/resources/org/apache/tuscany/common/TestMessages.properties @@ -0,0 +1,16 @@ +# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# $Rev$ $Date$ +# diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/resources/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase$Monitor.properties b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/resources/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase$Monitor.properties new file mode 100644 index 0000000000..e16fa437fa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/common/src/test/resources/org/apache/tuscany/common/monitor/impl/JavaLoggingTestCase$Monitor.properties @@ -0,0 +1 @@ +org.apache.tuscany.common.monitor.impl.JavaLoggingTestCase$Monitor#eventWithOneArg=Log message with arg={0} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/pom.xml new file mode 100644 index 0000000000..cb33cc90cf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/pom.xml @@ -0,0 +1,52 @@ + + + + + + org.apache.tuscany.sca.containers + tuscany-sca-containers + incubating-M1 + + + 4.0.0 + tuscany-container-java + Tuscany Java IoC Container + Container for managing components as defined by the SCA implementation specification. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + compile + + + org.apache.tuscany.databinding + tuscany-databinding-sdo + ${pom.version} + compile + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaAssemblyFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaAssemblyFactory.java new file mode 100644 index 0000000000..90271179d1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaAssemblyFactory.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly; + +import org.apache.tuscany.model.assembly.AssemblyFactory; + + +/** + * The Factory for the model. + */ +public interface JavaAssemblyFactory extends AssemblyFactory { + /** + * Returns a new JavaImplementation. + */ + JavaImplementation createJavaImplementation(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaImplementation.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaImplementation.java new file mode 100644 index 0000000000..a87b8ea1bb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/JavaImplementation.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly; + +import org.apache.tuscany.model.assembly.AtomicImplementation; + + +/** + * Represents a java implementation. + * + * @version $Rev$ $Date$ + */ +public interface JavaImplementation extends AtomicImplementation { + + /** + * Returns the implementation class. + */ + Class getImplementationClass(); + + /** + * Sets the implementation class. + */ + void setImplementationClass(Class value); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaAssemblyFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaAssemblyFactoryImpl.java new file mode 100644 index 0000000000..3337c287ac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaAssemblyFactoryImpl.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.impl; + +import org.osoa.sca.annotations.Service; + +import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; +import org.apache.tuscany.container.java.assembly.JavaImplementation; +import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; + +/** + * A factory for the model. + */ +@Service(interfaces = {JavaAssemblyFactory.class}) +public class JavaAssemblyFactoryImpl extends AssemblyFactoryImpl implements JavaAssemblyFactory { + + /** + * Constructor + */ + public JavaAssemblyFactoryImpl() { + super(); + } + + /** + * @see org.apache.tuscany.container.java.assembly.JavaAssemblyFactory#createJavaImplementation() + */ + public JavaImplementation createJavaImplementation() { + return new JavaImplementationImpl(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaImplementationImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaImplementationImpl.java new file mode 100644 index 0000000000..57a98f4ad6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/assembly/impl/JavaImplementationImpl.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.impl; + +import org.apache.tuscany.container.java.assembly.JavaImplementation; +import org.apache.tuscany.model.assembly.impl.AtomicImplementationImpl; + +/** + * An implementation of JavaImplementation. + * + * @version $Rev$ $Date$ + */ +public class JavaImplementationImpl extends AtomicImplementationImpl implements JavaImplementation { + private Class implementationClass; + + /** + * Default constructor. + */ + protected JavaImplementationImpl() { + } + + public Class getImplementationClass() { + return implementationClass; + } + + public void setImplementationClass(Class value) { + checkNotFrozen(); + implementationClass = value; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilder.java new file mode 100644 index 0000000000..de915738f9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilder.java @@ -0,0 +1,113 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.builder; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.container.java.assembly.JavaImplementation; +import org.apache.tuscany.container.java.config.JavaContextFactory; +import org.apache.tuscany.core.extension.config.extensibility.ComponentNameExtensibilityElement; +import org.apache.tuscany.core.extension.config.extensibility.ContextExtensibilityElement; +import org.apache.tuscany.core.extension.config.extensibility.DestroyInvokerExtensibilityElement; +import org.apache.tuscany.core.extension.config.extensibility.InitInvokerExtensibilityElement; +import org.apache.tuscany.core.extension.config.InjectorExtensibilityElement; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.extension.ContextFactoryBuilderSupport; +import org.apache.tuscany.core.injection.EventInvoker; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Builds context factories for component implementations that map to {@link + * org.apache.tuscany.container.java.assembly.JavaImplementation}. The logical model is then decorated with + * the runtime configuration. + * + * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ + * @see org.apache.tuscany.core.builder.ContextFactory + */ +@org.osoa.sca.annotations.Scope("MODULE") +public class JavaContextFactoryBuilder extends ContextFactoryBuilderSupport { + + /** + * Default constructor + */ + public JavaContextFactoryBuilder() { + super(); + } + + /** + * Constructs a new instance + * + * @param wireFactoryService the system service responsible for creating wire factories + */ + public JavaContextFactoryBuilder(WireFactoryService wireFactoryService) { + super(wireFactoryService); + } + + @SuppressWarnings("unchecked") + protected ContextFactory createContextFactory(String name, JavaImplementation javaImpl, Scope scope) { + Class implClass = null; + JavaContextFactory contextFactory; + try { + implClass = javaImpl.getImplementationClass(); + + contextFactory = new JavaContextFactory(name, JavaIntrospectionHelper + .getDefaultConstructor(implClass), scope); + + List injectors = new ArrayList(); + List elements = javaImpl.getComponentType().getExtensibilityElements(); + for (Object element : elements) { + if (element instanceof InitInvokerExtensibilityElement) { + InitInvokerExtensibilityElement invokerElement = (InitInvokerExtensibilityElement) element; + EventInvoker initInvoker = invokerElement.getEventInvoker(); + boolean eagerInit = invokerElement.isEager(); + contextFactory.setEagerInit(eagerInit); + contextFactory.setInitInvoker(initInvoker); + } else if (element instanceof DestroyInvokerExtensibilityElement) { + DestroyInvokerExtensibilityElement invokerElement = (DestroyInvokerExtensibilityElement) element; + EventInvoker destroyInvoker = invokerElement.getEventInvoker(); + contextFactory.setDestroyInvoker(destroyInvoker); + } else if (element instanceof ComponentNameExtensibilityElement) { + ComponentNameExtensibilityElement nameElement = (ComponentNameExtensibilityElement) element; + injectors.add(nameElement.getEventInvoker(name)); + } else if (element instanceof ContextExtensibilityElement) { + ContextExtensibilityElement contextElement = (ContextExtensibilityElement) element; + injectors.add(contextElement.getInjector(contextFactory)); + }else if (element instanceof InjectorExtensibilityElement){ + InjectorExtensibilityElement injectorElement = (InjectorExtensibilityElement)element; + injectors.add(injectorElement.getInjector(contextFactory)); + } + } + contextFactory.setSetters(injectors); + return contextFactory; + } catch (BuilderException e) { + e.addContextName(name); + throw e; + } catch (NoSuchMethodException e) { + BuilderConfigException ce = new BuilderConfigException("Class does not have a no-arg constructor", e); + ce.setIdentifier(implClass.getName()); + ce.addContextName(name); + throw ce; + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java new file mode 100644 index 0000000000..cc66fa54f6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilder.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.builder; + +import org.apache.tuscany.container.java.config.JavaContextFactory; +import org.apache.tuscany.container.java.invocation.ScopedJavaComponentInvoker; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.extension.WireBuilderSupport; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.osoa.sca.annotations.Scope; + +import java.lang.reflect.Method; + +/** + * Completes a wire to a Java-based target component by adding a scoped java invoker to the source chain + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class JavaTargetWireBuilder extends WireBuilderSupport { + + protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) { + boolean cacheable = !downScope; + return new ScopedJavaComponentInvoker(targetName, operation, context,cacheable); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java new file mode 100644 index 0000000000..ff498d851a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/config/JavaContextFactory.java @@ -0,0 +1,341 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.config; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import commonj.sdo.DataObject; +import org.apache.tuscany.container.java.context.JavaAtomicContext; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.NoAccessorException; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.builder.impl.ArrayMultiplicityObjectFactory; +import org.apache.tuscany.core.builder.impl.ListMultiplicityObjectFactory; +import org.apache.tuscany.core.builder.impl.ProxyObjectFactory; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.injection.EventInvoker; +import org.apache.tuscany.core.injection.FieldInjector; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.MethodInjector; +import org.apache.tuscany.core.injection.PojoObjectFactory; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.databinding.sdo.SDOObjectFactory; +import org.apache.tuscany.model.assembly.Scope; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +/** + * A ContextFactory that handles POJO component implementation types + * + * @version $Rev$ $Date$ + */ +public class JavaContextFactory implements ContextFactory, ContextResolver { + + // the component name as configured in the hosting module + private String name; + + // the parent context of the component + private CompositeContext parentContext; + + private Map targetProxyFactories = new HashMap(); + + private List sourceProxyFactories = new ArrayList(); + + // the implementation type constructor + private Constructor ctr; + + private Set fields; + + private Set methods; + + // injectors for properties, references and other metadata values such as + private List setters; + + // an invoker for a method decorated with @Init + private EventInvoker init; + + // whether the component should be eagerly initialized when its scope starts + private boolean eagerInit; + + // an invoker for a method decorated with @Destroy + private EventInvoker destroy; + + // the scope of the implementation instance + private Scope scope; + + // whether the component is stateless + private boolean stateless; + + /** + * Creates a new context factory + * + * @param name the SCDL name of the component the context refers to + * @param ctr the implementation type constructor + * @param scope the scope of the component implementation type + */ + public JavaContextFactory(String name, Constructor ctr, Scope scope) { + assert (name != null) : "Name was null"; + assert (ctr != null) : "Constructor was null"; + this.name = name; + this.ctr = ctr; + this.scope = scope; + stateless = (scope == Scope.INSTANCE); + fields = JavaIntrospectionHelper.getAllFields(ctr.getDeclaringClass()); + methods = JavaIntrospectionHelper.getAllUniqueMethods(ctr.getDeclaringClass()); + } + + public String getName() { + return name; + } + + public Scope getScope() { + return scope; + } + + public AtomicContext createContext() throws ContextCreationException { + PojoObjectFactory objectFactory = new PojoObjectFactory(ctr, null, setters); + return new JavaAtomicContext(name, objectFactory, eagerInit, init, destroy, stateless); + } + + public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { + targetProxyFactories.put(serviceName, factory); + } + + public TargetWireFactory getTargetWireFactory(String serviceName) { + return targetProxyFactories.get(serviceName); + } + + public Map getTargetWireFactories() { + return targetProxyFactories; + } + + public void addProperty(String propertyName, Object value) { + setters.add(createPropertyInjector(propertyName, value)); + } + + public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { + sourceProxyFactories.add(factory); + setters.add(createReferenceInjector(referenceName, factory, false)); + } + + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factories, boolean multiplicity) { + sourceProxyFactories.addAll(factories); + setters.add(createReferenceInjector(referenceName, factories, multiplicity)); + } + + public List getSourceWireFactories() { + return sourceProxyFactories; + } + + public void setSetters(List setters) { + this.setters = setters; + } + + public void setEagerInit(boolean val) { + eagerInit = val; + } + + public void setInitInvoker(EventInvoker invoker) { + init = invoker; + } + + public void setDestroyInvoker(EventInvoker invoker) { + destroy = invoker; + } + + public void prepare(CompositeContext parent) { + parentContext = parent; + } + + public CompositeContext getCurrentContext() { + return parentContext; + } + + /** + * Creates an Injector for component properties + */ + private Injector createPropertyInjector(String propertyName, Object value) + throws NoAccessorException { + Class type = value.getClass(); + + // There is no efficient way to do this + Method method = null; + Field field = JavaIntrospectionHelper.findClosestMatchingField(propertyName, type, fields); + if (field == null) { + // hack for TUSCANY-322 + for (Field current : fields) { + Property annot = current.getAnnotation(Property.class); + if (annot != null) { + if (propertyName.equals(annot.name())) { + field = current; + break; + } + } + } + method = JavaIntrospectionHelper.findClosestMatchingMethod(propertyName, new Class[]{type}, methods); + if (method == null) { + // hack for TUSCANY-322 + for (Method current : methods) { + Property annot = current.getAnnotation(Property.class); + if (annot != null) { + if (propertyName.equals(annot.name())) { + method = current; + break; + } + } + } + if (method == null) { + throw new NoAccessorException(propertyName); + } + } + } + Injector injector = null; + if (value instanceof DataObject) { + if (field != null) { + injector = new FieldInjector(field, new SDOObjectFactory((DataObject) value)); + } else { + injector = new MethodInjector(method, new SDOObjectFactory((DataObject) value)); + } + } else if (JavaIntrospectionHelper.isImmutable(type)) { + if (field != null) { + injector = new FieldInjector(field, new SingletonObjectFactory(value)); + } else { + injector = new MethodInjector(method, new SingletonObjectFactory(value)); + } + } + return injector; + + } + + /** + * Creates proxy factories that represent target(s) of a reference and an Injector + * responsible for injecting them into the reference + */ + private Injector createReferenceInjector(String refName, List wireFactories, boolean multiplicity) { + Class refClass = wireFactories.get(0).getBusinessInterface(); //reference.getPort().getServiceContract().getInterface(); + // iterate through the targets + List objectFactories = new ArrayList(); + for (SourceWireFactory wireFactory : wireFactories) { + objectFactories.add(new ProxyObjectFactory(wireFactory)); + } + return createInjector(refName, refClass, multiplicity, objectFactories, fields, methods); + + } + + private Injector createReferenceInjector(String refName, SourceWireFactory wireFactory, boolean multiplicity) { + Class refClass = wireFactory.getBusinessInterface();//reference.getPort().getServiceContract().getInterface(); + List objectFactories = new ArrayList(); + objectFactories.add(new ProxyObjectFactory(wireFactory)); + return createInjector(refName, refClass, multiplicity, objectFactories, fields, methods); + + } + + /** + * Creates an Injector for a set of object factories associated with a reference. + */ + private Injector createInjector(String refName, Class refClass, boolean multiplicity, List objectFactories, + Set fields, Set methods) throws NoAccessorException, BuilderConfigException { + Field field; + Method method = null; + if (multiplicity) { + // since this is a multiplicity, we cannot match on business interface type, so scan through the fields, + // matching on name and List or Array + field = JavaIntrospectionHelper.findMultiplicityFieldByName(refName, fields); + if (field == null) { + // No fields found. Again, since this is a multiplicity, we cannot match on business interface type, so + // scan through the fields, matching on name and List or Array + method = JavaIntrospectionHelper.findMultiplicityMethodByName(refName, methods); + if (method == null) { + throw new NoAccessorException(refName); + } + } + Injector injector; + // for multiplicities, we need to inject the reference proxy or proxies using an object factory + // which first delegates to create the proxies and then returns them in the appropriate List or array type + if (field != null) { + if (field.getType().isArray()) { + injector = new FieldInjector(field, new ArrayMultiplicityObjectFactory(refClass, objectFactories)); + } else { + injector = new FieldInjector(field, new ListMultiplicityObjectFactory(objectFactories)); + } + } else { + if (method.getParameterTypes()[0].isArray()) { + injector = new MethodInjector(method, new ArrayMultiplicityObjectFactory(refClass, objectFactories)); + } else { + injector = new MethodInjector(method, new ListMultiplicityObjectFactory(objectFactories)); + } + } + return injector; + } else { + field = JavaIntrospectionHelper.findClosestMatchingField(refName, refClass, fields); + if (field == null) { + // hack for TUSCANY-300 + for (Field current : fields) { + Reference annot = current.getAnnotation(Reference.class); + if (annot != null) { + if (refName.equals(annot.name())) { + field = current; + break; + } + } + } + if (field == null) { + method = JavaIntrospectionHelper.findClosestMatchingMethod(refName, new Class[]{refClass}, methods); + if(method == null){ + // Fix for Tuscany-325 + method = JavaIntrospectionHelper.findClosestMatchingMethod("set"+refName.substring(0,1).toUpperCase()+ refName.substring(1), new Class[]{refClass}, methods); + } + if (method == null) { + // hack for TUSCANY-300 + for (Method current : methods) { + Reference annot = current.getAnnotation(Reference.class); + if (annot != null) { + if (refName.equals(annot.name())) { + method = current; + break; + } + } + } + if (method == null) { + throw new NoAccessorException(refName); + } + } + } + } + Injector injector; + if (field != null) { + injector = new FieldInjector(field, objectFactories.get(0)); + } else { + injector = new MethodInjector(method, objectFactories.get(0)); + } + return injector; + } + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/context/JavaAtomicContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/context/JavaAtomicContext.java new file mode 100644 index 0000000000..27581198aa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/context/JavaAtomicContext.java @@ -0,0 +1,165 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.context; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.ContextInitException; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.event.InstanceCreated; +import org.apache.tuscany.core.context.impl.AbstractContext; +import org.apache.tuscany.core.injection.EventInvoker; +import org.apache.tuscany.core.injection.ObjectCallbackException; +import org.apache.tuscany.core.injection.ObjectCreationException; + +/** + * Manages Java component implementation instances + * + * @version $Rev$ $Date$ + */ +public class JavaAtomicContext extends AbstractContext implements AtomicContext { + + private boolean eagerInit; + + private EventInvoker initInvoker; + + private EventInvoker destroyInvoker; + + private boolean stateless; + + // the cached target instance + private Object cachedTargetInstance; + + // creates a new implementation instance with injected references and properties + private ObjectFactory objectFactory; + + public JavaAtomicContext(String name, ObjectFactory objectFactory, boolean eagerInit, EventInvoker initInvoker, + EventInvoker destroyInvoker, boolean stateless) { + super(name); + assert (objectFactory != null) : "Object factory was null"; + if (eagerInit && initInvoker == null) { + ContextInitException e = new ContextInitException("No intialization method found for implementation"); + e.setIdentifier(getName()); + throw e; + } + this.objectFactory = objectFactory; + + this.eagerInit = eagerInit; + this.initInvoker = initInvoker; + this.destroyInvoker = destroyInvoker; + this.stateless = stateless; + } + + public void setName(String name) { + super.setName(name); + } + + protected int type; + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public void init() throws TargetException { + getInstance(null); + } + + public void destroy() throws TargetException { + if (cachedTargetInstance != null) { + if (destroyInvoker != null) { + try { + destroyInvoker.invokeEvent(cachedTargetInstance); + } catch (ObjectCallbackException e) { + TargetException te = new TargetException(e.getCause()); + te.setIdentifier(getName()); + throw te; + } + } + } + lifecycleState = STARTED; + } + + public synchronized Object getInstance(QualifiedName qName) throws TargetException { + //TODO implement returning of proxy and wire chain for service + if (cachedTargetInstance != null) { + return cachedTargetInstance; // already cached, just return + } + + if (getLifecycleState() == ERROR || getLifecycleState() == CONFIG_ERROR) { + return null; + } + synchronized (this) { + try { + Object instance = objectFactory.getInstance(); + // handle @Init + if (initInvoker != null) { + initInvoker.invokeEvent(instance); + } + publish(new InstanceCreated(this)); + lifecycleState = RUNNING; + if (stateless) { + return instance; + } else { + cachedTargetInstance = instance; // cache the instance + return cachedTargetInstance; + } + } catch (ObjectCreationException e) { + lifecycleState = ERROR; + TargetException te = new TargetException("Error creating component instance", e); + te.setIdentifier(getName()); + throw te; + } + } + + } + + public Object getTargetInstance() throws TargetException { + //TODO refactor when getInstance() returns a proxy + return getInstance(null); + } + + public boolean isEagerInit() { + return eagerInit; + } + + public boolean isDestroyable() { + return (destroyInvoker != null); + } + + public void start() throws ContextInitException { + if (getLifecycleState() != UNINITIALIZED && getLifecycleState() != STOPPED) { + throw new IllegalStateException("Context must be in UNINITIALIZED state [" + getLifecycleState() + "]"); + } + if (objectFactory == null) { + lifecycleState = ERROR; + ContextInitException e = new ContextInitException("Object factory not found"); + e.setIdentifier(getName()); + throw e; + } + lifecycleState = INITIALIZED; + } + + public void stop() { + lifecycleState = STOPPED; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/AbstractJavaComponentInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/AbstractJavaComponentInvoker.java new file mode 100644 index 0000000000..33fa9238b6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/AbstractJavaComponentInvoker.java @@ -0,0 +1,93 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Set; + +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.InvocationRuntimeException; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.apache.tuscany.core.message.Message; + +/** + * Base class for dispatching to a Java based component implementation. Subclasses implement a strategy for resolving + * implementation instances. + * + * @version $Rev$ $Date$ + */ +public abstract class AbstractJavaComponentInvoker implements TargetInvoker { + + protected Method operation; + + public AbstractJavaComponentInvoker(Method operation) { + assert (operation != null) : "Operation method cannot be null"; + this.operation = operation; + } + + public Object invokeTarget(Object payload) throws InvocationTargetException { + try { + Object instance = getInstance(); + if (!operation.getDeclaringClass().isInstance(instance)) { + Set methods = JavaIntrospectionHelper.getAllUniqueMethods(instance.getClass()); + Method newOperation = JavaIntrospectionHelper.findClosestMatchingMethod(operation.getName(), operation + .getParameterTypes(), methods); + if (newOperation != null) + operation = newOperation; + } + if (payload != null && !payload.getClass().isArray()) { + return operation.invoke(instance, payload); + } else { + return operation.invoke(instance, (Object[]) payload); + } + } catch (IllegalAccessException e) { + throw new InvocationRuntimeException(e); + } + } + + public Message invoke(Message msg) { + try { + Object resp = invokeTarget(msg.getBody()); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBody(e.getCause()); + } catch (Throwable e) { + msg.setBody(e); + } + return msg; + } + + protected abstract Object getInstance() throws TargetException; + + public void setNext(Interceptor next) { + throw new IllegalStateException("This interceptor must be the last interceptor in an interceptor chain"); + } + + @Override + public Object clone() throws CloneNotSupportedException { + try { + AbstractJavaComponentInvoker clone = (AbstractJavaComponentInvoker) super.clone(); + clone.operation = this.operation; + return clone; + } catch (CloneNotSupportedException e) { + return null; // will not happen + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/ScopedJavaComponentInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/ScopedJavaComponentInvoker.java new file mode 100644 index 0000000000..85d72b4b0d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/ScopedJavaComponentInvoker.java @@ -0,0 +1,89 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation; + +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.TargetException; + +import java.lang.reflect.Method; + +/** + * Uses a scope container to resolve an implementation instance based on the current thread context + * + * @version $Rev$ $Date$ + */ +public class ScopedJavaComponentInvoker extends AbstractJavaComponentInvoker { + + private ScopeContext container; + + private QualifiedName name; + + private Object target; + + public boolean cacheable; + + + /** + * Creates a new invoker + * + * @param serviceName the name of the component/service pair to invoke + * @param operation the operation the invoker is associated with + * @param scopeContext the scope context the component is resolved in + * @param cacheable Sets whether the target service instance may be cached by the invoker. This is a possible optimization + * when a wire is configured for a "down-scope" reference, i.e. a reference from a source of a shorter + * lifetime to a source of greater lifetime. + */ + public ScopedJavaComponentInvoker(QualifiedName serviceName, Method operation, ScopeContext scopeContext, boolean cacheable) { + super(operation); + assert (serviceName != null) : "No service name specified"; + assert (scopeContext != null) : "No scope scopeContext specified"; + name = serviceName; + this.container = scopeContext; + this.cacheable = cacheable; + } + + /** + * Returns whether the target is cacheable. + */ + public boolean isCacheable() { + return cacheable; + } + + /** + * Resolves the target service instance or returns a cached one + */ + protected Object getInstance() throws TargetException { + if (!cacheable) { + return container.getInstance(name); + } else { + if (target == null) { + target = container.getInstance(name); + } + return target; + } + } + + public Object clone() throws CloneNotSupportedException { + ScopedJavaComponentInvoker invoker = (ScopedJavaComponentInvoker) super.clone(); + invoker.target = null; + invoker.cacheable = this.cacheable; + invoker.container = this.container; + invoker.name = this.name; + return invoker; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/StaticJavaComponentTargetInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/StaticJavaComponentTargetInvoker.java new file mode 100644 index 0000000000..dd757137cf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/invocation/StaticJavaComponentTargetInvoker.java @@ -0,0 +1,50 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation; + +import java.lang.reflect.Method; + +/** + * Caches component instances that do not need to be resolved for every wire, e.g. an wire originating from + * a lesser scope intended for a target with a wider scope + * + * @version $Rev$ $Date$ + */ +public class StaticJavaComponentTargetInvoker extends AbstractJavaComponentInvoker { + + private Object instance; + + public StaticJavaComponentTargetInvoker(Method operation, Object instance) { + super(operation); + assert (instance != null) : "Instance cannot be null"; + this.instance = instance; + } + + protected Object getInstance() { + return instance; + } + + public boolean isCacheable() { + return true; + } + + public Object clone() throws CloneNotSupportedException { + StaticJavaComponentTargetInvoker invoker = (StaticJavaComponentTargetInvoker) super.clone(); + invoker.instance = null; + return invoker; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/loader/JavaImplementationLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/loader/JavaImplementationLoader.java new file mode 100644 index 0000000000..db3dd07c98 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/java/org/apache/tuscany/container/java/loader/JavaImplementationLoader.java @@ -0,0 +1,165 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.loader; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; +import org.apache.tuscany.container.java.assembly.JavaImplementation; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.InvalidRootElementException; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.config.SidefileLoadException; +import org.apache.tuscany.core.config.processor.ProcessorUtils; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.StAXElementLoader; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.core.loader.assembly.AssemblyConstants; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.model.assembly.ComponentType; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class JavaImplementationLoader implements StAXElementLoader { + public static final QName IMPLEMENTATION_JAVA = new QName("http://www.osoa.org/xmlns/sca/0.9", "implementation.java"); + + private StAXLoaderRegistry registry; + private XMLInputFactory xmlFactory; + + private JavaAssemblyFactory factory; + private ComponentTypeIntrospector introspector; + + public JavaImplementationLoader() { + // todo make this a reference to a system service + xmlFactory = XMLInputFactory.newInstance(); + } + + @Autowire + public void setRegistry(StAXLoaderRegistry registry) { + this.registry = registry; + } + + @Autowire + public void setFactory(JavaAssemblyFactory factory) { + this.factory = factory; + //FIXME JFM HACK + introspector = ProcessorUtils.createCoreIntrospector(factory); + } + + @Init(eager = true) + public void start() { + registry.registerLoader(IMPLEMENTATION_JAVA, this); + } + + @Destroy + public void stop() { + registry.unregisterLoader(IMPLEMENTATION_JAVA, this); + } + + public JavaImplementation load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + JavaImplementation javaImpl = factory.createJavaImplementation(); + String typeName = reader.getAttributeValue(null, "class"); + Class implementationClass = getImplementationClass(loaderContext.getResourceLoader(), typeName); + javaImpl.setImplementationClass(implementationClass); + javaImpl.setComponentType(loadComponentType(loaderContext, implementationClass)); + return javaImpl; + } + + protected Class getImplementationClass(ResourceLoader resourceLoader, String typeName) throws ConfigurationLoadException { + ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); + try { + // set TCCL in case the application code needs it + Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader()); + return resourceLoader.loadClass(typeName); + } catch (ClassNotFoundException e) { + throw new ConfigurationLoadException(e.getMessage(), e); + } finally { + Thread.currentThread().setContextClassLoader(oldCL); + } + } + + protected ComponentType loadComponentType(LoaderContext loaderContext, Class implClass) throws ConfigurationLoadException, XMLStreamException { + String baseName = JavaIntrospectionHelper.getBaseName(implClass); + URL sidefile = implClass.getResource(baseName + ".componentType"); + if (sidefile == null) { + return loadComponentTypeByIntrospection(implClass); + } else { + return loadComponentTypeFromSidefile(sidefile, loaderContext); + } + } + + protected ComponentType loadComponentTypeByIntrospection(Class implClass) throws ConfigurationLoadException { + return introspector.introspect(implClass); + } + + protected ComponentType loadComponentTypeFromSidefile(URL sidefile, LoaderContext loaderContext) throws SidefileLoadException { + try { + XMLStreamReader reader; + InputStream is; + is = sidefile.openStream(); + try { + reader = xmlFactory.createXMLStreamReader(is); + try { + reader.nextTag(); + if (!AssemblyConstants.COMPONENT_TYPE.equals(reader.getName())) { + InvalidRootElementException e = new InvalidRootElementException(AssemblyConstants.COMPONENT_TYPE, reader.getName()); + e.setResourceURI(sidefile.toString()); + throw e; + } + return (ComponentType) registry.load(reader, loaderContext); + } finally { + try { + reader.close(); + } catch (XMLStreamException e) { + // ignore + } + } + } finally { + try { + is.close(); + } catch (IOException e) { + // ignore + } + } + } catch (IOException e) { + SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); + sfe.setResourceURI(sidefile.toString()); + throw sfe; + } catch (XMLStreamException e) { + SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); + sfe.setResourceURI(sidefile.toString()); + throw sfe; + } catch (ConfigurationLoadException e) { + SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); + sfe.setResourceURI(sidefile.toString()); + throw sfe; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/org/apache/tuscany/container/java/Messages.properties b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/org/apache/tuscany/container/java/Messages.properties new file mode 100644 index 0000000000..4581e44bff --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/org/apache/tuscany/container/java/Messages.properties @@ -0,0 +1,25 @@ +# 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. +# ==================================================================== +# To code developer: +# Do NOT change the properties between this line and the +# "%%% END OF TRANSLATED PROPERTIES %%%" line. +# Make a new property name, append to the end of the file and change +# the code to use the new property. +# ==================================================================== + +# ===================================================================== +# %%% END OF TRANSLATED PROPERTIES %%% +# ===================================================================== +# NLS_MESSAGEFORMAT_ALL diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/system.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/system.fragment new file mode 100644 index 0000000000..6aab9b8510 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/resources/system.fragment @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/test/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/test/sca.module new file mode 100644 index 0000000000..1c1ddafb53 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/main/test/sca.module @@ -0,0 +1,75 @@ + + + + + + + + MyFoo + 1 + + + TestService2 + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.componentType b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.componentType new file mode 100644 index 0000000000..784d8bf728 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.componentType @@ -0,0 +1,23 @@ + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.java new file mode 100644 index 0000000000..74f4c658ce --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldImpl.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.mock; + +/** + * @version $Rev$ $Date$ + */ +public class HelloWorldImpl implements HelloWorldService { + + private String text; + + private int count; + + public String hello(String name) { + ++count; + return "Hello " + name; + } + + public int count() { + return count; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldService.java new file mode 100644 index 0000000000..a7d0fe7788 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldService.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.mock; + +/** + * @version $Rev$ $Date$ + */ +public interface HelloWorldService { + String hello(String name); + + public int count(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldWithFieldProperties.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldWithFieldProperties.java new file mode 100644 index 0000000000..0801c56f44 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/HelloWorldWithFieldProperties.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.mock; + +import org.osoa.sca.annotations.Property; + +/** + * @version $Rev$ $Date$ + */ +public class HelloWorldWithFieldProperties { + @Property + protected String text; + + @Property(required = true) + public Integer text2; + + @Property(name = "foo") + public int text3; + + @Property(name = "not exposed") + protected int field4; + + public String hello(String name) { + return "Hello " + name; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorld.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorld.java new file mode 100644 index 0000000000..2f1ae5d17b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorld.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.mock; + +/** + * @version $Rev$ $Date$ + */ +public class NakedHelloWorld { + public String hello(String name) { + return "Hello " + name; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorldWithInterface.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorldWithInterface.java new file mode 100644 index 0000000000..9d5fe5e969 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/mock/NakedHelloWorldWithInterface.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.mock; + +import java.io.Serializable; + +/** + * @version $Rev$ $Date$ + */ +public class NakedHelloWorldWithInterface implements Serializable { + public String hello(String name) { + return "Hello " + name; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountReport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountReport.java new file mode 100644 index 0000000000..1770c2b011 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountReport.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.account; + +import java.util.List; + +/** + * @model + */ + +public interface AccountReport { + + /** + * @model type="services.account.AccountSummary" + */ + + List getAccountSummaries(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.java new file mode 100644 index 0000000000..1bb938655f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.account; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface AccountService { + + public AccountReport getAccountReport(String customerID); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.wsdl new file mode 100644 index 0000000000..022258f2c5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountService.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java new file mode 100644 index 0000000000..9a5ddb0005 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.account; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +import org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata.AccountDataService; +import org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.stockquote.StockQuoteService; + +public class AccountServiceImpl implements AccountService { + + @Property + public String currency = "USD"; + + @Reference + public AccountDataService accountDataService; + @Reference + public StockQuoteService stockQuoteService; + + public AccountServiceImpl() { + } + + public AccountReport getAccountReport(String customerID) { + return null; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountSummary.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountSummary.java new file mode 100644 index 0000000000..2b11e23425 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/account/AccountSummary.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.account; + +/** + * @model + */ + +public interface AccountSummary { + + /** + * @model + */ + String getAccountNumber(); + + void setAccountNumber(String accountNumber); + + /** + * @model + */ + String getAccountType(); + + void setAccountType(String accountType); + + /** + * @model + */ + float getBalance(); + + void setBalance(float balance); +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java new file mode 100644 index 0000000000..56f24ea4ac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata; + +public interface AccountDataService { + + CheckingAccount getCheckingAccount(String customerID); + + SavingsAccount getSavingsAccount(String customerID); + + StockAccount getStockAccount(String customerID); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..a7a40f954d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata; + +public class AccountDataServiceImpl implements AccountDataService { + + public CheckingAccount getCheckingAccount(String customerID) { + + CheckingAccount checkingAccount = new CheckingAccount(); + checkingAccount.setAccountNumber(customerID + "_" + "CHA12345"); + checkingAccount.setBalance(1500.0f); + + return checkingAccount; + } + + public SavingsAccount getSavingsAccount(String customerID) { + + SavingsAccount savingsAccount = new SavingsAccount(); + savingsAccount.setAccountNumber(customerID + "_" + "SAA12345"); + savingsAccount.setBalance(1500.0f); + + return savingsAccount; + } + + public StockAccount getStockAccount(String customerID) { + + StockAccount stockAccount = new StockAccount(); + stockAccount.setAccountNumber(customerID + "_" + "STA12345"); + stockAccount.setSymbol("IBM"); + stockAccount.setQuantity(100); + + return stockAccount; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java new file mode 100644 index 0000000000..ff84e9968a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata; + +public class CheckingAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java new file mode 100644 index 0000000000..b39d9051de --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata; + +public class SavingsAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/StockAccount.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/StockAccount.java new file mode 100644 index 0000000000..bce0821b25 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/accountdata/StockAccount.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.accountdata; + +public class StockAccount { + + private String accountNumber; + private String symbol; + private int quantity; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..78ece12b41 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.stockquote; + +public interface StockQuoteService { + + public float getQuote(String symbol); +} + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java new file mode 100644 index 0000000000..fa180d0ceb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.assembly.tests.bigbank.account.services.stockquote; + +/* Dummy'd up StockQuoteService, override webservice for now */ + +public class StockQuoteServiceImpl implements StockQuoteService { + + public float getQuote(String symbol) { + // Just hardcode for now + return 83.00f; + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl new file mode 100644 index 0000000000..6af61ef80e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilderTestCase.java new file mode 100644 index 0000000000..fcfd320e0e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaContextFactoryBuilderTestCase.java @@ -0,0 +1,112 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.builder; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.GenericComponent; +import org.apache.tuscany.container.java.mock.components.ModuleScopeComponent; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; +import org.apache.tuscany.core.context.scope.ModuleScopeContext; +import org.apache.tuscany.core.context.ScopeStrategy; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.wire.WireConfiguration; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.Module; + +public class JavaContextFactoryBuilderTestCase extends TestCase { + + public JavaContextFactoryBuilderTestCase() { + } + + public void testBuilder() throws Exception { + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, true); + PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); + policyRegistry.registerSourceBuilder(interceptorBuilder); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); + JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); + + JavaTargetWireBuilder javaWireBuilder = new JavaTargetWireBuilder(); + ScopeStrategy strategy = new DefaultScopeStrategy(); + DefaultWireBuilder wireBuilder = new DefaultWireBuilder(); + wireBuilder.addWireBuilder(javaWireBuilder); + Module module = MockFactory.createModule(); + EventContext eCtx = new EventContextImpl(); + ScopeContext scopeContext = new ModuleScopeContext(eCtx); + scopeContext.start(); + scopeContext.onEvent(new ModuleStart(this)); + List components = module.getComponents(); + Map compMap = new HashMap(components.size()); + + for (Component component : components) { + compMap.put(component.getName(), component); + builder.build(component); + ContextFactory contextFactory = (ContextFactory) component.getContextFactory(); + Assert.assertNotNull(contextFactory); + } + for (Component component : components) { + ContextFactory source = (ContextFactory) component.getContextFactory(); + Assert.assertNotNull(source); + for (SourceWireFactory pFactory : source.getSourceWireFactories()) { + WireConfiguration pConfig = pFactory.getConfiguration(); + Component target = compMap.get(pConfig.getTargetName().getPartName()); + + if (target != null) { + ContextFactory targetConfig = (ContextFactory) target.getContextFactory(); + boolean downScope = strategy.downScopeReference(source.getScope(), targetConfig.getScope()); + wireBuilder.connect(pFactory, targetConfig.getTargetWireFactory(pFactory.getConfiguration().getTargetName() + .getPortName()), targetConfig.getClass(), downScope, scopeContext); + } + pFactory.initialize(); + } + scopeContext.registerFactory(source); + } + for (Component component : components) { + ContextFactory config = (ContextFactory) component.getContextFactory(); + Context context = config.createContext(); + if ("source".equals(component.getName())) { + ModuleScopeComponent source = (ModuleScopeComponent) context.getInstance(null); + Assert.assertNotNull(source); + GenericComponent gComp = source.getGenericComponent(); + gComp.getString(); + } + } + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilderTestCase.java new file mode 100644 index 0000000000..5a0ee8e14c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/JavaTargetWireBuilderTestCase.java @@ -0,0 +1,132 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.builder; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.config.JavaContextFactory; +import org.apache.tuscany.container.java.invocation.mock.MockHandler; +import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; +import org.apache.tuscany.container.java.invocation.mock.SimpleTarget; +import org.apache.tuscany.container.java.invocation.mock.SimpleTargetImpl; +import org.apache.tuscany.container.java.mock.MockScopeContext; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.wire.MethodHashMap; +import org.apache.tuscany.core.wire.impl.InvokerInterceptor; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; + +public class JavaTargetWireBuilderTestCase extends TestCase { + + private Method hello; + + public JavaTargetWireBuilderTestCase() { + } + + public JavaTargetWireBuilderTestCase(String arg0) { + super(arg0); + } + + public void setUp() throws Exception { + hello = SimpleTarget.class.getMethod("hello", String.class); + } + + + /** + * Tests basic wiring of a source to a target, including handlers and interceptors + */ + public void testInvocation() throws Exception { + MessageFactory msgFactory = new MessageFactoryImpl(); + + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockHandler sourceRequestHandler = new MockHandler(); + MockHandler sourceResponseHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addResponseHandler(sourceResponseHandler); + source.addInterceptor(sourceInterceptor); + + SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); + Map sourceInvocationConfigs = new MethodHashMap(); + sourceInvocationConfigs.put(hello, source); + WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), + sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + sourceFactory.setConfiguration(sourceConfig); + sourceFactory.setBusinessInterface(SimpleTarget.class); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockHandler targetResponseHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addResponseHandler(targetResponseHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + TargetWireFactory targetFactory = new JDKWireFactoryFactory().createTargetWireFactory(); + Map targetInvocationConfigs = new MethodHashMap(); + targetInvocationConfigs.put(hello, target); + WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), + targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + targetFactory.setConfiguration(targetConfig); + targetFactory.setBusinessInterface(SimpleTarget.class); + + // bootstrap a scope container with the target in it + Map instances = new HashMap(); + SimpleTarget simpleTarget = new SimpleTargetImpl(); + instances.put("target",simpleTarget); + MockScopeContext scopeCtx = new MockScopeContext(instances); + + // connect the source to the target + DefaultWireBuilder builder = new DefaultWireBuilder(); + builder.addWireBuilder(new JavaTargetWireBuilder()); + + builder.connect(sourceFactory, targetFactory, JavaContextFactory.class, true, scopeCtx); + source.build(); + target.build(); + Assert.assertNotNull(source.getTargetInvoker()); + + Message msg = msgFactory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(source.getTargetInvoker()); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, sourceRequestHandler.getCount()); + Assert.assertEquals(1, sourceResponseHandler.getCount()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetRequestHandler.getCount()); + Assert.assertEquals(1, targetResponseHandler.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockHandlerBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockHandlerBuilder.java new file mode 100644 index 0000000000..bd1c13c4ac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockHandlerBuilder.java @@ -0,0 +1,120 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.builder; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.SourcePolicyBuilder; +import org.apache.tuscany.core.builder.TargetPolicyBuilder; +import org.apache.tuscany.core.wire.InvocationConfiguration; +import org.apache.tuscany.core.wire.MessageHandler; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; + +import java.util.List; + +/** + * Adds a handler to a source or target proxy configuration + * + * @version $Rev$ $Date$ + */ +public class MockHandlerBuilder implements SourcePolicyBuilder, TargetPolicyBuilder { + + + private MessageHandler handler; + + private boolean source; + + private boolean request; + + /** + * Creates the builder. + * + * @param handler the handler to add to the source or target proxy configuration + * @param source true if the handler should be added on the source side; false if the handler should be added to the target + * side + * @param request true if the handler is a request handler; false if the handler is a response handler + */ + public MockHandlerBuilder(MessageHandler handler, boolean source, boolean request) { + this.handler = handler; + this.source = source; + this.request = request; + } + + public void build(AssemblyObject modelObject) throws BuilderException { + if (source) { + if (!(modelObject instanceof ConfiguredReference)) { + return; + } else { + ConfiguredReference cref = (ConfiguredReference) modelObject; + // /xcv WireFactory pFactory = (WireFactory) cref.getProxyFactory(); + for (ConfiguredService configuredService : cref.getTargetConfiguredServices()) { + SourceWireFactory pFactory = (SourceWireFactory) configuredService.getProxyFactory(); + for (InvocationConfiguration config : pFactory.getConfiguration().getInvocationConfigurations().values()) { + if (request) { + config.addRequestHandler(handler); + } else { + config.addResponseHandler(handler); + } + } + } + } + } else { + if (!(modelObject instanceof ConfiguredService)) { + return; + } else { + ConfiguredService cservice = (ConfiguredService) modelObject; + TargetWireFactory pFactory = (TargetWireFactory) cservice.getProxyFactory(); + for (InvocationConfiguration config : pFactory.getConfiguration().getInvocationConfigurations().values()) { + if (request) { + config.addRequestHandler(handler); + } else { + config.addResponseHandler(handler); + } + } + } + + } + } + + public void build(ConfiguredReference reference, List configurations) throws BuilderException { + for (WireSourceConfiguration wireSourceConfiguration : configurations) { + for (SourceInvocationConfiguration configuration : wireSourceConfiguration.getInvocationConfigurations().values()) { + if (request) { + configuration.addRequestHandler(handler); + } else { + configuration.addResponseHandler(handler); + } + + } + + } + } + + public void build(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException { + for (TargetInvocationConfiguration config : configuration.getInvocationConfigurations().values()) { + if (request) { + config.addRequestHandler(handler); + } else { + config.addResponseHandler(handler); + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockInterceptorBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockInterceptorBuilder.java new file mode 100644 index 0000000000..d3ad8a53b5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/builder/MockInterceptorBuilder.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.builder; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.SourcePolicyBuilder; +import org.apache.tuscany.core.builder.TargetPolicyBuilder; +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.WireFactory; +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; + +import java.util.List; + +/** + * Adds an interceptor to a source or target proxy configuration + * + * @version $Rev$ $Date$ + */ +public class MockInterceptorBuilder implements SourcePolicyBuilder, TargetPolicyBuilder { + + private Interceptor interceptor; + + /** + * Creates the builder + * + * @param interceptor the interceptor ot add + * @param source true if the interceptor should be added to the source side; false if the interceptor should be added to + * the target side + */ + public MockInterceptorBuilder(Interceptor interceptor, boolean source) { + this.interceptor = interceptor; + } + + public void build(ConfiguredReference reference, List configurations) throws BuilderException { + for (WireSourceConfiguration wireSourceConfiguration : configurations) { + for (SourceInvocationConfiguration configuration : wireSourceConfiguration.getInvocationConfigurations().values()) { + configuration.addInterceptor(interceptor); + } + } + } + + public void build(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException { + for (TargetInvocationConfiguration config : configuration.getInvocationConfigurations().values()) { + config.addInterceptor(interceptor); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/DifferentInterfaceWireTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/DifferentInterfaceWireTestCase.java new file mode 100644 index 0000000000..ed91b9cb9b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/DifferentInterfaceWireTestCase.java @@ -0,0 +1,81 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.context; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.builder.JavaTargetWireBuilder; +import org.apache.tuscany.container.java.mock.MockConfigContext; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.OtherTarget; +import org.apache.tuscany.container.java.mock.components.Source; +import org.apache.tuscany.container.java.mock.components.Target; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.WireBuilder; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Tests wires that have different interfaces on the source and target side + * + * @version $Rev$ $Date$ + */ +public class DifferentInterfaceWireTestCase extends TestCase { + + public void testMultiplicity() throws Exception { + + CompositeContext context = createContext(); + context.start(); + context.registerModelObject(MockFactory.createModuleWithWiredComponentsOfDifferentInterface(Scope.MODULE, Scope.MODULE)); + context.publish(new ModuleStart(this)); + Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); + Assert.assertNotNull(source); + OtherTarget target = (OtherTarget) ((AtomicContext)context.getContext("target")).getTargetInstance(); + Assert.assertNotNull(target); + // test setter injection + List targets = source.getTargets(); + Assert.assertEquals(1, targets.size()); + + // test field injection + targets = source.getTargetsThroughField(); + Assert.assertEquals(1, targets.size()); + targets.get(0).setString("foo"); + Assert.assertEquals("foo",target.getString()); + } + + private CompositeContext createContext() { + CompositeContextImpl context = new CompositeContextImpl(); + context.setName("system.context"); + Listbuilders = MockFactory.createSystemBuilders(); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); + builders.add(new JavaContextFactoryBuilder(wireService)); + List wireBuilders = new ArrayList(); + wireBuilders.add(new JavaTargetWireBuilder()); + context.setConfigurationContext(new MockConfigContext(builders,wireBuilders)); + return context; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextLifecycleTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextLifecycleTestCase.java new file mode 100644 index 0000000000..c257a1f892 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextLifecycleTestCase.java @@ -0,0 +1,59 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.context; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.ModuleScopeInitOnlyComponent; +import org.apache.tuscany.container.java.mock.components.ModuleScopeInitDestroyComponent; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Tests init and destroy lifecycle callbacks are handled properly + * + * @version $Rev$ $Date$ + */ +public class JavaAtomicContextLifecycleTestCase extends TestCase { + + public void testComponentNameSet() throws Exception { + CompositeContext mc = new CompositeContextImpl(); + mc.setName("mc"); + JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit", + ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc); + context.start(); + ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null); + Assert.assertNotNull(instance); + Assert.assertEquals("TestServiceInit", instance.getName()); + context.stop(); + } + + public void testModuleContextSet() throws Exception { + CompositeContext mc = new CompositeContextImpl(); + mc.setName("mc"); + JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit", + ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc); + context.start(); + ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null); + Assert.assertNotNull(instance); + Assert.assertEquals(mc, instance.getModuleContext()); + context.stop(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextMetadataInjectionTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextMetadataInjectionTestCase.java new file mode 100644 index 0000000000..a79a04f5ab --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextMetadataInjectionTestCase.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.context; + +import junit.framework.TestCase; +import junit.framework.Assert; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.ModuleScopeInitOnlyComponent; +import org.apache.tuscany.container.java.mock.components.ModuleScopeInitDestroyComponent; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Tests SCA metadata such as @ComponentName and @Context are handled properly + * + * @version $Rev: 394173 $ $Date: 2006-04-14 11:54:59 -0700 (Fri, 14 Apr 2006) $ + */ +public class JavaAtomicContextMetadataInjectionTestCase extends TestCase { + + public void testComponentNameSet() throws Exception { + CompositeContext mc = new CompositeContextImpl(); + mc.setName("mc"); + JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit", + ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc); + context.start(); + ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null); + Assert.assertNotNull(instance); + Assert.assertEquals("TestServiceInit", instance.getName()); + context.stop(); + } + + public void testModuleContextSet() throws Exception { + CompositeContext mc = new CompositeContextImpl(); + mc.setName("mc"); + JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit", + ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc); + context.start(); + ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null); + Assert.assertNotNull(instance); + Assert.assertEquals(mc, instance.getModuleContext()); + context.stop(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextNegativeMetadataTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextNegativeMetadataTestCase.java new file mode 100644 index 0000000000..0a4527f405 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextNegativeMetadataTestCase.java @@ -0,0 +1,73 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.context; + +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.BadContextPojo; +import org.apache.tuscany.container.java.mock.components.BadNamePojo; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Performs rudimentary negative testing by using malformed metadata on a POJO + * + * @version $Rev $Date + */ +public class JavaAtomicContextNegativeMetadataTestCase extends TestCase { + + /** + * Tests that a pojo with @ComponentName specified on a non-String type generates an error. + *

+ * NB: the test assumes an error with a message containing + * "@ComponentName" is generated + */ + public void testBadNameType() throws Exception { + CompositeContext mc = new CompositeContextImpl(); + mc.setName("mc"); + try { + MockFactory.createPojoContext("BadNamePojo", BadNamePojo.class, Scope.MODULE, mc); + } catch (NoSuchMethodException e) { + if (e.getMessage().indexOf("@ComponentName") < 0) { + throw e; + } + } + + } + + /** + * Tests that a pojo with @Context specified on a non-ModuleContext type generates an error. + *

+ * NB: the test assumes an error with a message containing + * "@Context" is generated + */ + public void testContextType() throws Exception { + CompositeContext mc = new CompositeContextImpl(); + mc.setName("mc"); + try { + MockFactory.createPojoContext("BadContextPojo", BadContextPojo.class, Scope.MODULE, mc); + } catch (NoSuchMethodException e) { + if (e.getMessage().indexOf("@Context") < 0) { + throw e; + } + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextScopeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextScopeTestCase.java new file mode 100644 index 0000000000..96bff0cf2e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/JavaAtomicContextScopeTestCase.java @@ -0,0 +1,95 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.context; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; +import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; +import org.apache.tuscany.container.java.mock.components.GenericComponent; +import org.apache.tuscany.container.java.mock.components.ModuleScopeComponentImpl; +import org.apache.tuscany.container.java.mock.components.RequestScopeComponentImpl; +import org.apache.tuscany.container.java.mock.components.SessionScopeComponentImpl; +import org.apache.tuscany.container.java.mock.components.StatelessComponentImpl; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.injection.PojoObjectFactory; + +/** + * Tests {@link JavaAtomicContext} to ensure it handles component scopes properly + * + * @version $Rev$ $Date$ + */ +public class JavaAtomicContextScopeTestCase extends TestCase { + + JavaAssemblyFactory factory = new JavaAssemblyFactoryImpl(); + + public void testGetModuleInstance() throws Exception { + CompositeContext mc = new CompositeContextImpl(); + mc.setName("mc"); + JavaAtomicContext c = new JavaAtomicContext("foo", new PojoObjectFactory(JavaIntrospectionHelper + .getDefaultConstructor(ModuleScopeComponentImpl.class), null, null), false, null, null, false); + GenericComponent service = (GenericComponent) c.getInstance(null); + Assert.assertNotNull(service); + service.setString("foo"); + GenericComponent service2 = (GenericComponent) c.getInstance(null); + Assert.assertNotNull(service2); + Assert.assertSame(service, service2); + } + + public void testGetSessionInstance() throws Exception { + CompositeContext mc = new CompositeContextImpl(); + mc.setName("mc"); + JavaAtomicContext c = new JavaAtomicContext("foo", new PojoObjectFactory(JavaIntrospectionHelper + .getDefaultConstructor(SessionScopeComponentImpl.class), null, null), false, null, null, false); + GenericComponent service = (GenericComponent) c.getInstance(null); + Assert.assertNotNull(service); + service.setString("foo"); + GenericComponent service2 = (GenericComponent) c.getInstance(null); + Assert.assertNotNull(service2); + Assert.assertSame(service, service2); + } + + public void testGetRequestInstance() throws Exception { + CompositeContext mc = new CompositeContextImpl(); + mc.setName("mc"); + JavaAtomicContext c = new JavaAtomicContext("foo", new PojoObjectFactory(JavaIntrospectionHelper + .getDefaultConstructor(RequestScopeComponentImpl.class), null, null), false, null, null, false); + GenericComponent service = (GenericComponent) c.getInstance(null); + Assert.assertNotNull(service); + service.setString("foo"); + GenericComponent service2 = (GenericComponent) c.getInstance(null); + Assert.assertNotNull(service2); + Assert.assertSame(service, service2); + } + + public void testGetStatelessInstance() throws Exception { + CompositeContext mc = new CompositeContextImpl(); + mc.setName("fooContext"); + JavaAtomicContext c = new JavaAtomicContext("foo", new PojoObjectFactory(JavaIntrospectionHelper + .getDefaultConstructor(StatelessComponentImpl.class), null, null), false, null, null, true); + GenericComponent service = (GenericComponent) c.getInstance(null); + Assert.assertNotNull(service); + service.setString("foo"); + GenericComponent service2 = (GenericComponent) c.getInstance(null); + Assert.assertNotNull(service2); + Assert.assertTrue(!"foo".equals(service2.getString())); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/MultiplicityTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/MultiplicityTestCase.java new file mode 100644 index 0000000000..a22a8dfce2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/context/MultiplicityTestCase.java @@ -0,0 +1,77 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.context; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.builder.JavaTargetWireBuilder; +import org.apache.tuscany.container.java.mock.MockConfigContext; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.Source; +import org.apache.tuscany.container.java.mock.components.Target; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.WireBuilder; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Tests wires that are configured with a multiplicity + * + * @version $Rev$ $Date$ + */ +public class MultiplicityTestCase extends TestCase { + + public void testMultiplicity() throws Exception { + CompositeContext context = createContext(); + context.start(); + context.registerModelObject(MockFactory.createModuleWithWiredComponents(Scope.MODULE, Scope.MODULE)); + context.publish(new ModuleStart(this)); + Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); + Assert.assertNotNull(source); + Target target = (Target) ((AtomicContext)context.getContext("target")).getTargetInstance(); + Assert.assertNotNull(target); + // test setter injection + List targets = source.getTargets(); + Assert.assertEquals(1, targets.size()); + + // test field injection + targets = source.getTargetsThroughField(); + Assert.assertEquals(1, targets.size()); + } + + private CompositeContext createContext() { + CompositeContextImpl context = new CompositeContextImpl(); + context.setName("system.context"); + Listbuilders = MockFactory.createSystemBuilders(); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); + builders.add(new JavaContextFactoryBuilder(wireService)); + List wireBuilders = new ArrayList(); + wireBuilders.add(new JavaTargetWireBuilder()); + context.setConfigurationContext(new MockConfigContext(builders,wireBuilders)); + return context; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java new file mode 100644 index 0000000000..58180674b3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +/** + * @version $Rev$ $Date$ + */ +public interface GreetingProvider { + String getGreeting(String name, String locale); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java new file mode 100644 index 0000000000..fef068c22e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(GreetingProvider.class) +public class GreetingProviderImpl implements GreetingProvider { + + public String greeting; + + @Property + public void setGreeting(String greeting) { + this.greeting = greeting; + } + + public String getGreeting(String name, String locale) { + if ("fr".equals(locale)) { + return "Bonjour " + name; + } else { + return greeting + name; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldImpl.java new file mode 100644 index 0000000000..9ff58f2d8d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldImpl.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + public String getGreetings(String name) { + return "Hello " + name; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java new file mode 100644 index 0000000000..aa5069c232 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; +import org.apache.tuscany.core.sdo.helper.SDOHelper; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.DataFactory; + +/** + * @version $Rev$ $Date$ + */ +@Service(HelloWorldService.class) +public class HelloWorldMCImpl implements HelloWorldService { + + @Property + public String locale; + + public String getBar() { + return bar; + } + + @Property(name= "bar", required=true) + public void setXBar(String bar) { + this.bar = bar; + } + + public String bar; + + @Reference(name="greetingProvider") + public void setGreetingProvider(GreetingProvider greetingProvider) { + this.greetingProvider2 = greetingProvider; + } + + public GreetingProvider greetingProvider2; + + @Reference(required=false) + public GreetingProvider foo; + + public String getGreetings(String name) { + return greetingProvider2.getGreeting(name, locale); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java new file mode 100644 index 0000000000..5a73abd45a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java @@ -0,0 +1,59 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +import java.net.URL; +import java.net.URLClassLoader; + +import junit.framework.TestCase; +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * @version $Rev$ $Date$ + */ +public class HelloWorldMCTestCase extends TestCase { + private ClassLoader oldCL; + + public void testHelloWorld() throws Exception { + TuscanyRuntime tuscany = new TuscanyRuntime("test", "foo"); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + assertNotNull(moduleContext); + assertEquals("foo", moduleContext.getURI()); + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld"); + assertNotNull(helloworldService); + + String value = helloworldService .getGreetings("World"); + assertEquals("Hello World", value); + tuscany.stop(); + } + + protected void setUp() throws Exception { + super.setUp(); + URL url = getClass().getResource("/helloworldmc/"); + ClassLoader cl = new URLClassLoader(new URL[]{url}, getClass().getClassLoader()); + oldCL = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(cl); + } + + protected void tearDown() throws Exception { + Thread.currentThread().setContextClassLoader(oldCL); + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldService.java new file mode 100644 index 0000000000..3abb99d7e0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldService.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +/** + * @version $Rev$ $Date$ + */ +public interface HelloWorldService { + public String getGreetings(String name); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java new file mode 100644 index 0000000000..c714b416e4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +import java.net.URL; +import java.net.URLClassLoader; + +import junit.framework.TestCase; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import org.apache.tuscany.core.client.TuscanyRuntime; + +/** + * @version $Rev$ $Date$ + */ +public class HelloWorldTestCase extends TestCase { + private ClassLoader oldCL; + + public void testHelloWorld() throws Exception { + TuscanyRuntime tuscany = new TuscanyRuntime("test", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + assertNotNull(moduleContext); + + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld"); + assertNotNull(helloworldService); + + String value = helloworldService .getGreetings("World"); + assertEquals("Hello World", value); + + tuscany.stop(); + } + + protected void setUp() throws Exception { + super.setUp(); + URL url = getClass().getResource("/helloworld/"); + ClassLoader cl = new URLClassLoader(new URL[]{url}, getClass().getClassLoader()); + oldCL = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(cl); + } + + protected void tearDown() throws Exception { + Thread.currentThread().setContextClassLoader(oldCL); + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaBuilderContextIntegrationTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaBuilderContextIntegrationTestCase.java new file mode 100644 index 0000000000..f7cc2ed149 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaBuilderContextIntegrationTestCase.java @@ -0,0 +1,189 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.builder.JavaTargetWireBuilder; +import org.apache.tuscany.container.java.builder.MockHandlerBuilder; +import org.apache.tuscany.container.java.builder.MockInterceptorBuilder; +import org.apache.tuscany.container.java.invocation.mock.MockHandler; +import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.GenericComponent; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.runtime.RuntimeContextImpl; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.wire.service.WireFactoryService; + +/** + * Verifies that the composite context implementation and java component builders construct references properly + * + * @version $Rev$ $Date$ + */ +public class JavaBuilderContextIntegrationTestCase extends TestCase { + private ContextFactoryBuilderRegistry builderRegistry; + private DefaultWireBuilder defaultWireBuilder; + private NullMonitorFactory monitorFactory; + + public JavaBuilderContextIntegrationTestCase(String arg0) { + super(arg0); + } + + protected void setUp() throws Exception { + super.setUp(); + monitorFactory = new NullMonitorFactory(); + builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); + defaultWireBuilder = new DefaultWireBuilder(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + public void testRefWithSourceInterceptor() throws Exception { + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, true); + PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); + policyRegistry.registerSourceBuilder(interceptorBuilder); + WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); + JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory); + + builderRegistry.register(javaBuilder); + + RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder); + runtime.addBuilder(new JavaTargetWireBuilder()); + runtime.start(); + runtime.getRootContext().registerModelObject( + MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModule()); + child.publish(new ModuleStart(this)); + GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null); + Assert.assertNotNull(source); + source.getGenericComponent().getString(); + Assert.assertEquals(1, mockInterceptor.getCount()); + source.getGenericComponent().getString(); + Assert.assertEquals(2, mockInterceptor.getCount()); + child.publish(new ModuleStop(this)); + runtime.stop(); + } + + public void testRefWithSourceInterceptorHandler() throws Exception { + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, true); + MockHandler mockHandler = new MockHandler(); + MockHandlerBuilder handlerBuilder = new MockHandlerBuilder(mockHandler, true, true); + PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); + policyRegistry.registerSourceBuilder(interceptorBuilder); + policyRegistry.registerSourceBuilder(handlerBuilder); + WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); + JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory); + + builderRegistry.register(javaBuilder); + RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder); + runtime.addBuilder(new JavaTargetWireBuilder()); + runtime.start(); + runtime.getRootContext().registerModelObject( + MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModule()); + child.publish(new ModuleStart(this)); + GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null); + Assert.assertNotNull(source); + source.getGenericComponent().getString(); + Assert.assertEquals(1, mockInterceptor.getCount()); + Assert.assertEquals(1, mockHandler.getCount()); + source.getGenericComponent().getString(); + Assert.assertEquals(2, mockInterceptor.getCount()); + Assert.assertEquals(2, mockHandler.getCount()); + child.publish(new ModuleStop(this)); + runtime.stop(); + } + + public void testRefWithTargetInterceptorHandler() throws Exception { + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); + MockHandler mockHandler = new MockHandler(); + MockHandlerBuilder handlerBuilder = new MockHandlerBuilder(mockHandler, false, true); + PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); + policyRegistry.registerSourceBuilder(interceptorBuilder); + policyRegistry.registerSourceBuilder(handlerBuilder); + WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); + JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory); + + builderRegistry.register(javaBuilder); + + RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder); + runtime.addBuilder(new JavaTargetWireBuilder()); + runtime.start(); + runtime.getRootContext().registerModelObject( + MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModule()); + child.publish(new ModuleStart(this)); + GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null); + Assert.assertNotNull(source); + source.getGenericComponent().getString(); + Assert.assertEquals(1, mockInterceptor.getCount()); + Assert.assertEquals(1, mockHandler.getCount()); + source.getGenericComponent().getString(); + Assert.assertEquals(2, mockInterceptor.getCount()); + Assert.assertEquals(2, mockHandler.getCount()); + child.publish(new ModuleStop(this)); + runtime.stop(); + } + + public void testRefWithTargetInterceptor() throws Exception { + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); + PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); + policyRegistry.registerSourceBuilder(interceptorBuilder); + WireFactoryService wireFactory = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); + JavaContextFactoryBuilder javaBuilder = new JavaContextFactoryBuilder(wireFactory); + + builderRegistry.register(javaBuilder); + + RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, defaultWireBuilder); + runtime.addBuilder(new JavaTargetWireBuilder()); + + runtime.start(); + runtime.getRootContext().registerModelObject( + MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModule()); + child.publish(new ModuleStart(this)); + GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null); + Assert.assertNotNull(source); + source.getGenericComponent().getString(); + Assert.assertEquals(1, mockInterceptor.getCount()); + source.getGenericComponent().getString(); + Assert.assertEquals(2, mockInterceptor.getCount()); + child.publish(new ModuleStop(this)); + runtime.stop(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java new file mode 100644 index 0000000000..a5ec39480f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaIntegrationTestCase.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +import junit.framework.TestCase; + +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; +import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; +import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.runtime.RuntimeContextImpl; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleComponent; + +/** + * Integration test that verifies container.java can be used to host components. + * + * @version $Rev$ $Date$ + */ +public class JavaIntegrationTestCase extends TestCase { + private JavaAssemblyFactory factory; + private RuntimeContext runtime; + + public void testModuleWithOneComponent() throws Exception { + Module module = factory.createModule(); + ModuleComponent moduleComponent = factory.createModuleComponent(); + moduleComponent.setImplementation(module); + +// runtime.registerModelObject(moduleComponent); + } + + protected void setUp() throws Exception { + super.setUp(); + + // Create a factory for model objects + factory = new JavaAssemblyFactoryImpl(); + + // Create and bootstrap an empty Tuscany runtime + MonitorFactory monitorFactory = new NullMonitorFactory(); + ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); + DefaultWireBuilder wireBuilder = new DefaultWireBuilder(); + runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder); + runtime.start(); + } + + protected void tearDown() throws Exception { + runtime.stop(); + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaRuntimeBootstrapTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaRuntimeBootstrapTestCase.java new file mode 100644 index 0000000000..6a9fca90c9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/JavaRuntimeBootstrapTestCase.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.GenericComponent; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.runtime.RuntimeContext; + +import junit.framework.Assert; +import junit.framework.TestCase; + +/** + * Ensures basic runtime with Java support boots properly + * + * @version $Rev$ $Date$ + */ +public class JavaRuntimeBootstrapTestCase extends TestCase { + + /** + * Tests the runtime can be bootstrapped with Java builders and two module-scoped Java-based components can be wired + */ + public void testRuntimeBoot() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule()); + testCtx.publish(new ModuleStart(this)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().getString(); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/StartStopTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/StartStopTestCase.java new file mode 100644 index 0000000000..8b7ed342c4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/StartStopTestCase.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration; + +import java.net.URL; +import java.net.URLClassLoader; + +import junit.framework.TestCase; +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.CurrentModuleContext; + +/** + * @version $Rev$ $Date$ + */ +public class StartStopTestCase extends TestCase { + private ClassLoader oldCL; + + public void testHelloWorld() throws Exception { + TuscanyRuntime tuscany = new TuscanyRuntime("test", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + assertNotNull(moduleContext); + + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld"); + assertNotNull(helloworldService); + + String value = helloworldService .getGreetings("World"); + assertEquals("Hello World", value); + tuscany.stop(); + tuscany = new TuscanyRuntime("test", null); + tuscany.start(); + moduleContext = CurrentModuleContext.getContext(); + assertNotNull(moduleContext); + helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorld"); + assertNotNull(helloworldService); + value = helloworldService .getGreetings("World"); + assertEquals("Hello World", value); + tuscany.stop(); + } + + protected void setUp() throws Exception { + super.setUp(); + URL url = getClass().getResource("/helloworldmc/"); + ClassLoader cl = new URLClassLoader(new URL[]{url}, getClass().getClassLoader()); + oldCL = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(cl); + } + + protected void tearDown() throws Exception { + Thread.currentThread().setContextClassLoader(oldCL); + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EPtoExternalServiceTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EPtoExternalServiceTestCase.java new file mode 100644 index 0000000000..17424669bc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EPtoExternalServiceTestCase.java @@ -0,0 +1,99 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration.binding; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; +import org.apache.tuscany.container.java.builder.MockInterceptorBuilder; +import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.event.RequestStart; +import org.apache.tuscany.core.runtime.RuntimeContext; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class EPtoExternalServiceTestCase extends TestCase { + private Method hello; + + /** + * Tests wiring of an entry point directly to an external service + */ + public void testEPtoESInvocation() throws Throwable { + RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); + PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) + .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); + registry.registerTargetBuilder(interceptorBuilder); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModuleWithEntryPointToExternalService()); + child.publish(new ModuleStart(this)); + Object id = new Object(); + child.publish(new RequestStart(this, id)); + EntryPointContext ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + InvocationHandler handler = (InvocationHandler) ctx.getHandler(); + Assert.assertEquals(0, mockInterceptor.getCount()); + Object response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("foo", response); + Assert.assertEquals(1, mockInterceptor.getCount()); + + ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + handler = (InvocationHandler) ctx.getHandler(); + response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("foo", response); + child.publish(new RequestEnd(this, id)); + + // second request + Object id2 = new Object(); + child.publish(new RequestStart(this, id2)); + ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + handler = (InvocationHandler) ctx.getHandler(); + Assert.assertEquals(2, mockInterceptor.getCount()); + response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("foo", response); + Assert.assertEquals(3, mockInterceptor.getCount()); + child.publish(new RequestEnd(this, id2)); + + child.publish(new ModuleStop(this)); + runtime.stop(); + + } + + protected void setUp() throws Exception { + super.setUp(); + hello = HelloWorldService.class.getMethod("hello", String.class); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EntryPointToJavaTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EntryPointToJavaTestCase.java new file mode 100644 index 0000000000..f8ba1e2192 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/EntryPointToJavaTestCase.java @@ -0,0 +1,261 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.integration.binding; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; +import org.apache.tuscany.container.java.builder.MockInterceptorBuilder; +import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.context.event.HttpSessionBound; +import org.apache.tuscany.core.context.event.HttpSessionEnd; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.event.RequestStart; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.model.assembly.Scope; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; + +/** + * Tests basic entry point functionality with Java components + * + * @version $Rev$ $Date$ + */ +public class EntryPointToJavaTestCase extends TestCase { + + private Method hello; + + public void setUp() throws Exception { + hello = HelloWorldService.class.getMethod("hello", String.class); + } + + /** + * Tests creation and wire of an entry point wired to a module-scoped service offered by a Java component + */ + public void testEPtoJavaModuleScopeInvoke() throws Throwable { + RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); + PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) + .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); + + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); + registry.registerTargetBuilder(interceptorBuilder); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.MODULE)); + child.publish(new ModuleStart(this)); + Object id = new Object(); + child.publish(new RequestStart(this, id)); + EntryPointContext ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + InvocationHandler handler = (InvocationHandler) ctx.getHandler(); + Assert.assertEquals(0, mockInterceptor.getCount()); + Object response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("Hello foo", response); + Assert.assertEquals(1, mockInterceptor.getCount()); + Object id2 = new Object(); + child.publish(new RequestStart(this, id2)); + + // second request + Object id3 = new Object(); + child.publish(new RequestStart(this, id3)); + ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + handler = (InvocationHandler) ctx.getHandler(); + Assert.assertEquals(1, mockInterceptor.getCount()); + response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("Hello foo", response); + Assert.assertEquals(2, mockInterceptor.getCount()); + HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null); + Assert.assertEquals(2, service1.count()); + child.publish(new RequestEnd(this, id3)); + + child.publish(new ModuleStop(this)); + runtime.stop(); + } + + /** + * Tests creation and wire of an entry point wired to a session-scoped service offered by a Java component + */ + public void testEPtoJavaSessionScopeInvoke() throws Throwable { + RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); + PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) + .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); + registry.registerTargetBuilder(interceptorBuilder); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.SESSION)); + child.publish(new ModuleStart(this)); + + // first session + Object session = new Object(); + Object id = new Object(); + child.publish(new RequestStart(this, id)); + child.publish(new HttpSessionBound(this, session)); + + EntryPointContext ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + InvocationHandler handler = (InvocationHandler) ctx.getHandler(); + Assert.assertEquals(0, mockInterceptor.getCount()); + Object response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("Hello foo", response); + Assert.assertEquals(1, mockInterceptor.getCount()); + child.publish(new RequestEnd(this, id)); + + Object id2 = new Object(); + child.publish(new RequestStart(this, id2)); + child.publish(new HttpSessionBound(this, session)); + EntryPointContext ctx2 = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx2); + response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("Hello foo", response); + Assert.assertEquals(2, mockInterceptor.getCount()); + HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null); + Assert.assertEquals(2, service1.count()); + child.publish(new RequestEnd(this, id2)); + child.publish(new HttpSessionEnd(this, session)); + + // second session + Object session2 = new Object(); + child.publish(new RequestStart(this, new Object())); + child.publish(new HttpSessionBound(this, session2)); + + ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + Assert.assertEquals(2, mockInterceptor.getCount()); + response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("Hello foo", response); + Assert.assertEquals(3, mockInterceptor.getCount()); + child.publish(new HttpSessionBound(this, session2)); + + Object id3 = new Object(); + child.publish(new RequestStart(this, id3)); + child.publish(new HttpSessionBound(this, session2)); + ctx2 = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx2); + response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("Hello foo", response); + Assert.assertEquals(4, mockInterceptor.getCount()); + HelloWorldService service2 = (HelloWorldService) child.getContext("target").getInstance(null); + Assert.assertEquals(2, service2.count()); + Assert.assertEquals(2, service1.count()); //ensure sessions not crossed + child.publish(new RequestEnd(this, session2)); + child.publish(new HttpSessionBound(this, session2)); + + child.publish(new ModuleStop(this)); + runtime.stop(); + } + + + /** + * Tests creation and wire of an entry point wired to a module-scoped service offered by a Java component + */ + public void testEPtoJavaStatelessInvoke() throws Throwable { + RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); + PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) + .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); + registry.registerTargetBuilder(interceptorBuilder); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.INSTANCE)); + child.publish(new ModuleStart(this)); + Object id = new Object(); + child.publish(new RequestStart(this, id)); + EntryPointContext ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + InvocationHandler handler = (InvocationHandler) ctx.getHandler(); + Assert.assertEquals(0, mockInterceptor.getCount()); + Object response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("Hello foo", response); + Assert.assertEquals(1, mockInterceptor.getCount()); + child.publish(new RequestEnd(this, id)); + + // second request + Object id2 = new Object(); + child.publish(new RequestStart(this, id2)); + ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + handler = (InvocationHandler) ctx.getHandler(); + Assert.assertEquals(1, mockInterceptor.getCount()); + response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("Hello foo", response); + Assert.assertEquals(2, mockInterceptor.getCount()); + HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null); + Assert.assertEquals(0, service1.count()); + child.publish(new RequestEnd(this, id)); + + child.publish(new ModuleStop(this)); + runtime.stop(); + } + + public void testEPtoJavaRequestInvoke() throws Throwable { + RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); + PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) + .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); + registry.registerTargetBuilder(interceptorBuilder); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.REQUEST)); + child.publish(new ModuleStart(this)); + Object id = new Object(); + child.publish(new RequestStart(this, id)); + EntryPointContext ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + InvocationHandler handler = (InvocationHandler) ctx.getHandler(); + Assert.assertEquals(0, mockInterceptor.getCount()); + Object response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("Hello foo", response); + Assert.assertEquals(1, mockInterceptor.getCount()); + + ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + handler = (InvocationHandler) ctx.getHandler(); + response = handler.invoke(null, hello, new Object[]{"foo"}); + HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null); + Assert.assertEquals(2, service1.count()); + + child.publish(new RequestEnd(this, id)); + + // second request + Object id2 = new Object(); + child.publish(new RequestStart(this, id2)); + ctx = (EntryPointContext) child.getContext("source"); + Assert.assertNotNull(ctx); + handler = (InvocationHandler) ctx.getHandler(); + Assert.assertEquals(2, mockInterceptor.getCount()); + response = handler.invoke(null, hello, new Object[]{"foo"}); + Assert.assertEquals("Hello foo", response); + Assert.assertEquals(3, mockInterceptor.getCount()); + HelloWorldService service2 = (HelloWorldService) child.getContext("target").getInstance(null); + Assert.assertEquals(1, service2.count()); + child.publish(new RequestEnd(this, id2)); + + child.publish(new ModuleStop(this)); + runtime.stop(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/ExternalServiceProxyInvokeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/ExternalServiceProxyInvokeTestCase.java new file mode 100644 index 0000000000..7357f973f7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/ExternalServiceProxyInvokeTestCase.java @@ -0,0 +1,73 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.integration.binding; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; +import org.apache.tuscany.container.java.builder.MockInterceptorBuilder; +import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.event.RequestStart; +import org.apache.tuscany.core.runtime.RuntimeContext; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class ExternalServiceProxyInvokeTestCase extends TestCase { + + /** + * Tests that an external service can be invoked by locating a proxy to it as opposed to invoking it over a wire from another + * source such as an entry point or external service. + * + * @throws Throwable + */ + public void testProxyInvocation() throws Throwable { + RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); + PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD)) + .getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); + registry.registerTargetBuilder(interceptorBuilder); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModuleWithEntryPointToExternalService()); + child.publish(new ModuleStart(this)); + Object id = new Object(); + child.publish(new RequestStart(this, id)); + HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null); + Assert.assertEquals("foo", service1.hello("foo")); + + child.publish(new RequestEnd(this, id)); + child.publish(new ModuleStop(this)); + runtime.stop(); + + } + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/JavaToExternalServiceTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/JavaToExternalServiceTestCase.java new file mode 100644 index 0000000000..90acb1c591 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/binding/JavaToExternalServiceTestCase.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.integration.binding; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; +import org.apache.tuscany.container.java.builder.MockInterceptorBuilder; +import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.runtime.RuntimeContext; + +/** + * Tests basic Java to external service interaction + * + * @version $Rev$ $Date$ + */ +public class JavaToExternalServiceTestCase extends TestCase { + + /** + * Tests an wire of an external service configured with the {@link org.apache.tuscany.container.java.mock.binding.foo.FooBinding} + * from a Java component + * + * @throws Exception + */ + public void testJavaToESInvoke() throws Exception { + RuntimeContext runtime = MockFactory.registerFooBinding(MockFactory.createJavaRuntime()); + PolicyBuilderRegistry registry = (PolicyBuilderRegistry) ((CompositeContext) runtime.getSystemContext().getContext( + MockFactory.SYSTEM_CHILD)).getContext(MockFactory.POLICY_BUILDER_REGISTRY).getInstance(null); + MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); + MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false); + registry.registerTargetBuilder(interceptorBuilder); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module")); + CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module"); + child.registerModelObject(MockFactory.createModuleWithExternalService()); + child.publish(new ModuleStart(this)); + HelloWorldService source = (HelloWorldService) child.getContext("source").getInstance(null); + Assert.assertNotNull(source); + Assert.assertEquals(0, mockInterceptor.getCount()); + Assert.assertEquals("foo", source.hello("foo")); + Assert.assertEquals(1, mockInterceptor.getCount()); + child.publish(new ModuleStop(this)); + runtime.stop(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java new file mode 100644 index 0000000000..89320f60e5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/integration/context/ScopeReferenceTestCase.java @@ -0,0 +1,741 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.integration.context; + +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.GenericComponent; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.RequestStart; +import org.apache.tuscany.core.context.event.HttpSessionBound; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.model.assembly.Scope; + +import junit.framework.Assert; +import junit.framework.TestCase; + +/** + * Tests scoping is properly handled for service references + * + * @version $Rev$ $Date$ + */ +public class ScopeReferenceTestCase extends TestCase { + + /** + * Tests a module-to-module scoped wire is setup properly by the runtime + */ + public void testModuleToModule() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule()); + testCtx.publish(new ModuleStart(this)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().getString(); + } + + /** + * Tests a module-to-session scoped wire is setup properly by the runtime + */ + public void testModuleToSession() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.MODULE,Scope.SESSION)); + testCtx.publish(new ModuleStart(this)); + + // first session + Object session = new Object(); + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + testCtx.publish(new HttpSessionBound(this,session)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,id)); + + //second session + Object session2 = new Object(); + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + testCtx.publish(new HttpSessionBound(this,session2)); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target2); + Assert.assertTrue(!"foo".equals(target2.getString())); + + Assert.assertTrue(!"foo".equals(source.getGenericComponent().getString())); + source.getGenericComponent().setString("bar"); + Assert.assertEquals("bar",target2.getString()); + Assert.assertEquals("bar",source.getGenericComponent().getString()); + //testCtx.fireEvent(EventContext.SESSION_NOTIFY,session); + + } + + /** + * Tests a module-to-request scoped wire is setup properly by the runtime + */ + public void testModuleToRequest() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.MODULE,Scope.REQUEST)); + testCtx.publish(new ModuleStart(this)); + + // first request + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,id)); + + //second request + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target2); + Assert.assertTrue(!"foo".equals(target2.getString())); + + Assert.assertTrue(!"foo".equals(source.getGenericComponent().getString())); + source.getGenericComponent().setString("bar"); + Assert.assertEquals("bar",target2.getString()); + Assert.assertEquals("bar",source.getGenericComponent().getString()); + + } + + /** + * Tests a module-to-stateless scoped wire is setup properly by the runtime + */ + public void testModuleToStateless() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.MODULE,Scope.INSTANCE)); + testCtx.publish(new ModuleStart(this)); + + // first request + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertTrue(!"foo".equals(target.getString())); + testCtx.publish(new RequestEnd(this,id)); + + //second request + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target2); + Assert.assertTrue(!"foo".equals(target2.getString())); + + Assert.assertTrue(!"foo".equals(source.getGenericComponent().getString())); + source.getGenericComponent().setString("bar"); + Assert.assertTrue(!"bar".equals(target2.getString())); + } + + /** + * Tests a session-to-session scoped wire is setup properly by the runtime + */ + public void testSessionToSession() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.SESSION)); + testCtx.publish(new ModuleStart(this)); + + // first session + Object session = new Object(); + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + testCtx.publish(new HttpSessionBound(this,session)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,id)); + + //second session + Object session2 = new Object(); + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + testCtx.publish(new HttpSessionBound(this,session2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source2); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals(null,target2.getString()); + Assert.assertEquals(null,source2.getGenericComponent().getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals("baz",source2.getGenericComponent().getString()); + Assert.assertEquals("baz",target2.getString()); + + testCtx.publish(new RequestEnd(this,id2)); + + } + + + /** + * Tests a session-to-module scoped wire is setup properly by the runtime + */ + public void testSessionToModule() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.MODULE)); + testCtx.publish(new ModuleStart(this)); + + // first session + Object session = new Object(); + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + testCtx.publish(new HttpSessionBound(this,session)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,id)); + + //second session + Object session2 = new Object(); + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + testCtx.publish(new HttpSessionBound(this,session2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source2); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals("foo",target2.getString()); + Assert.assertEquals("foo",source2.getGenericComponent().getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals("baz",source2.getGenericComponent().getString()); + Assert.assertEquals("baz",target2.getString()); + Assert.assertEquals("baz",target.getString()); + + testCtx.publish(new RequestEnd(this,session2)); + + } + + /** + * Tests a session-to-request scoped wire is setup properly by the runtime + */ + public void testSessionToRequest() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.REQUEST)); + testCtx.publish(new ModuleStart(this)); + + // first session + Object session = new Object(); + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + testCtx.publish(new HttpSessionBound(this,session)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,session)); + + //second session + Object session2 = new Object(); + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + testCtx.publish(new HttpSessionBound(this,session2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals(null,target2.getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals("baz",target2.getString()); + Assert.assertEquals("baz",source2.getGenericComponent().getString()); + + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,session)); + + } + + + /** + * Tests a session-to-stateless scoped wire is setup properly by the runtime + */ + public void testSessionToStateless() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.INSTANCE)); + testCtx.publish(new ModuleStart(this)); + + // first session + Object session = new Object(); + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + testCtx.publish(new HttpSessionBound(this,session)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals(null,target.getString()); + testCtx.publish(new RequestEnd(this,session)); + + //second session + Object session2 = new Object(); + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + testCtx.publish(new HttpSessionBound(this,session2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals(null,target2.getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals(null,target2.getString()); //Note assumes no pooling + Assert.assertEquals(null,source2.getGenericComponent().getString()); + + Assert.assertEquals(null,target.getString()); //Note assumes no pooling + testCtx.publish(new RequestEnd(this,session)); + + } + + /** + * Tests a request-to-request scoped wire is setup properly by the runtime + */ + public void testRequestToRequest() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.REQUEST)); + testCtx.publish(new ModuleStart(this)); + + // first request + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,new Object())); + + //second request + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source2); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals(null,target2.getString()); + Assert.assertEquals(null,source2.getGenericComponent().getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals("baz",source2.getGenericComponent().getString()); + Assert.assertEquals("baz",target2.getString()); + + testCtx.publish(new RequestEnd(this,new Object())); + } + + /** + * Tests a request-to-module scoped wire is setup properly by the runtime + */ + public void testRequestToModule() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.MODULE)); + testCtx.publish(new ModuleStart(this)); + + // first request + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,new Object())); + + //second request + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source2); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals("foo",target2.getString()); + Assert.assertEquals("foo",source2.getGenericComponent().getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals("baz",source2.getGenericComponent().getString()); + Assert.assertEquals("baz",target2.getString()); + Assert.assertEquals("baz",target.getString()); + + testCtx.publish(new RequestEnd(this,new Object())); + } + + /** + * Tests a request-to-session scoped wire is setup properly by the runtime + */ + public void testRequestToSession() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.SESSION)); + testCtx.publish(new ModuleStart(this)); + + // first session + Object session = new Object(); + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + testCtx.publish(new HttpSessionBound(this,session)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,new Object())); + + //second request for session + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + testCtx.publish(new HttpSessionBound(this,session)); + GenericComponent targetR2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertEquals("foo",targetR2.getString()); + GenericComponent sourceR2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(sourceR2); + Assert.assertEquals("foo",sourceR2.getGenericComponent().getString()); + + testCtx.publish(new RequestEnd(this,new Object())); + + //second session + Object session2 = new Object(); + Object id3 = new Object(); + testCtx.publish(new RequestStart(this,id3)); + testCtx.publish(new HttpSessionBound(this,session2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source2); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals(null,target2.getString()); + Assert.assertEquals(null,source2.getGenericComponent().getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals("baz",source2.getGenericComponent().getString()); + Assert.assertEquals("baz",target2.getString()); + + testCtx.publish(new RequestEnd(this,session2)); + Object id4 = new Object(); + testCtx.publish(new RequestStart(this,id4)); + testCtx.publish(new HttpSessionBound(this,session)); + testCtx.publish(new RequestEnd(this,session)); + + } + + + /** + * Tests a request-to-stateless scoped wire is setup properly by the runtime + */ + public void testRequestToStateless() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.INSTANCE)); + testCtx.publish(new ModuleStart(this)); + + // first request + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals(null,target.getString()); + testCtx.publish(new RequestEnd(this,new Object())); + + //second request + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source2); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals(null,target2.getString()); + Assert.assertEquals(null,source2.getGenericComponent().getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals(null,source2.getGenericComponent().getString()); + Assert.assertEquals(null,target2.getString()); + + testCtx.publish(new RequestEnd(this,new Object())); + } + + + /** + * Tests a stateless-to-stateless scoped wire is setup properly by the runtime + */ + public void testStatelessToStateless() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.INSTANCE)); + testCtx.publish(new ModuleStart(this)); + + // first request + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals(null,target.getString()); + testCtx.publish(new RequestEnd(this,new Object())); + + //second request + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source2); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals(null,target2.getString()); + Assert.assertEquals(null,source2.getGenericComponent().getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals(null,source2.getGenericComponent().getString()); + Assert.assertEquals(null,target2.getString()); + + testCtx.publish(new RequestEnd(this,new Object())); + } + + /** + * Tests a stateless-to-request scoped wire is setup properly by the runtime + */ + public void testStatelessToRequest() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.REQUEST)); + testCtx.publish(new ModuleStart(this)); + + // first request + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,new Object())); + + GenericComponent targetR1 = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(targetR1); + Assert.assertEquals("foo",target.getString()); + + //second request + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source2); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals(null,target2.getString()); + Assert.assertEquals(null,source2.getGenericComponent().getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals("baz",source2.getGenericComponent().getString()); + Assert.assertEquals("baz",target2.getString()); + + testCtx.publish(new RequestEnd(this,new Object())); + } + + /** + * Tests a stateless-to-session scoped wire is setup properly by the runtime + */ + public void testStatelessToSession() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.SESSION)); + testCtx.publish(new ModuleStart(this)); + + // first session + Object session = new Object(); + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + testCtx.publish(new HttpSessionBound(this,session)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,new Object())); + + //second request for session + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + testCtx.publish(new HttpSessionBound(this,session)); + GenericComponent targetR2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertEquals("foo",targetR2.getString()); + GenericComponent sourceR2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(sourceR2); + Assert.assertEquals("foo",sourceR2.getGenericComponent().getString()); + + testCtx.publish(new RequestEnd(this,new Object())); + + //second session + Object session2 = new Object(); + Object id3 = new Object(); + testCtx.publish(new RequestStart(this,id3)); + testCtx.publish(new HttpSessionBound(this,session2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source2); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals(null,target2.getString()); + Assert.assertEquals(null,source2.getGenericComponent().getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals("baz",source2.getGenericComponent().getString()); + Assert.assertEquals("baz",target2.getString()); + + testCtx.publish(new RequestEnd(this,session2)); + Object id4 = new Object(); + testCtx.publish(new RequestStart(this,id4)); + testCtx.publish(new HttpSessionBound(this,session)); + testCtx.publish(new RequestEnd(this,session)); + + } + + + /** + * Tests a stateless-to-module scoped wire is setup properly by the runtime + */ + public void testStatelessToModule() throws Exception{ + RuntimeContext runtime = MockFactory.createJavaRuntime(); + Context ctx = runtime.getSystemContext().getContext("tuscany.system.child"); + Assert.assertNotNull(ctx); + runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test")); + CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test"); + Assert.assertNotNull(testCtx); + testCtx.registerModelObject(MockFactory.createModule(Scope.INSTANCE,Scope.MODULE)); + testCtx.publish(new ModuleStart(this)); + + Object id = new Object(); + testCtx.publish(new RequestStart(this,id)); + GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null); + Assert.assertNotNull(target); + source.getGenericComponent().setString("foo"); + Assert.assertEquals("foo",target.getString()); + testCtx.publish(new RequestEnd(this,new Object())); + + //second session + Object id2 = new Object(); + testCtx.publish(new RequestStart(this,id2)); + GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null); + Assert.assertNotNull(source2); + GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null); + + Assert.assertNotNull(target2); + Assert.assertEquals("foo",target2.getString()); + Assert.assertEquals("foo",source2.getGenericComponent().getString()); + source2.getGenericComponent().setString("baz"); + Assert.assertEquals("baz",source2.getGenericComponent().getString()); + Assert.assertEquals("baz",target2.getString()); + + testCtx.publish(new RequestEnd(this,new Object())); + + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java new file mode 100644 index 0000000000..e560af6fd3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/MediationTestCase.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.invocation; + +import java.lang.reflect.Method; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.invocation.mock.SimpleTargetImpl; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; + +/** + * Tests invoking on a different interface from the one actually implemented by the target + * + * @version $Rev$ $Date$ + */ +public class MediationTestCase extends TestCase { + + private Method hello; + + private MessageFactory msgFactory = new MessageFactoryImpl(); + + public void setUp() throws Exception { + hello = Hello.class.getMethod("hello", String.class); + } + + public void testMediation() throws Exception { + StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(hello, new SimpleTargetImpl()); + Message msg = msgFactory.createMessage(); + msg.setBody("foo"); + Assert.assertEquals("foo", invoker.invoke(msg).getBody()); + } + + public interface Hello { + + public String hello(String message) throws Exception; + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java new file mode 100644 index 0000000000..f4337fe3cb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/ScopedPojoInvokerTestCase.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation; + +import java.lang.reflect.Method; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.invocation.mock.SimpleTarget; +import org.apache.tuscany.container.java.mock.MockScopeContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; + +public class ScopedPojoInvokerTestCase extends TestCase { + + private Method echoMethod; + + public ScopedPojoInvokerTestCase() { + super(); + } + + public ScopedPojoInvokerTestCase(String arg0) { + super(arg0); + } + + public void setUp() throws Exception { + echoMethod = SimpleTarget.class.getDeclaredMethod("echo", String.class); + Assert.assertNotNull(echoMethod); + } + + public void testScopedInvoke() throws Exception { + ScopeContext container = new MockScopeContext(); + ScopedJavaComponentInvoker invoker = new ScopedJavaComponentInvoker(new QualifiedName("foo"), echoMethod, container,false); + Object ret = invoker.invokeTarget("foo"); + Assert.assertEquals("foo", ret); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java new file mode 100644 index 0000000000..31e7e3c64e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/StaticPojoInvokerTestCase.java @@ -0,0 +1,154 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import static java.lang.Integer.*; + +import junit.framework.Assert; +import junit.framework.TestCase; + +public class StaticPojoInvokerTestCase extends TestCase { + + private Method echoMethod; + private Method arrayMethod; + private Method nullParamMethod; + private Method primitiveMethod; + private Method checkedMethod; + private Method runtimeMethod; + + public StaticPojoInvokerTestCase() { + + } + + public StaticPojoInvokerTestCase(String arg0) { + super(arg0); + } + + public void setUp() throws Exception { + echoMethod = TestBean.class.getDeclaredMethod("echo", String.class); + arrayMethod = TestBean.class.getDeclaredMethod("arrayEcho", String[].class); + nullParamMethod = TestBean.class.getDeclaredMethod("nullParam", (Class[]) null); + primitiveMethod = TestBean.class.getDeclaredMethod("primitiveEcho", TYPE); + checkedMethod = TestBean.class.getDeclaredMethod("checkedException", (Class[]) null); + runtimeMethod = TestBean.class.getDeclaredMethod("runtimeException", (Class[]) null); + Assert.assertNotNull(echoMethod); + Assert.assertNotNull(checkedMethod); + Assert.assertNotNull(runtimeMethod); + } + + public void testObjectInvoke() throws Throwable { + TestBean bean = new TestBean(); + StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(echoMethod, bean); + Object ret = invoker.invokeTarget("foo"); + Assert.assertEquals("foo", ret); + } + + public void testArrayInvoke() throws Throwable { + TestBean bean = new TestBean(); + StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(arrayMethod, bean); + String[] args = new String[]{"foo", "bar"}; + Object ret = invoker.invokeTarget(new Object[]{args}); + String[] retA = (String[]) ret; + Assert.assertNotNull(retA); + Assert.assertEquals(2, retA.length); + Assert.assertEquals("foo", retA[0]); + Assert.assertEquals("bar", retA[1]); + } + + public void testNullInvoke() throws Throwable { + TestBean bean = new TestBean(); + StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(nullParamMethod, bean); + Object ret = invoker.invokeTarget(null); + String retS = (String) ret; + Assert.assertEquals("foo", retS); + } + + public void testPrimitiveInvoke() throws Throwable { + TestBean bean = new TestBean(); + StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(primitiveMethod, bean); + Object ret = invoker.invokeTarget(new Integer[]{1}); + Integer retI = (Integer) ret; + Assert.assertEquals(1, retI.intValue()); + } + + public void testInvokeCheckedException() throws Throwable { + TestBean bean = new TestBean(); + StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(checkedMethod, bean); + try { + invoker.invokeTarget(null); + } catch (InvocationTargetException e) { + if (e.getCause() != null && TestException.class.equals(e.getCause().getClass())) { + return; + } + } catch (Throwable e) { + } + fail(TestException.class.getName() + " should have been thrown"); + } + + public void testInvokeRuntimeException() throws Throwable { + TestBean bean = new TestBean(); + StaticJavaComponentTargetInvoker invoker = new StaticJavaComponentTargetInvoker(runtimeMethod, bean); + try { + invoker.invokeTarget(null); + } catch (InvocationTargetException e) { + if (e.getCause() != null && e.getCause() instanceof TestRuntimeException) { + return; + } + } + fail(TestException.class.getName() + " should have been thrown"); + } + + private class TestBean { + + public String echo(String msg) throws Exception { + Assert.assertEquals("foo", msg); + return msg; + } + + public String[] arrayEcho(String[] msg) throws Exception { + Assert.assertNotNull(msg); + Assert.assertEquals(2, msg.length); + Assert.assertEquals("foo", msg[0]); + Assert.assertEquals("bar", msg[1]); + return msg; + } + + public String nullParam() throws Exception { + return "foo"; + } + + public int primitiveEcho(int i) throws Exception { + return i; + } + + public void checkedException() throws TestException { + throw new TestException(); + } + + public void runtimeException() throws TestRuntimeException { + throw new TestRuntimeException(); + } + } + + public class TestException extends Exception { + } + + public class TestRuntimeException extends RuntimeException { + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java new file mode 100644 index 0000000000..cda09e8540 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockHandler.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation.mock; + +import org.apache.tuscany.core.wire.MessageHandler; +import org.apache.tuscany.core.message.Message; + +/** + * + */ +public class MockHandler implements MessageHandler { + + private int count =0; + + public boolean processMessage(Message message) { + //System.out.println("Invoking handler"); + count++; + return true; + } + + public int getCount(){ + return count; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java new file mode 100644 index 0000000000..24b22a641a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/MockSyncInterceptor.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation.mock; + +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.message.Message; + +public class MockSyncInterceptor implements Interceptor { + + private int count; + + private Interceptor next; + + public MockSyncInterceptor() { + } + + public Message invoke(Message msg) { + ++count; + //System.out.println("Invoking interceptor"); + return next.invoke(msg); + } + + public int getCount() { + return count; + } + + public void setNext(Interceptor next) { + this.next=next; + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java new file mode 100644 index 0000000000..213caab7e9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSource.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation.mock; + +public interface SimpleSource { + + public void invokeHello() throws Exception; + + public void invokeGoodbye() throws Exception; +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java new file mode 100644 index 0000000000..2e7bd75f11 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleSourceImpl.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation.mock; + +public class SimpleSourceImpl implements SimpleSource { + + private SimpleTarget proxy; + + public SimpleSourceImpl(SimpleTarget proxy) { + this.proxy = proxy; + } + + public void invokeHello() throws Exception { + proxy.hello("hello"); + } + + public void invokeGoodbye() throws Exception { + proxy.goodbye("hello"); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java new file mode 100644 index 0000000000..cbd3037529 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTarget.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation.mock; + +public interface SimpleTarget { + + public String hello(String message) throws Exception; + + public String goodbye(String message) throws Exception; + + public String echo(String message) throws Exception; + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java new file mode 100644 index 0000000000..18abf6108a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/invocation/mock/SimpleTargetImpl.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.invocation.mock; + +public class SimpleTargetImpl implements SimpleTarget { + + public SimpleTargetImpl() { + super(); + } + + public String hello(String message) throws Exception { + return message; + } + + public String goodbye(String message) throws Exception { + return message; + } + + public String echo(String message) throws Exception { + return message; + } + + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/loader/JavaImplementationLoaderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/loader/JavaImplementationLoaderTestCase.java new file mode 100644 index 0000000000..85e79d8780 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/loader/JavaImplementationLoaderTestCase.java @@ -0,0 +1,134 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.loader; + +import java.net.URL; +import java.util.List; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.namespace.QName; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; +import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; +import org.apache.tuscany.container.java.assembly.mock.HelloWorldImpl; +import org.apache.tuscany.container.java.assembly.mock.HelloWorldWithFieldProperties; +import org.apache.tuscany.container.java.assembly.mock.NakedHelloWorld; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.StAXElementLoader; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.assembly.AssemblyConstants; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Property; +import org.apache.tuscany.model.assembly.Service; + +/** + * @version $Rev$ $Date$ + */ +public class JavaImplementationLoaderTestCase extends TestCase { + private JavaImplementationLoader loader; + private ComponentType mockType; + + public void testNakedHelloWorld() throws ConfigurationLoadException { + ComponentType type = loader.loadComponentTypeByIntrospection(NakedHelloWorld.class); + Assert.assertNotNull(type); + Assert.assertEquals(1,type.getProperties().size()); + Assert.assertTrue(type.getReferences().isEmpty()); + List services = type.getServices(); + Assert.assertEquals(1, services.size()); + Assert.assertEquals("NakedHelloWorld", services.get(0).getName()); + } + + public void testHelloWorldWithSidefile() throws XMLStreamException, ConfigurationLoadException { + StAXLoaderRegistry mockRegistry = new MockRegistry(mockType); + loader.setRegistry(mockRegistry); + URL sidefile = HelloWorldImpl.class.getResource("HelloWorldImpl.componentType"); + ComponentType type = loader.loadComponentTypeFromSidefile(sidefile, null); + assertSame(mockType, type); + } + + public void testHelloWorldWithFieldProperties() throws ConfigurationLoadException { + ComponentType type = loader.loadComponentTypeByIntrospection(HelloWorldWithFieldProperties.class); + type.initialize(null); + Assert.assertNotNull(type); + List props = type.getProperties(); + Assert.assertEquals(5, props.size()); + + Property prop = type.getProperty("text"); + Assert.assertNotNull(prop); + Assert.assertEquals("text", prop.getName()); + Assert.assertEquals(false, prop.isRequired()); + Assert.assertEquals(String.class, prop.getType()); + + prop = type.getProperty("text2"); + Assert.assertNotNull(prop); + Assert.assertEquals("text2", prop.getName()); + Assert.assertEquals(true, prop.isRequired()); + Assert.assertEquals(Integer.class, prop.getType()); + + prop = type.getProperty("foo"); + Assert.assertNotNull(prop); + Assert.assertEquals("foo", prop.getName()); + Assert.assertEquals(false, prop.isRequired()); + Assert.assertEquals(Integer.TYPE, prop.getType()); + } + + protected void setUp() throws Exception { + super.setUp(); + JavaAssemblyFactory factory = new JavaAssemblyFactoryImpl(); + mockType = factory.createComponentType(); + + loader = new JavaImplementationLoader(); + loader.setFactory(factory); + } + + private static class MockRegistry implements StAXLoaderRegistry { + private final ComponentType mockType; + + public MockRegistry(ComponentType mockType) { + this.mockType = mockType; + } + + public AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assertEquals(AssemblyConstants.COMPONENT_TYPE, reader.getName()); + return mockType; + } + + public void registerLoader(QName element, StAXElementLoader loader) { + throw new UnsupportedOperationException(); + } + + public void unregisterLoader(QName element, StAXElementLoader loader) { + throw new UnsupportedOperationException(); + } + + @Deprecated + public AssemblyContext getContext() { + throw new UnsupportedOperationException(); + } + + @Deprecated + public void setContext(AssemblyContext context) { + throw new UnsupportedOperationException(); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockConfigContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockConfigContext.java new file mode 100644 index 0000000000..9cb1998d68 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockConfigContext.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.WireBuilder; +import org.apache.tuscany.core.builder.impl.AssemblyVisitorImpl; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.context.ConfigurationContext; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.model.assembly.AssemblyObject; + +/** + * A mock configuration context + * + * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ + */ +public class MockConfigContext implements ConfigurationContext { + + private List builders; + + private DefaultWireBuilder wireBuilder = new DefaultWireBuilder(); + + public MockConfigContext(List builders, List wireBuilders) { + this.builders = (builders == null) ? new ArrayList(1) : builders; + if (wireBuilders != null){ + for (WireBuilder builder : wireBuilders) { + wireBuilder.addWireBuilder(builder); + } + } + } + + public void build(AssemblyObject model) throws BuilderConfigException { + AssemblyVisitorImpl visitor = new AssemblyVisitorImpl(builders); + visitor.start(model); + } + + public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, + ScopeContext targetScopeContext) throws BuilderConfigException { + wireBuilder.connect(sourceFactory, targetFactory, targetType, downScope, targetScopeContext); + } + + public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) throws BuilderConfigException { + wireBuilder.completeTargetChain(targetFactory, targetType, targetScopeContext); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockContextFactory.java new file mode 100644 index 0000000000..4e00e4c236 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockContextFactory.java @@ -0,0 +1,92 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock; + +import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; +import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; +import org.apache.tuscany.container.java.config.JavaContextFactory; +import org.apache.tuscany.container.java.scopes.OrderedDependentPojo; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.MethodInjector; +import org.apache.tuscany.core.injection.ObjectCreationException; +import org.apache.tuscany.core.injection.EventInvoker; +import org.apache.tuscany.core.injection.MethodEventInvoker; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class MockContextFactory { + + private MockContextFactory(){} + + /** + * Wires together a source and target + * @throws NoSuchMethodException + */ + public static List> createWiredContexts(Scope scope, ScopeContext context) throws NoSuchMethodException{ + + Constructor constructor = JavaIntrospectionHelper.getDefaultConstructor(OrderedDependentPojo.class); + Method getPojo = OrderedDependentPojo.class.getMethod("setPojo",OrderedDependentPojo.class); + Method init = OrderedDependentPojo.class.getMethod("init",(Class[])null); + EventInvoker initInvoker = new MethodEventInvoker(init); + Method destroy = OrderedDependentPojo.class.getMethod("destroy",(Class[])null); + EventInvoker destroyInvoker = new MethodEventInvoker(destroy); + + JavaContextFactory source = new JavaContextFactory("source",constructor,scope); + source.setInitInvoker(initInvoker); + source.setDestroyInvoker(destroyInvoker); + JavaContextFactory target = new JavaContextFactory("target",constructor,scope); + target.setInitInvoker(initInvoker); + target.setDestroyInvoker(destroyInvoker); + List injectors = new ArrayList(); + injectors.add(new MethodInjector(getPojo, new MockTargetFactory("target",context))); + source.setSetters(injectors); + List> list = new ArrayList>(); + list.add((ContextFactory)source); + list.add((ContextFactory)target); + return list; + } + + private static class MockTargetFactory implements ObjectFactory{ + + private String name; + private ScopeContext context; + + public MockTargetFactory (String name, ScopeContext context){ + this.name = name; + this.context = context; + } + + public Object getInstance() throws ObjectCreationException { + return context.getContext(name).getInstance(null); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java new file mode 100644 index 0000000000..3b45352865 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java @@ -0,0 +1,819 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import junit.framework.Assert; +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; +import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; +import org.apache.tuscany.container.java.assembly.JavaImplementation; +import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; +import org.apache.tuscany.container.java.assembly.mock.HelloWorldImpl; +import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.builder.JavaTargetWireBuilder; +import org.apache.tuscany.container.java.context.JavaAtomicContext; +import org.apache.tuscany.container.java.mock.binding.foo.FooBinding; +import org.apache.tuscany.container.java.mock.binding.foo.FooBindingBuilder; +import org.apache.tuscany.container.java.mock.binding.foo.FooBindingWireBuilder; +import org.apache.tuscany.container.java.mock.components.GenericComponent; +import org.apache.tuscany.container.java.mock.components.HelloWorldClient; +import org.apache.tuscany.container.java.mock.components.ModuleScopeComponent; +import org.apache.tuscany.container.java.mock.components.ModuleScopeComponentImpl; +import org.apache.tuscany.container.java.mock.components.OtherTarget; +import org.apache.tuscany.container.java.mock.components.OtherTargetImpl; +import org.apache.tuscany.container.java.mock.components.Source; +import org.apache.tuscany.container.java.mock.components.SourceImpl; +import org.apache.tuscany.container.java.mock.components.Target; +import org.apache.tuscany.container.java.mock.components.TargetImpl; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.WireBuilder; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.config.processor.ProcessorUtils; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.injection.EventInvoker; +import org.apache.tuscany.core.injection.FieldInjector; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.MethodEventInvoker; +import org.apache.tuscany.core.injection.MethodInjector; +import org.apache.tuscany.core.injection.PojoObjectFactory; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.runtime.RuntimeContextImpl; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.SystemBinding; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.core.system.builder.SystemContextFactoryBuilder; +import org.apache.tuscany.core.system.builder.SystemEntryPointBuilder; +import org.apache.tuscany.core.system.builder.SystemExternalServiceBuilder; +import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; +import org.apache.tuscany.core.wire.WireFactoryFactory; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AtomicComponent; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; +import org.apache.tuscany.model.types.java.JavaServiceContract; +import org.osoa.sca.annotations.ComponentName; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; + +/** + * Generates test components, modules, and runtime artifacts + * + * @version $Rev$ $Date$ + */ +public class MockFactory { + + public static final String JAVA_BUILDER = "java.runtime.builder"; + public static final String MESSAGE_FACTORY = "java.runtime.messageFactory"; + public static final String PROXY_FACTORY_FACTORY = "java.runtime.wireFactoryFactory"; + public static final String WIRE_FACTORY_SERVICE = "java.runtime.wireFactoryservice"; + public static final String JAVA_WIRE_BUILDER = "java.wire.builder"; + public static final String FOO_BUILDER = "foo.binding.builder"; + public static final String FOO_WIRE_BUILDER = "foo.binding.wire.builder"; + public static final String POLICY_BUILDER_REGISTRY = "foo.binding.policy.registry"; + public static final String SYSTEM_CHILD = "tuscany.system.child"; + + private static JavaAssemblyFactory factory = new JavaAssemblyFactoryImpl(); + private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); + private static AssemblyContext assemblyContext = new AssemblyContextImpl(null, null); + private static ComponentTypeIntrospector introspector; + private static ComponentType systemComponentType; + private static ComponentType compositeComponentType; + + public static ComponentType getComponentType() throws ConfigurationLoadException { + if (systemComponentType == null) { + systemComponentType = getIntrospector().introspect(SystemCompositeContextImpl.class); + } + return systemComponentType; + } + + public static ComponentType getCompositeComponentType() throws ConfigurationLoadException { + if (compositeComponentType == null) { + compositeComponentType = getIntrospector().introspect(CompositeContextImpl.class); + } + return compositeComponentType; + } + + public static ComponentTypeIntrospector getIntrospector() { + if (introspector == null) { + introspector = ProcessorUtils.createCoreIntrospector(systemFactory); + } + return introspector; + } + + /** + * Creates an initialized simple component + * + * @param name the component name + * @param type the implementation type + * @param scope the component scope + */ + public static AtomicComponent createComponent(String name, Class type, Scope scope) throws ConfigurationLoadException { + AtomicComponent sc = factory.createSimpleComponent(); + JavaImplementation impl = factory.createJavaImplementation(); + impl.setComponentType(getIntrospector().introspect(type)); + impl.setImplementationClass(type); + sc.setImplementation(impl); + Service s = factory.createService(); + JavaServiceContract ji = factory.createJavaServiceContract(); + ji.setInterface(type); + s.setServiceContract(ji); + ji.setScope(scope); + impl.getComponentType().getServices().add(s); + sc.setName(name); + sc.setImplementation(impl); + return sc; + } + + public static AtomicComponent createNonIntrospectedComponent(String name, Class service, Class type, Scope scope) throws ConfigurationLoadException { + AtomicComponent sc = factory.createSimpleComponent(); + JavaImplementation impl = factory.createJavaImplementation(); + impl.setComponentType(factory.createComponentType()); + impl.setImplementationClass(type); + sc.setImplementation(impl); + Service s = factory.createService(); + JavaServiceContract ji = factory.createJavaServiceContract(); + ji.setInterface(service); + s.setServiceContract(ji); + ji.setScope(scope); + impl.getComponentType().getServices().add(s); + sc.setName(name); + sc.setImplementation(impl); + return sc; + } + + + /** + * Creates an composite component with the given name + */ + public static Component createCompositeComponent(String name) throws ConfigurationLoadException { + Component sc = systemFactory.createModuleComponent(); + Module impl = systemFactory.createModule(); + impl.setName(name); + //impl.setImplementationClass(CompositeContextImpl.class); + sc.setImplementation(impl); + Service s = systemFactory.createService(); + JavaServiceContract ji = systemFactory.createJavaServiceContract(); + s.setServiceContract(ji); + ji.setScope(Scope.AGGREGATE); + //impl.setComponentType(systemFactory.createComponentType()); + impl.setImplementationClass(CompositeContextImpl.class); + impl.setComponentType(getCompositeComponentType()); + impl.getComponentType().getServices().add(s); + sc.setName(name); + sc.setImplementation(impl); + + return sc; + } + + /** + * Creates a system composite component with the given name + */ + public static Component createSystemCompositeComponent(String name) throws ConfigurationLoadException { + Component sc = systemFactory.createModuleComponent(); + Module impl = systemFactory.createSystemModule(); + impl.setName(name); + //impl.setImplementationClass(SystemCompositeContextImpl.class); + sc.setImplementation(impl); + Service s = systemFactory.createService(); + JavaServiceContract ji = systemFactory.createJavaServiceContract(); + s.setServiceContract(ji); + ji.setScope(Scope.AGGREGATE); + impl.setComponentType(getComponentType()); + //impl.setComponentType(systemFactory.createComponentType()); + impl.getComponentType().getServices().add(s); + sc.setName(name); + sc.setImplementation(impl); + return sc; + } + + /** + * Creates an external service configured with the 'Foo' test binding + */ + public static ExternalService createFooBindingExternalService(String name, Class interfaz) { + ExternalService es = factory.createExternalService(); + es.setName(name); + Service s = factory.createService(); + JavaServiceContract ji = factory.createJavaServiceContract(); + ji.setScope(Scope.MODULE); + ji.setInterface(interfaz); + s.setServiceContract(ji); + ConfiguredService configuredService = factory.createConfiguredService(); + es.setConfiguredService(configuredService); + + FooBinding binding = new FooBinding(); + es.getBindings().add(binding); + return es; + } + + /** + * Creates an entry point with the given name configured with the given interface and the {@link + * FooBinding} + */ + public static EntryPoint createFooBindingEntryPoint(String name, Class interfaz) { + EntryPoint ep = factory.createEntryPoint(); + ep.setName(name); + Service s = factory.createService(); + JavaServiceContract ji = factory.createJavaServiceContract(); + ji.setScope(Scope.MODULE); + ji.setInterface(interfaz); + s.setServiceContract(ji); + ConfiguredService configuredService = factory.createConfiguredService(); + configuredService.setPort(s); + ep.setConfiguredService(configuredService); + FooBinding binding = new FooBinding(); + ep.getBindings().add(binding); + return ep; + } + + /** + * Creates an external service configured with a {@link SystemBinding} + */ + public static ExternalService createESSystemBinding(String name, String refName) { + ExternalService es = systemFactory.createExternalService(); + es.setName(name); + ConfiguredService configuredService = systemFactory.createConfiguredService(); + es.setConfiguredService(configuredService); + SystemBinding binding = systemFactory.createSystemBinding(); + binding.setTargetName(refName); + es.getBindings().add(binding); + es.initialize(null); + return es; + } + + /** + * Creates a module with a Java-based "target" module-scoped component wired to a module-scoped "source" + */ + public static Module createModule() throws ConfigurationLoadException { + return createModule(Scope.MODULE, Scope.MODULE); + } + + /** + * Creates a module with a Java-based "target" component wired to a "source" + */ + public static Module createModule(Scope sourceScope, Scope targetScope) throws ConfigurationLoadException { + Component sourceComponent = createNonIntrospectedComponent("source", ModuleScopeComponent.class, ModuleScopeComponentImpl.class, sourceScope); + Component targetComponent = createNonIntrospectedComponent("target", ModuleScopeComponent.class, ModuleScopeComponentImpl.class, targetScope); + + Service targetService = factory.createService(); + JavaServiceContract targetContract = factory.createJavaServiceContract(); + targetContract.setInterface(GenericComponent.class); + targetService.setServiceContract(targetContract); + targetService.setName("GenericComponent"); + targetContract.setScope(targetScope); + ConfiguredService cTargetService = factory.createConfiguredService(); + cTargetService.setPort(targetService); + cTargetService.initialize(assemblyContext); + targetComponent.getConfiguredServices().add(cTargetService); + targetComponent.initialize(assemblyContext); + + Reference ref = factory.createReference(); + ref.setName("setGenericComponent"); + JavaServiceContract inter = factory.createJavaServiceContract(); + inter.setInterface(GenericComponent.class); + ref.setServiceContract(inter); + sourceComponent.getImplementation().getComponentType().getReferences().add(ref); + + ConfiguredReference cref = factory.createConfiguredReference("setGenericComponent", "target"); + cref.initialize(assemblyContext); + sourceComponent.getConfiguredReferences().add(cref); + sourceComponent.initialize(assemblyContext); + + Module module = factory.createModule(); + module.setName("test.module"); + module.getComponents().add(sourceComponent); + module.getComponents().add(targetComponent); + module.initialize(assemblyContext); + return module; + } + + /** + * Creates a module with a Java-based source component wired to a "target" external service configured + * with the {@link FooBinding} + */ + public static Module createModuleWithExternalService() throws ConfigurationLoadException { + Component sourceComponent = createComponent("source", HelloWorldClient.class, Scope.MODULE); + ExternalService targetES = createFooBindingExternalService("target", HelloWorldService.class); + + Service targetService = factory.createService(); + JavaServiceContract targetContract = factory.createJavaServiceContract(); + targetContract.setInterface(HelloWorldService.class); + targetService.setServiceContract(targetContract); + targetService.setName("HelloWorld"); + ConfiguredService cTargetService = factory.createConfiguredService(); + cTargetService.setPort(targetService); + targetES.setConfiguredService(cTargetService); + targetES.initialize(assemblyContext); + + Reference ref = factory.createReference(); + ref.setName("setHelloWorldService"); + JavaServiceContract inter = factory.createJavaServiceContract(); + inter.setInterface(HelloWorldService.class); + ref.setServiceContract(inter); + sourceComponent.getImplementation().getComponentType().getReferences().add(ref); + + ConfiguredReference cref = factory.createConfiguredReference(ref.getName(), "target"); + cref.initialize(assemblyContext); + sourceComponent.getConfiguredReferences().add(cref); + sourceComponent.initialize(assemblyContext); + + Module module = factory.createModule(); + module.setName("test.module"); + module.getComponents().add(sourceComponent); + module.getExternalServices().add(targetES); + module.initialize(assemblyContext); + return module; + } + + /** + * Creates a module with an entry point named "source" configured with the {@link FooBinding} wired to a + * service offered by a Java-based component named "target" + * + * @param scope the scope of the target service + */ + public static Module createModuleWithEntryPoint(Scope scope) throws ConfigurationLoadException { + Component targetComponent = createComponent("target", HelloWorldImpl.class, scope); + + Service targetService = factory.createService(); + JavaServiceContract targetContract = factory.createJavaServiceContract(); + targetContract.setInterface(HelloWorldService.class); + targetService.setServiceContract(targetContract); + targetService.setName("HelloWorldService"); + ConfiguredService cTargetService = factory.createConfiguredService(); + cTargetService.setPort(targetService); + targetComponent.getConfiguredServices().add(cTargetService); + targetComponent.initialize(assemblyContext); + + Reference ref = factory.createReference(); + ConfiguredReference cref = factory.createConfiguredReference(); + ref.setName("setHelloWorldService"); + JavaServiceContract inter = factory.createJavaServiceContract(); + inter.setInterface(HelloWorldService.class); + ref.setServiceContract(inter); + cref.setPort(ref); + cref.getTargetConfiguredServices().add(cTargetService); + cref.initialize(assemblyContext); + + EntryPoint sourceEP = createFooBindingEntryPoint("source", HelloWorldService.class); + sourceEP.setConfiguredReference(cref); + sourceEP.getConfiguredService().getPort().setName("HelloWorldService"); + sourceEP.initialize(assemblyContext); + + Module module = factory.createModule(); + module.setName("test.module"); + module.getEntryPoints().add(sourceEP); + module.getComponents().add(targetComponent); + module.setImplementationClass(CompositeContextImpl.class); + module.setComponentType(getCompositeComponentType()); + module.initialize(assemblyContext); + return module; + } + + /** + * Creates a module with an entry point wired to a "target" external service configured with the {@link + * FooBinding} + */ + public static Module createModuleWithEntryPointToExternalService() { + //Component sourceComponent = createComponent("source", HelloWorldClient.class, Scope.MODULE); + + EntryPoint sourceEP = createFooBindingEntryPoint("source", HelloWorldService.class); + sourceEP.getConfiguredService().getPort().setName("HelloWorldService"); + sourceEP.initialize(assemblyContext); + + + ExternalService targetES = createFooBindingExternalService("target", HelloWorldService.class); + + Service targetService = factory.createService(); + JavaServiceContract targetContract = factory.createJavaServiceContract(); + targetContract.setInterface(HelloWorldService.class); + targetService.setServiceContract(targetContract); + targetService.setName("HelloWorld"); + ConfiguredService cTargetService = factory.createConfiguredService(); + cTargetService.setPort(targetService); + targetES.setConfiguredService(cTargetService); + targetES.initialize(assemblyContext); + + Reference ref = factory.createReference(); + ref.setName("setHelloWorldService"); + JavaServiceContract inter = factory.createJavaServiceContract(); + inter.setInterface(HelloWorldService.class); + ref.setServiceContract(inter); + + + ConfiguredReference cref = factory.createConfiguredReference(ref.getName(), "target"); + cref.setPort(ref); + cref.initialize(assemblyContext); + sourceEP.setConfiguredReference(cref); + sourceEP.initialize(assemblyContext); + + Module module = factory.createModule(); + module.setName("test.module"); + module.getEntryPoints().add(sourceEP); + module.getExternalServices().add(targetES); + module.initialize(assemblyContext); + return module; + } + + + /** + * Creates a test system module with source and target components wired together. + * + * @see org.apache.tuscany.core.mock.component.Source + * @see org.apache.tuscany.core.mock.component.Target + */ + + public static Module createModuleWithWiredComponents(Scope sourceScope, Scope targetScope) { + + // create the target component + AtomicComponent target = factory.createSimpleComponent(); + target.setName("target"); + JavaImplementation targetImpl = factory.createJavaImplementation(); + targetImpl.setComponentType(factory.createComponentType()); + targetImpl.setImplementationClass(TargetImpl.class); + target.setImplementation(targetImpl); + Service targetService = factory.createService(); + JavaServiceContract targetContract = factory.createJavaServiceContract(); + targetContract.setInterface(Target.class); + targetService.setServiceContract(targetContract); + targetService.setName("Target"); + targetImpl.getComponentType().getServices().add(targetService); + targetContract.setScope(targetScope); + ConfiguredService cTargetService = factory.createConfiguredService(); + cTargetService.setPort(targetService); + cTargetService.initialize(assemblyContext); + target.getConfiguredServices().add(cTargetService); + target.initialize(assemblyContext); + + // create the source component + AtomicComponent source = factory.createSimpleComponent(); + ComponentType componentType = factory.createComponentType(); + source.setName("source"); + JavaImplementation impl = factory.createJavaImplementation(); + impl.setComponentType(componentType); + impl.setImplementationClass(SourceImpl.class); + source.setImplementation(impl); + Service s = systemFactory.createService(); + JavaServiceContract contract = systemFactory.createJavaServiceContract(); + contract.setInterface(Source.class); + s.setServiceContract(contract); + contract.setScope(sourceScope); + impl.getComponentType().getServices().add(s); + source.setImplementation(impl); + + // wire source to target + JavaServiceContract refContract = systemFactory.createJavaServiceContract(); + refContract.setInterface(Target.class); + Reference reference = systemFactory.createReference(); + reference.setName("setTarget"); + reference.setServiceContract(refContract); + componentType.getReferences().add(reference); + ConfiguredReference cReference = systemFactory.createConfiguredReference(reference.getName(), "target"); + cReference.initialize(assemblyContext); + source.getConfiguredReferences().add(cReference); + + // wire multiplicity using a setter + JavaServiceContract refContract2 = systemFactory.createJavaServiceContract(); + refContract2.setInterface(Target.class); + Reference reference2 = systemFactory.createReference(); + reference2.setName("setTargets"); + reference2.setServiceContract(refContract2); + reference2.setMultiplicity(Multiplicity.ONE_N); + componentType.getReferences().add(reference2); + ConfiguredReference cReference2 = systemFactory.createConfiguredReference(reference2.getName(), "target"); + cReference2.initialize(assemblyContext); + source.getConfiguredReferences().add(cReference2); + + // wire multiplicity using a field + JavaServiceContract refContract3 = systemFactory.createJavaServiceContract(); + refContract3.setInterface(Target.class); + Reference reference3 = systemFactory.createReference(); + reference3.setName("targetsThroughField"); + reference3.setServiceContract(refContract3); + reference3.setMultiplicity(Multiplicity.ONE_N); + componentType.getReferences().add(reference3); + ConfiguredReference cReference3 = systemFactory.createConfiguredReference(reference3.getName(), "target"); + cReference3.initialize(assemblyContext); + source.getConfiguredReferences().add(cReference3); + + // wire multiplicity using a array + JavaServiceContract refContract4 = systemFactory.createJavaServiceContract(); + refContract4.setInterface(Target.class); + Reference reference4 = systemFactory.createReference(); + reference4.setName("setArrayOfTargets"); + reference4.setServiceContract(refContract4); + reference4.setMultiplicity(Multiplicity.ONE_N); + componentType.getReferences().add(reference4); + ConfiguredReference cReference4 = systemFactory.createConfiguredReference(reference4.getName(), "target"); + cReference4.initialize(assemblyContext); + source.getConfiguredReferences().add(cReference4); + + source.initialize(assemblyContext); + + Module module = systemFactory.createModule(); + module.setName("system.module"); + + module.getComponents().add(source); + module.getComponents().add(target); + module.initialize(assemblyContext); + return module; + } + + + /** + * Creates a test system module with source and target components wired together. + * + * @see org.apache.tuscany.core.mock.component.Source + * @see org.apache.tuscany.core.mock.component.Target + */ + + public static Module createModuleWithWiredComponentsOfDifferentInterface(Scope sourceScope, Scope targetScope) { + + // create the target component + AtomicComponent target = factory.createSimpleComponent(); + target.setName("target"); + JavaImplementation targetImpl = factory.createJavaImplementation(); + targetImpl.setComponentType(factory.createComponentType()); + targetImpl.setImplementationClass(OtherTargetImpl.class); + target.setImplementation(targetImpl); + Service targetService = factory.createService(); + JavaServiceContract targetContract = factory.createJavaServiceContract(); + targetContract.setInterface(OtherTarget.class); + targetService.setServiceContract(targetContract); + targetService.setName("Target"); + targetImpl.getComponentType().getServices().add(targetService); + targetContract.setScope(targetScope); + ConfiguredService cTargetService = factory.createConfiguredService(); + cTargetService.setPort(targetService); + cTargetService.initialize(assemblyContext); + target.getConfiguredServices().add(cTargetService); + target.initialize(assemblyContext); + + // create the source component + AtomicComponent source = factory.createSimpleComponent(); + ComponentType componentType = factory.createComponentType(); + source.setName("source"); + JavaImplementation impl = factory.createJavaImplementation(); + impl.setComponentType(componentType); + impl.setImplementationClass(SourceImpl.class); + source.setImplementation(impl); + Service s = systemFactory.createService(); + JavaServiceContract contract = systemFactory.createJavaServiceContract(); + contract.setInterface(Source.class); + s.setServiceContract(contract); + contract.setScope(sourceScope); + impl.getComponentType().getServices().add(s); + source.setImplementation(impl); + + // wire source to target + JavaServiceContract refContract = systemFactory.createJavaServiceContract(); + refContract.setInterface(Target.class); + Reference reference = systemFactory.createReference(); + reference.setName("setTarget"); + reference.setServiceContract(refContract); + componentType.getReferences().add(reference); + ConfiguredReference cReference = systemFactory.createConfiguredReference(reference.getName(), "target"); + cReference.initialize(assemblyContext); + source.getConfiguredReferences().add(cReference); + + // wire multiplicity using a setter + JavaServiceContract refContract2 = systemFactory.createJavaServiceContract(); + refContract2.setInterface(Target.class); + Reference reference2 = systemFactory.createReference(); + reference2.setName("setTargets"); + reference2.setServiceContract(refContract2); + reference2.setMultiplicity(Multiplicity.ONE_N); + componentType.getReferences().add(reference2); + ConfiguredReference cReference2 = systemFactory.createConfiguredReference(reference2.getName(), "target"); + cReference2.initialize(assemblyContext); + source.getConfiguredReferences().add(cReference2); + + // wire multiplicity using a field + JavaServiceContract refContract3 = systemFactory.createJavaServiceContract(); + refContract3.setInterface(Target.class); + Reference reference3 = systemFactory.createReference(); + reference3.setName("targetsThroughField"); + reference3.setServiceContract(refContract3); + reference3.setMultiplicity(Multiplicity.ONE_N); + componentType.getReferences().add(reference3); + ConfiguredReference cReference3 = systemFactory.createConfiguredReference(reference3.getName(), "target"); + cReference3.initialize(assemblyContext); + source.getConfiguredReferences().add(cReference3); + + // wire multiplicity using a array + JavaServiceContract refContract4 = systemFactory.createJavaServiceContract(); + refContract4.setInterface(Target.class); + Reference reference4 = systemFactory.createReference(); + reference4.setName("setArrayOfTargets"); + reference4.setServiceContract(refContract4); + reference4.setMultiplicity(Multiplicity.ONE_N); + componentType.getReferences().add(reference4); + ConfiguredReference cReference4 = systemFactory.createConfiguredReference(reference4.getName(), "target"); + cReference4.initialize(assemblyContext); + source.getConfiguredReferences().add(cReference4); + + source.initialize(assemblyContext); + + Module module = systemFactory.createModule(); + module.setName("system.module"); + + module.getComponents().add(source); + module.getComponents().add(target); + module.initialize(assemblyContext); + return module; + } + + + /** + * Returns a collection of bootstrap configuration builders + */ + public static List createSystemBuilders() { + List builders = new ArrayList(); + builders.add((new SystemContextFactoryBuilder(null))); + builders.add(new SystemEntryPointBuilder()); + builders.add(new SystemExternalServiceBuilder()); + return builders; + } + + /** + * Creates an composite context faxtory + * + * @param name the name of the component + * @throws BuilderException + * @see ContextFactory + */ + public static ContextFactory createCompositeConfiguration(String name + ) throws BuilderException, ConfigurationLoadException { + + Component sc = createCompositeComponent(name); + SystemContextFactoryBuilder builder = new SystemContextFactoryBuilder(null); + builder.build(sc); + return (ContextFactory) sc.getContextFactory(); + } + + /** + * Creates a Java POJO component context + * + * @param name the name of the context + * @param implType the POJO class + * @param scope the component scope + * @param moduleComponentContext the containing composite context + * @throws NoSuchMethodException if the POJO does not have a default noi-args constructor + */ + public static JavaAtomicContext createPojoContext(String name, Class implType, Scope scope, + CompositeContext moduleComponentContext) throws NoSuchMethodException, ConfigurationLoadException { + AtomicComponent component = createComponent(name, implType, scope); + + Set fields = JavaIntrospectionHelper.getAllFields(implType); + Set methods = JavaIntrospectionHelper.getAllUniqueMethods(implType); + List injectors = new ArrayList(); + + EventInvoker initInvoker = null; + boolean eagerInit = false; + EventInvoker destroyInvoker = null; + for (Field field : fields) { + ComponentName compName = field.getAnnotation(ComponentName.class); + if (compName != null) { + Injector injector = new FieldInjector(field, new SingletonObjectFactory(name)); + injectors.add(injector); + } + org.osoa.sca.annotations.Context context = field.getAnnotation(org.osoa.sca.annotations.Context.class); + if (context != null) { + Injector injector = new FieldInjector(field, new SingletonObjectFactory(moduleComponentContext)); + injectors.add(injector); + } + } + for (Method method : methods) { + // FIXME Java5 + Init init = method.getAnnotation(Init.class); + if (init != null && initInvoker == null) { + initInvoker = new MethodEventInvoker(method); + eagerInit = init.eager(); + continue; + } + Destroy destroy = method.getAnnotation(Destroy.class); + if (destroy != null && destroyInvoker == null) { + destroyInvoker = new MethodEventInvoker(method); + continue; + } + ComponentName compName = method.getAnnotation(ComponentName.class); + if (compName != null) { + Injector injector = new MethodInjector(method, new SingletonObjectFactory(name)); + injectors.add(injector); + } + org.osoa.sca.annotations.Context context = method.getAnnotation(org.osoa.sca.annotations.Context.class); + if (context != null) { + Injector injector = new MethodInjector(method, new SingletonObjectFactory(moduleComponentContext)); + injectors.add(injector); + } + } + boolean stateless = (scope == Scope.INSTANCE); + return new JavaAtomicContext("foo", new PojoObjectFactory(JavaIntrospectionHelper + .getDefaultConstructor(implType), null, injectors), eagerInit, initInvoker, destroyInvoker, stateless); + } + + /** + * Creates a default {@link RuntimeContext} configured with support for Java component implementations + * + * @throws ConfigurationException + */ + public static RuntimeContext createJavaRuntime() throws ConfigurationException { + MonitorFactory monitorFactory = new NullMonitorFactory(); + ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); + DefaultWireBuilder wireBuilder = new DefaultWireBuilder(); + RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder); + runtime.start(); + runtime.getSystemContext().registerModelObject(createSystemCompositeComponent(SYSTEM_CHILD)); + SystemCompositeContext ctx = (SystemCompositeContext) runtime.getSystemContext().getContext(SYSTEM_CHILD); + Component comp = systemFactory.createSystemComponent(POLICY_BUILDER_REGISTRY, PolicyBuilderRegistry.class, DefaultPolicyBuilderRegistry.class, Scope.MODULE); + comp.getImplementation().setComponentType(getIntrospector().introspect(DefaultPolicyBuilderRegistry.class)); + ctx.registerModelObject(comp); + comp = systemFactory.createSystemComponent(MESSAGE_FACTORY, MessageFactory.class, MessageFactoryImpl.class, Scope.MODULE); + comp.getImplementation().setComponentType(getIntrospector().introspect(MessageFactoryImpl.class)); + ctx.registerModelObject(comp); + comp = systemFactory.createSystemComponent(PROXY_FACTORY_FACTORY, WireFactoryFactory.class, JDKWireFactoryFactory.class, Scope.MODULE); + comp.getImplementation().setComponentType(getIntrospector().introspect(JDKWireFactoryFactory.class)); + ctx.registerModelObject(comp); + comp = systemFactory.createSystemComponent(WIRE_FACTORY_SERVICE, org.apache.tuscany.core.wire.service.WireFactoryService.class, DefaultWireFactoryService.class, Scope.MODULE); + comp.getImplementation().setComponentType(getIntrospector().introspect(DefaultWireFactoryService.class)); + ctx.registerModelObject(comp); + comp = systemFactory.createSystemComponent(JAVA_BUILDER, ContextFactoryBuilder.class, JavaContextFactoryBuilder.class, Scope.MODULE); + comp.getImplementation().setComponentType(getIntrospector().introspect(JavaContextFactoryBuilder.class)); + ctx.registerModelObject(comp); + comp = systemFactory.createSystemComponent(JAVA_WIRE_BUILDER, WireBuilder.class, JavaTargetWireBuilder.class, Scope.MODULE); + comp.getImplementation().setComponentType(getIntrospector().introspect(JavaTargetWireBuilder.class)); + ctx.registerModelObject(comp); + ctx.publish(new ModuleStart(new Object())); + return runtime; + } + + /** + * Registers the {@link FooBinding} builders with a given runtime + * + * @throws ConfigurationException + */ + public static RuntimeContext registerFooBinding(RuntimeContext runtime) throws ConfigurationException { + CompositeContext child = (CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD); + child.getContext(MockFactory.JAVA_BUILDER).getInstance(null); + Component comp = systemFactory.createSystemComponent(FOO_BUILDER, ContextFactoryBuilder.class, FooBindingBuilder.class, Scope.MODULE); + comp.getImplementation().setComponentType(getIntrospector().introspect(FooBindingBuilder.class)); + child.registerModelObject(comp); + comp = systemFactory.createSystemComponent(FOO_WIRE_BUILDER, WireBuilder.class, FooBindingWireBuilder.class, Scope.MODULE); + comp.getImplementation().setComponentType(getIntrospector().introspect(FooBindingWireBuilder.class)); + child.registerModelObject(comp); + // since the child context is already started, we need to manually retrieve the components to init them + Assert.assertNotNull(child.getContext(FOO_BUILDER).getInstance(null)); + Assert.assertNotNull(child.getContext(FOO_WIRE_BUILDER).getInstance(null)); + return runtime; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockScopeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockScopeContext.java new file mode 100644 index 0000000000..fe128f19a7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockScopeContext.java @@ -0,0 +1,131 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.container.java.invocation.mock.SimpleTargetImpl; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.ContextRuntimeException; +import org.apache.tuscany.core.context.EventFilter; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.RuntimeEventListener; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.ScopeRuntimeException; +import org.apache.tuscany.core.context.event.Event; +import org.apache.tuscany.model.assembly.AtomicComponent; + +public class MockScopeContext implements ScopeContext { + + Map components; + + public MockScopeContext() { + components = new HashMap(); + components.put("foo", new SimpleTargetImpl()); + components.put("bar", new SimpleTargetImpl()); + } + + public MockScopeContext(Map instances) { + components = instances; + } + + + public void start() { + } + + public void stop() { + } + + public void publish(Event object) { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void addListener(RuntimeEventListener listener) throws ContextRuntimeException { + } + + public void addListener(EventFilter filter, RuntimeEventListener listener) { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void removeListener(RuntimeEventListener listener) throws ContextRuntimeException { + } + + public String getName() { + return "Mock Scope Container"; + } + + public boolean isCacheable() { + return false; + } + + public int[] getEventTypes() { + return null; + } + + public AtomicContext getContext(String name) { + return null; + } + + public Object getInstance(QualifiedName name) throws ScopeRuntimeException { + return components.get(name.getPartName()); + } + + public AtomicContext getContextByKey(String name, Object key) { + return null; + } + + public void setComponent(AtomicComponent component) throws ScopeRuntimeException { + } + + public void removeContext(String name) throws ScopeRuntimeException { + } + + public void removeContextByKey(String name, Object key) throws ScopeRuntimeException { + } + + public AtomicComponent[] getComponents() { + return null; + } + + public void registerFactories(List> configurations) { + } + + public void registerFactory(ContextFactory configuration) { + } + + public int getLifecycleState(){ + return RUNNING; + } + + + public void setLifecycleState(int state) { + } + + + public void setName(String name) { + } + + + public void onEvent(Event event) { + //To change body of implemented methods use File | Settings | File Templates. + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBinding.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBinding.java new file mode 100644 index 0000000000..49c59bc718 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBinding.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.binding.foo; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Binding; + +/** + * Represents a mock binding that echoes back a single parameter + * + * @version $Rev$ $Date$ + */ +public class FooBinding implements Binding { + + public FooBinding() { + } + + public String getURI() { + return null; + } + + public void setURI(String value) { + } + + public void initialize(AssemblyContext modelContext) { + } + + public void freeze() { + } + + public boolean accept(AssemblyVisitor visitor) { + return true; + } + + private Object contextFactory; + + public void setContextFactory(Object factory) { + contextFactory = factory; + } + + public Object getContextFactory() { + System.out.println("retting"); + return contextFactory; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingBuilder.java new file mode 100644 index 0000000000..558a8ce2cf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingBuilder.java @@ -0,0 +1,114 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.binding.foo; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.extension.EntryPointContextFactory; +import org.apache.tuscany.core.injection.ObjectCreationException; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Service; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +/** + * Creates a ContextFactoryBuilder for an entry point or external service configured with the {@link FooBinding} + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class FooBindingBuilder implements ContextFactoryBuilder { + private ContextFactoryBuilderRegistry builderRegistry; + + private MessageFactory messageFactory; + + private WireFactoryService wireFactoryService; + + public FooBindingBuilder(WireFactoryService wireFactoryService) { + this.wireFactoryService = wireFactoryService; + } + + public FooBindingBuilder() { + } + + @Init(eager = true) + public void init() { + builderRegistry.register(this); + } + + @Autowire + public void setBuilderRegistry(ContextFactoryBuilderRegistry builderRegistry) { + this.builderRegistry = builderRegistry; + } + + @Autowire + public void setWireFactoryService(WireFactoryService wireFactoryService) { + this.wireFactoryService = wireFactoryService; + } + + + /** + * Sets the factory used to construct wire messages + * + * @param msgFactory + */ + @Autowire + public void setMessageFactory(MessageFactory msgFactory) { + this.messageFactory = msgFactory; + } + + public void build(AssemblyObject object) throws BuilderException { + if (object instanceof EntryPoint) { + EntryPoint ep = (EntryPoint) object; + if (ep.getBindings().size() < 1 || !(ep.getBindings().get(0) instanceof FooBinding)) { + return; + } + EntryPointContextFactory contextFactory = new FooEntryPointContextFactory(ep.getName(), messageFactory); + ConfiguredService configuredService = ep.getConfiguredService(); + Service service = configuredService.getPort(); + SourceWireFactory wireFactory = wireFactoryService.createSourceFactory(ep.getConfiguredReference()).get(0); + contextFactory.addSourceWireFactory(service.getName(), wireFactory); + ep.setContextFactory(contextFactory); + } else if (object instanceof ExternalService) { + ExternalService es = (ExternalService) object; + if (es.getBindings().size() < 1 || !(es.getBindings().get(0) instanceof FooBinding)) { + return; + } + FooExternalServiceContextFactory contextFactory = new FooExternalServiceContextFactory(es.getName(), + new FooClientFactory()); + ConfiguredService configuredService = es.getConfiguredService(); + Service service = configuredService.getPort(); + TargetWireFactory wireFactory = wireFactoryService.createTargetFactory(configuredService); + contextFactory.addTargetWireFactory(service.getName(), wireFactory); + es.setContextFactory(contextFactory); + } + } + + private static class FooClientFactory implements ObjectFactory { + + public Object getInstance() throws ObjectCreationException { + return new FooClient(); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingWireBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingWireBuilder.java new file mode 100644 index 0000000000..e2592024f8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingWireBuilder.java @@ -0,0 +1,76 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.binding.foo; + +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.WireBuilder; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.osoa.sca.annotations.Init; + +public class FooBindingWireBuilder implements WireBuilder { + + public FooBindingWireBuilder() { + super(); + } + + private RuntimeContext runtimeContext; + + @Autowire + public void setRuntimeContext(RuntimeContext context) { + runtimeContext = context; + } + + @Init(eager = true) + public void init() { + runtimeContext.addBuilder(this); + } + + + public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, + ScopeContext targetScopeContext) throws BuilderConfigException { + if (!FooExternalServiceContextFactory.class.isAssignableFrom(targetType)) { + return; + } + for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration().getInvocationConfigurations() + .values()) { + FooExternalServiceTargetInvoker invoker = new FooExternalServiceTargetInvoker(sourceFactory.getConfiguration().getTargetName() + .getPartName()); + sourceInvocationConfig.setTargetInvoker(invoker); + } + + } + + public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) + throws BuilderConfigException { + if (FooExternalServiceContextFactory.class.isAssignableFrom(targetType)) { + for (TargetInvocationConfiguration targetInvocationConfig : targetFactory.getConfiguration().getInvocationConfigurations() + .values()) { + TargetInvoker invoker = new FooExternalServiceTargetInvoker(targetFactory.getConfiguration().getTargetName().getQualifiedName()); + targetInvocationConfig.setTargetInvoker(invoker); + } + + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooClient.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooClient.java new file mode 100644 index 0000000000..9f67eb7786 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooClient.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.binding.foo; + +import java.lang.reflect.Array; + +import org.apache.tuscany.core.context.TargetException; + +/** + * A mock client for a transport binding + * + * @version $Rev$ $Date$ + */ +public class FooClient { + + public FooClient() { + } + + public Object invoke(Object msg) { + if (msg!=null && msg.getClass().isArray() && Array.getLength(msg) == 1){ + return Array.get(msg,0); + }else{ + throw new TargetException("This binding only understands operations with a single parameter"); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooEntryPointContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooEntryPointContextFactory.java new file mode 100644 index 0000000000..69d81f66be --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooEntryPointContextFactory.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.binding.foo; + +import org.apache.tuscany.core.extension.EntryPointContextFactory; +import org.apache.tuscany.core.message.MessageFactory; + +/** + * + * + * @version $Rev$ $Date$ + */ +public class FooEntryPointContextFactory extends EntryPointContextFactory { + + public FooEntryPointContextFactory(String name, MessageFactory msgFactory) { + super(name, msgFactory); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceContextFactory.java new file mode 100644 index 0000000000..c7f67e2ff2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceContextFactory.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.binding.foo; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.extension.ExternalServiceContextFactory; + +/** + * Creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} configured with the appropriate + * wire chains and bindings. This implementation serves as a marker for + * {@link org.apache.tuscany.container.java.mock.binding.foo.FooBindingWireBuilder} + * + * @version $Rev$ $Date$ + */ +public class FooExternalServiceContextFactory extends ExternalServiceContextFactory { + + public FooExternalServiceContextFactory(String name, ObjectFactory objectFactory) { + super(name, objectFactory); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceTargetInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceTargetInvoker.java new file mode 100644 index 0000000000..ecc9655a10 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceTargetInvoker.java @@ -0,0 +1,78 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.binding.foo; + +import org.apache.tuscany.core.context.ExternalServiceContext; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.TargetInvoker; + +import java.lang.reflect.InvocationTargetException; + +/** + * Responsible for invoking a mock transport binding client configured for an external service over a wire + * + * @version $Rev$ $Date$ + */ +public class FooExternalServiceTargetInvoker implements TargetInvoker { + + private String name; + private ExternalServiceContext context; + + public FooExternalServiceTargetInvoker(String esName) { + assert (esName != null) : "No external service name specified"; + name = esName; // name is not used; it is included for illustration + } + + public Object invokeTarget(Object payload) throws InvocationTargetException { + FooClient client = new FooClient(); + if (payload != null) { + return client.invoke(payload); + } else { + return client.invoke(null); + } + } + + public boolean isCacheable() { + return false; + } + + public Message invoke(Message msg) { + try { + Object resp = invokeTarget(msg.getBody()); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBody(e.getCause()); + } catch (Throwable e) { + msg.setBody(e); + } + return msg; + } + + public void setNext(Interceptor next) { + throw new UnsupportedOperationException(); + } + + public Object clone() throws CloneNotSupportedException { + try { + FooExternalServiceTargetInvoker invoker = (FooExternalServiceTargetInvoker) super.clone(); + invoker.context = this.context; + invoker.name = this.name; + return invoker; + } catch (CloneNotSupportedException e) { + return null; // will not happen + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/AbstractGenericComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/AbstractGenericComponent.java new file mode 100644 index 0000000000..0c9d8172f8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/AbstractGenericComponent.java @@ -0,0 +1,296 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import java.util.List; +import java.util.Map; + +import org.osoa.sca.ModuleContext; +import org.osoa.sca.annotations.ComponentName; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Property; + +/** + * Base test component implementation + * + * @version $Rev$ $Date$ + */ +public class AbstractGenericComponent implements GenericComponent { + + @ComponentName + private String name; + + public String getName() { + return name; + } + + @Context + private ModuleContext context; + + public ModuleContext getModuleContext() { + return context; + } + + //---------------------------------- + // Collections + //---------------------------------- + + Map testMap; + + public Map getTestMap() { + return testMap; + } + + public void setTestMap(Map testMap) { + this.testMap = testMap; + } + + List testList; + + public List getTestList() { + return testList; + } + + public void setTestList(List testList) { + this.testList = testList; + } + + //---------------------------------- + // Arrays + //---------------------------------- + + private int[] arrayInt; + + public int[] getArrayInt() { + return arrayInt; + } + + public void setArrayInt(int[] arrayInt) { + this.arrayInt = arrayInt; + } + + private float[] arrayFloat; + + public float[] getArrayFloat() { + return arrayFloat; + } + + public void setArrayFloat(float[] pArrayFloat) { + arrayFloat = pArrayFloat; + } + + private double[] arrayDouble; + + public double[] getArrayDouble() { + return arrayDouble; + } + + public void setArrayDouble(double[] pArrayDouble) { + arrayDouble = pArrayDouble; + } + + private long[] arrayLong; + + public long[] getArrayLong() { + return arrayLong; + } + + public void setArrayLong(long[] arrayLong) { + this.arrayLong = arrayLong; + } + + private short[] arrayShort; + + public short[] getArrayShort() { + return arrayShort; + } + + public void setArrayShort(short[] arrayShort) { + this.arrayShort = arrayShort; + } + + private boolean[] arrayBoolean; + + public boolean[] getArrayBoolean() { + return arrayBoolean; + } + + public void setArrayBoolean(boolean[] arrayBoolean) { + this.arrayBoolean = arrayBoolean; + } + + private String[] arrayString; + + public String[] getArrayString() { + return arrayString; + } + + public void setArrayString(String[] arrayString) { + this.arrayString = arrayString; + } + + //---------------------------------- + // Primitives + //---------------------------------- + + private boolean mBoolean; + + public boolean getBoolean() { + return mBoolean; + } + + public void setBoolean(boolean pBoolean) { + mBoolean = pBoolean; + } + + private short mShort; + + public short getShort() { + return mShort; + } + + public void setShort(short pShort) { + mShort = pShort; + } + + private int mInt; + + public int getInt() { + return mInt; + } + + public void setInt(int pInt) { + mInt = pInt; + } + + private long mLong; + + public long getLong() { + return mLong; + } + + public void setLong(long pLong) { + mLong = pLong; + } + + private double mDouble; + + public double getDouble() { + return mDouble; + } + + public void setDouble(double pDouble) { + mDouble = pDouble; + } + + private float mFloat; + + public float getFloat() { + return mFloat; + } + + public void setFloat(float pFloat) { + mFloat = pFloat; + } + + private char mChar; + + public char getChar() { + return mChar; + } + + public void setChar(char pChar) { + mChar = pChar; + } + + //---------------------------------- + // Object types + //---------------------------------- + + private String mString; + + public String getString() { + return mString; + } + + public void setString(String pString) { + mString = pString; + } + + private Short mOShort; + + public Short getOShort() { + return mOShort; + } + + public void setOShort(Short pOShort) { + mOShort = pOShort; + } + + private Integer mOInteger; + + public Integer getOInteger() { + return mOInteger; + } + + public void setOInteger(Integer pOInteger) { + mOInteger = pOInteger; + } + + private Long mOLong; + + public Long getOLong() { + return mOLong; + } + + public void setOLong(Long pOLong) { + mOLong = pOLong; + } + + private Float mOFloat; + + public Float getOFloat() { + return mOFloat; + } + + public void setOFloat(Float pOFloat) { + mOFloat = pOFloat; + } + + private Double mODouble; + + public Double getODouble() { + return mODouble; + } + + public void setODouble(Double pODouble) { + mODouble = pODouble; + } + + @Property(name = "genericComponent") + private GenericComponent mGenericComponent; + + public GenericComponent getGenericComponent() { + return mGenericComponent; + } + + public void setGenericComponent(GenericComponent pGenericComponent) { + mGenericComponent = pGenericComponent; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadContextPojo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadContextPojo.java new file mode 100644 index 0000000000..7840b57dea --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadContextPojo.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Context; + +public class BadContextPojo { + + @Context + String moduleContext; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadNamePojo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadNamePojo.java new file mode 100644 index 0000000000..d9753fa9f0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadNamePojo.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.ComponentName; + +public class BadNamePojo { + @ComponentName + private int name; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/DataObject.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/DataObject.java new file mode 100644 index 0000000000..695cc2a5a1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/DataObject.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import java.io.Serializable; + +/** + * A complex type for testing + * + * @version $Rev$ $Date$ + */ +public class DataObject implements Serializable { + + private String stringValue; + + public String getStringValue() { + return stringValue; + } + + public void setStringValue(String stringValue) { + this.stringValue = stringValue; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/GenericComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/GenericComponent.java new file mode 100644 index 0000000000..44f1c02bfd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/GenericComponent.java @@ -0,0 +1,142 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import java.util.List; +import java.util.Map; + +import org.osoa.sca.ModuleContext; + +/** + * Generic test component + * + * @version $Rev$ $Date$ + */ +public interface GenericComponent { + + public String getName(); + + public ModuleContext getModuleContext(); + + // ---------------------------------- + // Collections + // ---------------------------------- + + public Map getTestMap(); + + public void setTestMap(Map pTestMap); + + public List getTestList(); + + public void setTestList(List pTestList); + + // ---------------------------------- + // Arrays + // ---------------------------------- + + public int[] getArrayInt(); + + public void setArrayInt(int[] pArrayInt); + + public float[] getArrayFloat(); + + public void setArrayFloat(float[] pArrayFloat); + + public double[] getArrayDouble(); + + public void setArrayDouble(double[] pArrayDouble); + + public long[] getArrayLong(); + + public void setArrayLong(long[] pArrayLong); + + public short[] getArrayShort(); + + public void setArrayShort(short[] pArrayShort); + + public boolean[] getArrayBoolean(); + + public void setArrayBoolean(boolean[] pArrayBoolean); + + public String[] getArrayString(); + + public void setArrayString(String[] pArrayString); + + // ---------------------------------- + // Primitives + // ---------------------------------- + + public boolean getBoolean(); + + public void setBoolean(boolean pBoolean); + + public short getShort(); + + public void setShort(short pShort); + + public int getInt(); + + public void setInt(int pInt); + + public long getLong(); + + public void setLong(long pLong); + + public double getDouble(); + + public void setDouble(double pDouble); + + public float getFloat(); + + public void setFloat(float pFloat); + + public char getChar(); + + public void setChar(char pChar); + + // ---------------------------------- + // Object types + // ---------------------------------- + + public String getString(); + + public void setString(String pString); + + public Short getOShort(); + + public void setOShort(Short pOShort); + + public Integer getOInteger(); + + public void setOInteger(Integer pOInteger); + + public Long getOLong(); + + public void setOLong(Long pOLong); + + public Float getOFloat(); + + public void setOFloat(Float pOFloat); + + public Double getODouble(); + + public void setODouble(Double pODouble); + + public GenericComponent getGenericComponent(); + + public void setGenericComponent(GenericComponent pGenericComponent); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/HelloWorldClient.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/HelloWorldClient.java new file mode 100644 index 0000000000..1e7ca9f36b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/HelloWorldClient.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; + +/** + * + * + * @version $Rev$ $Date$ + */ +public class HelloWorldClient implements HelloWorldService{ + + private int count; + + public HelloWorldClient() { + } + + private HelloWorldService service; + + public void setHelloWorldService(HelloWorldService service){ + this.service = service; + } + + public String hello(String name) { + ++count; + return service.hello(name); + } + + public int count() { + return count; + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/LocalComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/LocalComponentImpl.java new file mode 100644 index 0000000000..4b57c7f301 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/LocalComponentImpl.java @@ -0,0 +1,97 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.ModuleContext; +import org.osoa.sca.annotations.ComponentName; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +/** + * A test local service + * + * @version $Rev$ $Date$ + */ + +public class LocalComponentImpl { + + @ComponentName + protected String name; + + public String getName() { + return name; + } + + @Context + protected ModuleContext moduleCtx; + + public ModuleContext getModuleContext() { + return moduleCtx; + } + + @Property(name = "fieldSetter", required = true) + private String mfieldSetter; + + public String getfieldSetter() { + return mfieldSetter; + } + + public void setfieldSetter(String pfieldSetter) throws Exception { + throw new Exception("Set method instead of field"); + } + + private String mMethodSetter; + boolean mSetByMethod; + + public String getMethodSetter() throws Exception { + if (mSetByMethod) { + return mMethodSetter; + } + throw new Exception("Property method setter failed"); + + } + + @Property(required = true) + public void setMethodSetter(String pMethodSetter) { + mSetByMethod = true; + mMethodSetter = pMethodSetter; + } + + @Reference(name = "requiredDataObject", required = true) + private DataObject mRequiredDataObject; + + public DataObject getRequiredDataObject() { + return mRequiredDataObject; + } + + public void setRequiredDataObject(DataObject pRequiredDataObject) { + mRequiredDataObject = pRequiredDataObject; + } + + @Reference(name = "optionalDataObject") + private DataObject mOptionalDataObject; + + public DataObject getOptionalDataObject() { + return mOptionalDataObject; + } + + public void setOptionalDataObject(DataObject pOptionalDataObject) { + mOptionalDataObject = pOptionalDataObject; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java new file mode 100644 index 0000000000..04cbb01de6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public interface ModuleScopeComponent extends GenericComponent { + public GenericComponent getGenericComponent(); + + public String getString(); + //public boolean isInit(); +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.componentType b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.componentType new file mode 100644 index 0000000000..ca4c633e59 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.componentType @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.java new file mode 100644 index 0000000000..7981208b9e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Scope; + + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ModuleScopeComponentImpl extends AbstractGenericComponent implements + ModuleScopeComponent { + + private String foo; + + public void setFoo(String foo) { + this.foo = foo; + } + + public String getFoo() { + return foo; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeDestroyOnlyComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeDestroyOnlyComponent.java new file mode 100644 index 0000000000..76218c2d6c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeDestroyOnlyComponent.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Destroy; + +public class ModuleScopeDestroyOnlyComponent extends ModuleScopeComponentImpl { + + boolean destroyed = false; + + public boolean isDestroyed() { + return destroyed; + } + + @Destroy + public void destroy() { + destroyed = true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitComponent.java new file mode 100644 index 0000000000..56a0421f24 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitComponent.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Init; + +public class ModuleScopeEagerInitComponent extends ModuleScopeComponentImpl { + + boolean initialized = false; + + public boolean isInitialized() { + return initialized; + } + + // this value tests to ensure introspection can find the init() method even + // if a field is named the same. Ultimately, this should be in the + // introspection tests + private boolean init; + + @Init(eager = true) + public void init() { + initialized = true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitDestroyComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitDestroyComponent.java new file mode 100644 index 0000000000..dae156737a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitDestroyComponent.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Destroy; + +public class ModuleScopeEagerInitDestroyComponent extends ModuleScopeEagerInitComponent { + + boolean destroyed = false; + + public boolean isDestroyed() { + return destroyed; + } + + @Destroy + public void destroy() { + destroyed = true; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitDestroyComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitDestroyComponent.java new file mode 100644 index 0000000000..695157612b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitDestroyComponent.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Destroy; + +public class ModuleScopeInitDestroyComponent extends ModuleScopeInitOnlyComponent { + + boolean destroyed = false; + + public boolean isDestroyed() { + return destroyed; + } + + @Destroy + public void destroy() { + if (destroyed){ + throw new AssertionError("Destroy called more than once"); + } + destroyed = true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitOnlyComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitOnlyComponent.java new file mode 100644 index 0000000000..4945309852 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitOnlyComponent.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Init; + +public class ModuleScopeInitOnlyComponent extends ModuleScopeComponentImpl { + + boolean initialized = false; + + public boolean isInitialized() { + return initialized; + } + + // this value tests to ensure introspection can find the init() method even + // if a field is named the same. Ultimately, this should be in the introspection tests + private boolean init; + + @Init + public void init() { + if (initialized){ + throw new AssertionError("Init called more than once"); + } + initialized = true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTarget.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTarget.java new file mode 100644 index 0000000000..2edc8246db --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTarget.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +/** + * Implementations are used in wiring tests + * + * @version $Rev$ $Date$ + */ +public interface OtherTarget { + + public String getString(); + + public void setString(String val); +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTargetImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTargetImpl.java new file mode 100644 index 0000000000..08d4d9f720 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/OtherTargetImpl.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +/** + * A target used for testing wires with a different source and target interface + * + * @version $Rev$ $Date$ + */ +public class OtherTargetImpl implements OtherTarget{ + + private String theString; + + public String getString() { + return theString; + } + + public void setString(String val) { + theString = val; + } + + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableService.java new file mode 100644 index 0000000000..645fd7f47c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableService.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Remotable; + +/** + * Used for testing basic remoting operations + * + * @version $Rev$ $Date$ + */ + +@Remotable +public interface RemotableService { + + public void syncOneWay(String msg); + + public String syncTwoWay(String msg); + + public DataObject syncTwoWayCustomType(DataObject val); + + public String getString(); + + public void setString(String string); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableServiceImpl.java new file mode 100644 index 0000000000..34a4273323 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableServiceImpl.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import junit.framework.Assert; +import org.osoa.sca.annotations.Property; + + +/** + * @version $Rev$ $Date$ + */ +public class RemotableServiceImpl implements RemotableService { + + // ---------------------------------- + // Properties + // ---------------------------------- + + @Property(name = "string", required = true) + private String mString; + + public String getString() { + return mString; + } + + public void setString(String string) { + mString = string; + } + + // ---------------------------------- + // Methods + // ---------------------------------- + + public void syncOneWay(String msg) { + Assert.assertEquals("hello", msg); + } + + public String syncTwoWay(String msg) { + return "response"; + } + + public DataObject syncTwoWayCustomType(DataObject val) { + Assert.assertEquals("hello", val.getStringValue()); + DataObject dto = new DataObject(); + dto.setStringValue("return"); + return dto; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponent.java new file mode 100644 index 0000000000..ac7931bd2c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponent.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("REQUEST") +public interface RequestScopeComponent extends GenericComponent { + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponentImpl.java new file mode 100644 index 0000000000..5b20519d90 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponentImpl.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +/** + * @version $Rev$ $Date$ + */ +public class RequestScopeComponentImpl extends AbstractGenericComponent implements + RequestScopeComponent { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeDestroyOnlyComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeDestroyOnlyComponent.java new file mode 100644 index 0000000000..ae63f761c3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeDestroyOnlyComponent.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Scope; + +@Scope("REQUEST") +public class RequestScopeDestroyOnlyComponent extends SessionScopeComponentImpl { + + boolean destroyed = false; + + public boolean isDestroyed() { + return destroyed; + } + + @Destroy + public void destroy() { + destroyed = true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitDestroyComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitDestroyComponent.java new file mode 100644 index 0000000000..67f61df36d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitDestroyComponent.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Scope; + +@Scope("REQUEST") +public class RequestScopeInitDestroyComponent extends SessionScopeInitOnlyComponent { + + boolean destroyed = false; + + public boolean isDestroyed() { + return destroyed; + } + + @Destroy + public void destroy() { + destroyed = true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitOnlyComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitOnlyComponent.java new file mode 100644 index 0000000000..c6c621f518 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeInitOnlyComponent.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +@Scope("REQUEST") +public class RequestScopeInitOnlyComponent extends SessionScopeComponentImpl { + + boolean initialized = false; + + public boolean isInitialized() { + return initialized; + } + + @Init + public void init() { + initialized = true; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponent.java new file mode 100644 index 0000000000..236e083a2b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponent.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("SESSION") +public interface SessionScopeComponent extends GenericComponent { + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponentImpl.java new file mode 100644 index 0000000000..265969a450 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponentImpl.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("SESSION") +public class SessionScopeComponentImpl extends AbstractGenericComponent implements + SessionScopeComponent { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeDestroyOnlyComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeDestroyOnlyComponent.java new file mode 100644 index 0000000000..be20a23d29 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeDestroyOnlyComponent.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Destroy; + +public class SessionScopeDestroyOnlyComponent extends SessionScopeComponentImpl { + + boolean destroyed = false; + + public boolean isDestroyed() { + return destroyed; + } + + @Destroy + public void destroy() { + destroyed = true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitDestroyComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitDestroyComponent.java new file mode 100644 index 0000000000..32aa0142a4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitDestroyComponent.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Destroy; + +public class SessionScopeInitDestroyComponent extends SessionScopeInitOnlyComponent { + + boolean destroyed = false; + + public boolean isDestroyed() { + return destroyed; + } + + @Destroy + public void destroy() { + destroyed = true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitOnlyComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitOnlyComponent.java new file mode 100644 index 0000000000..a518a9b244 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitOnlyComponent.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Init; + +public class SessionScopeInitOnlyComponent extends SessionScopeComponentImpl { + + boolean initialized = false; + + public boolean isInitialized() { + return initialized; + } + + @Init + public void init() { + initialized = true; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Source.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Source.java new file mode 100644 index 0000000000..1f918590f2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Source.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import java.util.List; + +/** + * Implementations are used in wiring tests + * + * @version $Rev$ $Date$ + */ +public interface Source { + + public Target getTarget(); + + public List getTargets(); + + public List getTargetsThroughField(); + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SourceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SourceImpl.java new file mode 100644 index 0000000000..a2588bae5e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SourceImpl.java @@ -0,0 +1,63 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import java.util.List; + +/** + * Mock system component implementation used in wiring tests + * + * @version $Rev$ $Date$ + */ +public class SourceImpl implements Source { + + private Target target; + + private List targets; + + private List targetsThroughField; + + public void setTarget(Target target) { + this.target = target; + } + + public Target getTarget() { + return target; + } + + public List getTargets() { + return targets; + } + + public void setTargets(List targets) { + this.targets = targets; + } + + public List getTargetsThroughField() { + return targetsThroughField; + } + + + private Target[] targetsArray; + + public Target[] getArrayOfTargets() { + return targetsArray; + } + + public void setArrayOfTargets(Target[] targets) { + targetsArray = targets; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponent.java new file mode 100644 index 0000000000..3fe84dd785 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponent.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("STATELESS") +public interface StatelessComponent extends GenericComponent { + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponentImpl.java new file mode 100644 index 0000000000..8b806d6a2e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponentImpl.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +/** + * @version $Rev$ $Date$ + */ +public class StatelessComponentImpl extends AbstractGenericComponent implements + StatelessComponent { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Target.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Target.java new file mode 100644 index 0000000000..a56e52c898 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/Target.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +/** + * Implementations are used in wiring tests + * + * @version $Rev$ $Date$ + */ +public interface Target { + + public String getString(); + + public void setString(String val); +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/TargetImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/TargetImpl.java new file mode 100644 index 0000000000..5a10bfdbc1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/TargetImpl.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.mock.components; + +/** + * Mock system component implementation used in wiring tests + * + * @version $Rev$ $Date$ + */ +public class TargetImpl implements Target { + + private String theString; + + public String getString() { + return theString; + } + + public void setString(String val) { + theString = val; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicModuleScopeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicModuleScopeTestCase.java new file mode 100644 index 0000000000..557f306ad2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicModuleScopeTestCase.java @@ -0,0 +1,139 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.ModuleScopeComponentImpl; +import org.apache.tuscany.container.java.mock.components.ModuleScopeInitDestroyComponent; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.ModuleScopeContext; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.model.assembly.AtomicComponent; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Unit tests for the module scope container + * + * @version $Rev$ $Date$ + */ +public class BasicModuleScopeTestCase extends TestCase { + + /** + * Tests instance identity is properly maintained + */ + public void testInstanceManagement() throws Exception { + EventContext ctx = new EventContextImpl(); + ModuleScopeContext scope = new ModuleScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + // first request + scope.onEvent(new ModuleStart(this)); + ModuleScopeComponentImpl comp1 = (ModuleScopeComponentImpl) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + // second request + ModuleScopeComponentImpl comp2 = (ModuleScopeComponentImpl) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp2); + Assert.assertSame(comp1, comp2); + scope.onEvent(new ModuleStop(this)); + scope.stop(); + } + + public void testSetNullComponents() throws Exception { + EventContext ctx = new EventContextImpl(); + ModuleScopeContext scope = new ModuleScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + scope.onEvent(new ModuleStart(this)); + scope.onEvent(new ModuleStop(this)); + scope.stop(); + } + + public void testRegisterContextBeforeStart() throws Exception { + EventContext ctx = new EventContextImpl(); + ModuleScopeContext scope = new ModuleScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + scope.registerFactory(createConfiguration("NewTestService")); + scope.onEvent(new ModuleStart(this)); + ModuleScopeInitDestroyComponent comp2 = (ModuleScopeInitDestroyComponent) scope.getContext("NewTestService").getInstance(null); + Assert.assertNotNull(comp2); + Assert.assertTrue(comp2.isInitialized()); + scope.onEvent(new ModuleStop(this)); + Assert.assertTrue(comp2.isDestroyed()); + scope.stop(); + } + + public void testRegisterContextAfterStart() throws Exception { + EventContext ctx = new EventContextImpl(); + ModuleScopeContext scope = new ModuleScopeContext(ctx); + scope.start(); + scope.registerFactory(createConfiguration("NewTestService")); + scope.onEvent(new ModuleStart(this)); + scope.registerFactories(createConfigurations()); + ModuleScopeInitDestroyComponent comp2 = (ModuleScopeInitDestroyComponent) scope.getContext("NewTestService").getInstance(null); + Assert.assertNotNull(comp2); + Assert.assertTrue(comp2.isInitialized()); + scope.onEvent(new ModuleStop(this)); + Assert.assertTrue(comp2.isDestroyed()); + scope.stop(); + } + + + private List> createConfigurations() throws BuilderException, ConfigurationLoadException { + PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); + JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); + AtomicComponent component = MockFactory.createComponent("TestService1", ModuleScopeComponentImpl.class, Scope.MODULE); + builder.build(component); + List> configs = new ArrayList>(); + configs.add((ContextFactory) component.getContextFactory()); + return configs; + } + + private ContextFactory createConfiguration(String name) throws BuilderException, ConfigurationLoadException { + PolicyBuilderRegistry policyRegistry = new DefaultPolicyBuilderRegistry(); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), policyRegistry); + JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); + AtomicComponent component = MockFactory.createComponent(name, ModuleScopeInitDestroyComponent.class, + Scope.MODULE); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ComponentType type = introspector.introspect(ModuleScopeInitDestroyComponent.class); + component.getImplementation().setComponentType(type); + builder.build(component); + return (ContextFactory) component.getContextFactory(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicRequestScopeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicRequestScopeTestCase.java new file mode 100644 index 0000000000..e53b9fc9ac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicRequestScopeTestCase.java @@ -0,0 +1,158 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.RequestScopeComponent; +import org.apache.tuscany.container.java.mock.components.RequestScopeComponentImpl; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.RequestScopeContext; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.AtomicComponent; + +/** + * Unit tests for the request scope container + * + * @version $Rev$ $Date$ + */ +public class BasicRequestScopeTestCase extends TestCase { + + /** + * Tests instance identity is properly maintained + */ + public void testInstanceManagement() throws Exception { + EventContext ctx = new EventContextImpl(); + RequestScopeContext scope = new RequestScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + + // first request + RequestScopeComponentImpl comp1 = (RequestScopeComponentImpl) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + Object id = new Object(); + scope.onEvent(new RequestEnd(this,id)); + + // second request + RequestScopeComponentImpl comp2 = (RequestScopeComponentImpl) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp2); + Assert.assertNotSame(comp1, comp2); + Object id2 = new Object(); + scope.onEvent(new RequestEnd(this,id2)); + + scope.stop(); + } + + public void testRegisterContextBeforeRequest() throws Exception { + EventContext ctx = new EventContextImpl(); + RequestScopeContext scope = new RequestScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.registerFactory(createConfiguration("NewTestService")); + scope.start(); + RequestScopeComponent comp1 = (RequestScopeComponent) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + RequestScopeComponent comp2 = (RequestScopeComponent) scope.getContext("NewTestService").getInstance(null); + Assert.assertNotNull(comp2); + Object id = new Object(); + scope.onEvent(new RequestEnd(this,id)); + scope.stop(); + } + + public void testRegisterContextAfterRequest() throws Exception { + EventContext ctx = new EventContextImpl(); + RequestScopeContext scope = new RequestScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + RequestScopeComponent comp1 = (RequestScopeComponent) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + scope.registerFactory(createConfiguration("NewTestService")); + RequestScopeComponent comp2 = (RequestScopeComponent) scope.getContext("NewTestService").getInstance(null); + Assert.assertNotNull(comp2); + Object id = new Object(); + scope.onEvent(new RequestEnd(this,id)); + scope.stop(); + } + + /** + * Tests setting no components in the scope + */ + public void testSetNullComponents() throws Exception { + EventContext ctx = new EventContextImpl(); + RequestScopeContext scope = new RequestScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + scope.stop(); + } + + public void testGetComponentByKey() throws Exception { + EventContext ctx = new EventContextImpl(); + RequestScopeContext scope = new RequestScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + + RequestScopeComponentImpl comp1 = (RequestScopeComponentImpl) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + Object id = new Object(); + scope.onEvent(new RequestEnd(this,id)); + + // second request + // should be null since the other context (thread) expired w/ onEvent(..) + Assert.assertNull(scope.getContextByKey("TestService1", Thread.currentThread())); + // Note should test better using concurrent threads to pull the instance + + scope.stop(); + } + + + private List> createConfigurations() throws BuilderException, ConfigurationLoadException { + AtomicComponent component = MockFactory.createComponent("TestService1", RequestScopeComponentImpl.class, + Scope.REQUEST); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); + JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); + builder.build(component); + List> configs = new ArrayList>(); + configs.add((ContextFactory) component.getContextFactory()); + return configs; + } + + private ContextFactory createConfiguration(String name) throws BuilderException, ConfigurationLoadException { + AtomicComponent component = MockFactory.createComponent(name, RequestScopeComponentImpl.class, + Scope.REQUEST); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); + JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); + builder.build(component); + return (ContextFactory) component.getContextFactory(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicSessionScopeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicSessionScopeTestCase.java new file mode 100644 index 0000000000..8bee9a9741 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicSessionScopeTestCase.java @@ -0,0 +1,238 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.SessionScopeComponent; +import org.apache.tuscany.container.java.mock.components.SessionScopeComponentImpl; +import org.apache.tuscany.container.java.mock.components.SessionScopeInitDestroyComponent; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.event.HttpSessionEnd; +import org.apache.tuscany.core.context.event.HttpSessionEvent; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.SessionScopeContext; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.model.assembly.AtomicComponent; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Unit tests for the Http session scope container + * + * @version $Rev$ $Date$ + */ +public class BasicSessionScopeTestCase extends TestCase { + + /** + * Tests instance identity is properly maintained + */ + public void testInstanceManagement() throws Exception { + EventContext ctx = new EventContextImpl(); + SessionScopeContext scope = new SessionScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + Object session = new Object(); + Object session2 = new Object(); + // first request + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); + SessionScopeComponent comp1 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + // second request + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); + SessionScopeComponent comp2 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp2); + Assert.assertSame(comp1, comp2); + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + // third request, different session + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2); + SessionScopeComponent comp3 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp3); + Assert.assertNotSame(comp1, comp3); // should be different instances + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + scope.onEvent(new HttpSessionEnd(this, session)); + scope.onEvent(new HttpSessionEnd(this, session2)); + scope.stop(); + } + + /** + * Tests setting no components in the scope + */ + public void testSetNullComponents() throws Exception { + EventContext ctx = new EventContextImpl(); + SessionScopeContext scope = new SessionScopeContext(ctx); + scope.registerFactories(new ArrayList>()); + scope.start(); + scope.stop(); + } + + public void testGetContextByKey() throws Exception { + EventContext ctx = new EventContextImpl(); + SessionScopeContext scope = new SessionScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + Object session = new Object(); + Object session2 = new Object(); + + // first request + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); + SessionScopeComponent comp1 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + // second request, different session + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2); + SessionScopeComponent comp2 = (SessionScopeComponent) scope.getContextByKey("TestService1", session) + .getInstance(null); + SessionScopeComponent comp3 = (SessionScopeComponent) scope.getContextByKey("TestService1", session) + .getInstance(null); + Assert.assertNotNull(comp2); + Object id = new Object(); + scope.onEvent(new RequestEnd(this, id)); + Assert.assertSame(comp1, comp2); // should be same instances + Assert.assertSame(comp2, comp3); // should not be same instances + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + // shutdown sessions + scope.onEvent(new HttpSessionEnd(this, session)); + scope.onEvent(new HttpSessionEnd(this, session2)); + + scope.stop(); + } + + public void testRegisterContextBeforeSession() throws Exception { + EventContext ctx = new EventContextImpl(); + SessionScopeContext scope = new SessionScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + Object session = new Object(); + scope.registerFactory(createConfiguration("NewTestService")); + + // first request + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); + + SessionScopeInitDestroyComponent comp2 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService") + .getInstance(null); + Assert.assertNotNull(comp2); + Assert.assertTrue(comp2.isInitialized()); + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + // second request different session + Object session2 = new Object(); + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2); + SessionScopeInitDestroyComponent comp3 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService") + .getInstance(null); + Assert.assertNotNull(comp3); + Assert.assertNotSame(comp2, comp3); + Assert.assertTrue(comp3.isInitialized()); + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + scope.onEvent(new HttpSessionEnd(this, session)); + Assert.assertTrue(comp2.isDestroyed()); + + scope.onEvent(new HttpSessionEnd(this, session2)); + Assert.assertTrue(comp3.isDestroyed()); + scope.stop(); + } + + /** + * Tests runtime context registration + */ + public void testRegisterContextAfterSession() throws Exception { + EventContext ctx = new EventContextImpl(); + SessionScopeContext scope = new SessionScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + Object session = new Object(); + + // first request + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); + SessionScopeComponent comp1 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + scope.registerFactory(createConfiguration("NewTestService")); + + // second request + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session); + SessionScopeInitDestroyComponent comp2 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService") + .getInstance(null); + Assert.assertNotNull(comp2); + Assert.assertTrue(comp2.isInitialized()); + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + // third request different session + Object session2 = new Object(); + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2); + SessionScopeInitDestroyComponent comp3 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService") + .getInstance(null); + Assert.assertNotNull(comp3); + Assert.assertNotSame(comp2, comp3); + Assert.assertTrue(comp3.isInitialized()); + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + scope.onEvent(new HttpSessionEnd(this, session)); + Assert.assertTrue(comp2.isDestroyed()); + + scope.onEvent(new HttpSessionEnd(this, session2)); + Assert.assertTrue(comp3.isDestroyed()); + scope.stop(); + } + + private List> createConfigurations() throws BuilderException, ConfigurationLoadException { + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); + JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); + AtomicComponent component = MockFactory.createComponent("TestService1", SessionScopeComponentImpl.class, Scope.SESSION); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ComponentType type = introspector.introspect(SessionScopeComponentImpl.class); + component.getImplementation().setComponentType(type); + builder.build(component); + List> configs = new ArrayList>(); + configs.add((ContextFactory) component.getContextFactory()); + return configs; + } + + private ContextFactory createConfiguration(String name) throws BuilderException, ConfigurationLoadException { + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); + JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); + AtomicComponent component = MockFactory.createComponent(name, SessionScopeInitDestroyComponent.class, Scope.SESSION); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ComponentType type = introspector.introspect(SessionScopeInitDestroyComponent.class); + component.getImplementation().setComponentType(type); + builder.build(component); + return (ContextFactory) component.getContextFactory(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicStatelessScopeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicStatelessScopeTestCase.java new file mode 100644 index 0000000000..3765c8bf27 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/BasicStatelessScopeTestCase.java @@ -0,0 +1,129 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.StatelessComponent; +import org.apache.tuscany.container.java.mock.components.StatelessComponentImpl; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.StatelessScopeContext; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.AtomicComponent; + +/** + * Unit tests for the module scope container + * + * @version $Rev$ $Date$ + */ +public class BasicStatelessScopeTestCase extends TestCase { + + /** + * Tests instance identity is properly maintained + */ + public void testInstanceManagement() throws Exception { + EventContext ctx = new EventContextImpl(); + StatelessScopeContext scope = new StatelessScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + // first request + StatelessComponentImpl comp1 = (StatelessComponentImpl) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + // second request + StatelessComponentImpl comp2 = (StatelessComponentImpl) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp2); + Assert.assertNotSame(comp1, comp2); + scope.stop(); + } + + public void testRegisterContextBeforeRequest() throws Exception { + EventContext ctx = new EventContextImpl(); + StatelessScopeContext scope = new StatelessScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.registerFactory(createConfiguration("NewTestService")); + scope.start(); + StatelessComponent comp1 = (StatelessComponent) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + StatelessComponent comp2 = (StatelessComponent) scope.getContext("NewTestService").getInstance(null); + Assert.assertNotNull(comp2); + scope.stop(); + } + + public void testRegisterContextAfterRequest() throws Exception { + EventContext ctx = new EventContextImpl(); + StatelessScopeContext scope = new StatelessScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + StatelessComponent comp1 = (StatelessComponent) scope.getContext("TestService1").getInstance(null); + Assert.assertNotNull(comp1); + scope.registerFactory(createConfiguration("NewTestService")); + StatelessComponent comp2 = (StatelessComponent) scope.getContext("NewTestService").getInstance(null); + Assert.assertNotNull(comp2); + scope.stop(); + } + + + /** + * Tests setting no components in the scope + */ + public void testSetNullComponents() throws Exception { + EventContext ctx = new EventContextImpl(); + StatelessScopeContext scope = new StatelessScopeContext(ctx); + scope.registerFactories(createConfigurations()); + scope.start(); + scope.stop(); + } + + private List> createConfigurations() + throws NoSuchMethodException, BuilderException, ConfigurationLoadException { + AtomicComponent component = MockFactory.createComponent("TestService1", StatelessComponentImpl.class, + Scope.INSTANCE); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); + JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); + builder.build(component); + List> configs = new ArrayList(); + configs.add((ContextFactory) component.getContextFactory()); + return configs; + } + + private ContextFactory createConfiguration(String name) + throws NoSuchMethodException, BuilderException, ConfigurationLoadException { + AtomicComponent component = MockFactory.createComponent(name, StatelessComponentImpl.class, + Scope.INSTANCE); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(),new DefaultPolicyBuilderRegistry()); + JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); + builder.build(component); + return (ContextFactory) component.getContextFactory(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java new file mode 100644 index 0000000000..d5b5a29e9c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/CompositeScopeTestCase.java @@ -0,0 +1,188 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.GenericComponent; +import org.apache.tuscany.container.java.mock.components.ModuleScopeComponentImpl; +import org.apache.tuscany.container.java.mock.components.SessionScopeComponentImpl; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.RequestStart; +import org.apache.tuscany.core.context.event.HttpSessionBound; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.event.HttpSessionEnd; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.CompositeScopeContext; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.Extensible; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.AtomicComponent; + +/** + * Tests component nesting. This test needs to be in the container.java progject since it relies on Java POJOs for scope + * testing. + * + * @version $Rev$ $Date$ + */ +public class CompositeScopeTestCase extends TestCase { + + /** + * Ensures scope events are propagated in an composite scope + */ + public void testCompositeScopePropagation() throws Exception { + EventContext ctx = new EventContextImpl(); + CompositeContext moduleComponentCtx = new CompositeContextImpl(); + moduleComponentCtx.setName("testMC"); + moduleComponentCtx.start(); + CompositeScopeContext scopeContainer = new CompositeScopeContext(ctx); + scopeContainer.registerFactory(MockFactory.createCompositeConfiguration("CompositeComponent")); + scopeContainer.start(); + CompositeContext child = (CompositeContext) scopeContainer.getContext("CompositeComponent"); + List models = createAssembly(); + for (Extensible model : models) { + child.registerModelObject(model); + } + + scopeContainer.onEvent(new ModuleStart(this)); + Object session = new Object(); + Object id = new Object(); + //ctx.setIdentifier(EventContext.SESSION,session); + scopeContainer.onEvent(new RequestStart(this,id)); + scopeContainer.onEvent(new HttpSessionBound(this,session)); + CompositeContext componentCtx = (CompositeContext) scopeContainer.getContext("CompositeComponent"); + GenericComponent testService1 = (GenericComponent) componentCtx.getContext("TestService1").getInstance(null); + GenericComponent testService2 = (GenericComponent) componentCtx.getContext("TestService2").getInstance(null); + GenericComponent testService3 = (GenericComponent) componentCtx.getContext("TestService3").getInstance(null); + Assert.assertNotNull(testService1); + Assert.assertNotNull(testService2); + Assert.assertNotNull(testService3); + scopeContainer.onEvent(new RequestEnd(this,id)); + scopeContainer.onEvent(new RequestStart(this,id)); + scopeContainer.onEvent(new HttpSessionBound(this,session)); + + GenericComponent testService2a = (GenericComponent) componentCtx.getContext("TestService2").getInstance(null); + Assert.assertNotNull(testService2a); + GenericComponent testService3a = (GenericComponent) componentCtx.getContext("TestService3").getInstance(null); + Assert.assertNotNull(testService3a); + Assert.assertEquals(testService2, testService2a); + Assert.assertNotSame(testService3, testService3a); + scopeContainer.onEvent(new RequestEnd(this,id)); + scopeContainer.onEvent(new HttpSessionEnd(this,session)); + + Object session2 = new Object(); + Object id2 = new Object(); + scopeContainer.onEvent(new RequestStart(this,id2)); + scopeContainer.onEvent(new HttpSessionBound(this,session2)); + GenericComponent testService2b = (GenericComponent) componentCtx.getContext("TestService2").getInstance(null); + Assert.assertNotNull(testService2b); + Assert.assertNotSame(testService2, testService2b); + + scopeContainer.onEvent(new RequestEnd(this,id2)); + scopeContainer.onEvent(new HttpSessionEnd(this,session2)); + + } + + /** + * Ensures only child entry points (and not components) are accessible from parents + */ + public void testCompositeNoEntryPoint() throws Exception { + EventContext ctx = new EventContextImpl(); + CompositeContext moduleComponentCtx = new CompositeContextImpl(); + moduleComponentCtx.setName("testMC"); + CompositeScopeContext scopeContainer = new CompositeScopeContext(ctx); + scopeContainer.registerFactory(MockFactory.createCompositeConfiguration("CompositeComponent")); + scopeContainer.start(); + CompositeContext child = (CompositeContext) scopeContainer.getContext("CompositeComponent"); + List parts = createAssembly(); + for (Extensible part : parts) { + child.registerModelObject(part); + } + scopeContainer.onEvent(new ModuleStart(this)); + scopeContainer.getContext("CompositeComponent"); + } + + /** + * Tests adding a context before its parent has been started + */ + public void testRegisterContextBeforeStart() throws Exception { + EventContext ctx = new EventContextImpl(); + CompositeContext moduleComponentCtx = new CompositeContextImpl(); + moduleComponentCtx.setName("testMC"); + CompositeScopeContext scopeContainer = new CompositeScopeContext(ctx); + scopeContainer.registerFactory(MockFactory.createCompositeConfiguration("CompositeComponent")); + scopeContainer.start(); + scopeContainer.onEvent(new ModuleStart(this)); + scopeContainer.getContext("CompositeComponent"); + scopeContainer.onEvent(new ModuleStop(this)); + scopeContainer.stop(); + } + + /** + * Tests adding a context after its parent has been started + */ + public void testRegisterContextAfterStart() throws Exception { + EventContext ctx = new EventContextImpl(); + CompositeContext moduleComponentCtx = new CompositeContextImpl(); + moduleComponentCtx.setName("testMC"); + CompositeScopeContext scopeContainer = new CompositeScopeContext(ctx); + scopeContainer.start(); + + scopeContainer.onEvent(new ModuleStart(this)); + scopeContainer.registerFactory(MockFactory.createCompositeConfiguration("CompositeComponent")); + scopeContainer.getContext("CompositeComponent"); + scopeContainer.onEvent(new ModuleStop(this)); + scopeContainer.stop(); + } + + /** + * Creats an assembly containing a module-scoped component definition, a session-scoped component definition, and a + * request-scoped component definition + * + */ + private List createAssembly() throws BuilderException, ConfigurationLoadException { + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); + JavaContextFactoryBuilder builder = new JavaContextFactoryBuilder(wireService); + AtomicComponent component = MockFactory.createComponent("TestService1", ModuleScopeComponentImpl.class, Scope.MODULE); + AtomicComponent sessionComponent = MockFactory.createComponent("TestService2", SessionScopeComponentImpl.class, + Scope.SESSION); + AtomicComponent requestComponent = MockFactory.createComponent("TestService3", SessionScopeComponentImpl.class, + Scope.REQUEST); + builder.build(component); + builder.build(sessionComponent); + builder.build(requestComponent); + List configs = new ArrayList(); + configs.add(component); + configs.add(sessionComponent); + configs.add(requestComponent); + return configs; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/DependencyLifecycleTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/DependencyLifecycleTestCase.java new file mode 100644 index 0000000000..dc3fe3efcb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/DependencyLifecycleTestCase.java @@ -0,0 +1,93 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import junit.framework.TestCase; +import org.apache.tuscany.container.java.mock.MockContextFactory; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.event.HttpSessionBound; +import org.apache.tuscany.core.context.event.HttpSessionEvent; +import org.apache.tuscany.core.context.event.HttpSessionEnd; +import org.apache.tuscany.core.context.event.RequestStart; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.ModuleScopeContext; +import org.apache.tuscany.core.context.scope.SessionScopeContext; +import org.apache.tuscany.core.context.scope.RequestScopeContext; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Tests that dependencies are initalized and destroyed in the proper order (i.e. LIFO) + * + * @version $Rev: 393992 $ $Date: 2006-04-13 18:01:05 -0700 (Thu, 13 Apr 2006) $ + */ +public class DependencyLifecycleTestCase extends TestCase { + + + + public void testInitDestroyOrderModuleScope() throws Exception { + EventContext ctx = new EventContextImpl(); + ModuleScopeContext scope = new ModuleScopeContext(ctx); + scope.registerFactories(MockContextFactory.createWiredContexts(Scope.MODULE,scope)); + scope.start(); + scope.onEvent(new ModuleStart(this)); + OrderedDependentPojo source = (OrderedDependentPojo) scope.getContext("source").getInstance(null); + assertNotNull(source.getPojo()); + // expire module + assertEquals(2,source.getNumberInstantiated()); + scope.onEvent(new ModuleStop(this)); + assertEquals(0,source.getNumberInstantiated()); + scope.stop(); + } + + public void testInitDestroyOrderSessionScope() throws Exception { + EventContext ctx = new EventContextImpl(); + SessionScopeContext scope = new SessionScopeContext(ctx); + scope.registerFactories(MockContextFactory.createWiredContexts(Scope.SESSION,scope)); + scope.start(); + Object session = new Object(); + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER,session); + scope.onEvent(new HttpSessionBound(this,session)); + OrderedDependentPojo source = (OrderedDependentPojo) scope.getContext("source").getInstance(null); + assertNotNull(source.getPojo()); + // expire module + assertEquals(2,source.getNumberInstantiated()); + scope.onEvent(new HttpSessionEnd(this,session)); + assertEquals(0,source.getNumberInstantiated()); + scope.stop(); + } + + + public void testInitDestroyOrderRequestScope() throws Exception { + EventContext ctx = new EventContextImpl(); + RequestScopeContext scope = new RequestScopeContext(ctx); + scope.registerFactories(MockContextFactory.createWiredContexts(Scope.REQUEST,scope)); + scope.start(); + Object request = new Object(); + scope.onEvent(new RequestStart(this,request)); + OrderedDependentPojo source = (OrderedDependentPojo) scope.getContext("source").getInstance(null); + assertNotNull(source.getPojo()); + // expire module + assertEquals(2,source.getNumberInstantiated()); + scope.onEvent(new RequestEnd(this,request)); + assertEquals(0,source.getNumberInstantiated()); + scope.stop(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/ModuleScopeLifecycleTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/ModuleScopeLifecycleTestCase.java new file mode 100644 index 0000000000..904e218c08 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/ModuleScopeLifecycleTestCase.java @@ -0,0 +1,248 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.ModuleScopeDestroyOnlyComponent; +import org.apache.tuscany.container.java.mock.components.ModuleScopeEagerInitComponent; +import org.apache.tuscany.container.java.mock.components.ModuleScopeEagerInitDestroyComponent; +import org.apache.tuscany.container.java.mock.components.ModuleScopeInitDestroyComponent; +import org.apache.tuscany.container.java.mock.components.ModuleScopeInitOnlyComponent; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.ModuleScopeContext; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.model.assembly.AtomicComponent; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Lifecycle unit tests for the module scope container + * + * @version $Rev$ $Date$ + */ +public class ModuleScopeLifecycleTestCase extends TestCase { + + JavaContextFactoryBuilder builder; + + public void testInitDestroy() throws Exception { + EventContext ctx = new EventContextImpl(); + ModuleScopeContext scope = new ModuleScopeContext(ctx); + scope.registerFactories(createComponents()); + scope.start(); + scope.onEvent(new ModuleStart(this)); + ModuleScopeInitDestroyComponent initDestroy = (ModuleScopeInitDestroyComponent) scope.getContext( + "TestServiceInitDestroy").getInstance(null); + Assert.assertNotNull(initDestroy); + ModuleScopeInitOnlyComponent initOnly = (ModuleScopeInitOnlyComponent) scope.getContext("TestServiceInitOnly") + .getInstance(null); + Assert.assertNotNull(initOnly); + ModuleScopeDestroyOnlyComponent destroyOnly = (ModuleScopeDestroyOnlyComponent) scope.getContext( + "TestServiceDestroyOnly").getInstance(null); + Assert.assertNotNull(destroyOnly); + + Assert.assertTrue(initDestroy.isInitialized()); + Assert.assertTrue(initOnly.isInitialized()); + Assert.assertFalse(initDestroy.isDestroyed()); + Assert.assertFalse(destroyOnly.isDestroyed()); + + // expire module + scope.onEvent(new ModuleStop(this)); + + Assert.assertTrue(initDestroy.isDestroyed()); + Assert.assertTrue(destroyOnly.isDestroyed()); + + scope.stop(); + } + + public void testEagerInit() throws Exception { + EventContext ctx = new EventContextImpl(); + ModuleScopeContext scope = new ModuleScopeContext(ctx); + scope.registerFactories(createEagerInitComponents()); + scope.start(); + scope.onEvent(new ModuleStart(this)); + ModuleScopeEagerInitDestroyComponent initDestroy = (ModuleScopeEagerInitDestroyComponent) scope.getContext( + "TestServiceEagerInitDestroy").getInstance(null); + Assert.assertNotNull(initDestroy); + ModuleScopeEagerInitComponent initOnly = (ModuleScopeEagerInitComponent) scope + .getContext("TestServiceEagerInit").getInstance(null); + Assert.assertNotNull(initOnly); + + Assert.assertTrue(initDestroy.isInitialized()); + Assert.assertTrue(initOnly.isInitialized()); + Assert.assertFalse(initDestroy.isDestroyed()); + + // expire module + scope.onEvent(new ModuleStop(this)); + + Assert.assertTrue(initDestroy.isDestroyed()); + + scope.stop(); + + } + + public void testDestroyOrder() throws Exception { + EventContext ctx = new EventContextImpl(); + ModuleScopeContext scope = new ModuleScopeContext(ctx); + scope.registerFactories(createOrderedInitComponents()); + scope.start(); + scope.onEvent(new ModuleStart(this)); + OrderedInitPojo one = (OrderedInitPojo) scope.getContext("one").getInstance(null); + Assert.assertNotNull(one); + Assert.assertEquals(1, one.getNumberInstantiated()); + Assert.assertEquals(1, one.getInitOrder()); + + OrderedInitPojo two = (OrderedInitPojo) scope.getContext("two").getInstance(null); + Assert.assertNotNull(two); + Assert.assertEquals(2, two.getNumberInstantiated()); + Assert.assertEquals(2, two.getInitOrder()); + + OrderedInitPojo three = (OrderedInitPojo) scope.getContext("three").getInstance(null); + Assert.assertNotNull(three); + Assert.assertEquals(3, three.getNumberInstantiated()); + Assert.assertEquals(3, three.getInitOrder()); + + // expire module + scope.onEvent(new ModuleStop(this)); + Assert.assertEquals(0, one.getNumberInstantiated()); + scope.stop(); + } + + public void testEagerInitDestroyOrder() throws Exception { + EventContext ctx = new EventContextImpl(); + ModuleScopeContext scope = new ModuleScopeContext(ctx); + scope.registerFactories(createOrderedEagerInitComponents()); + scope.start(); + scope.onEvent(new ModuleStart(this)); + OrderedEagerInitPojo one = (OrderedEagerInitPojo) scope.getContext("one").getInstance(null); + Assert.assertNotNull(one); + + OrderedEagerInitPojo two = (OrderedEagerInitPojo) scope.getContext("two").getInstance(null); + Assert.assertNotNull(two); + + OrderedEagerInitPojo three = (OrderedEagerInitPojo) scope.getContext("three").getInstance(null); + Assert.assertNotNull(three); + + // expire module + scope.onEvent(new ModuleStop(this)); + Assert.assertEquals(0, one.getNumberInstantiated()); + scope.stop(); + } + + + private List> createComponents() throws BuilderException, ConfigurationLoadException { + AtomicComponent[] ca = new AtomicComponent[3]; + ca[0] = MockFactory.createComponent("TestServiceInitDestroy", ModuleScopeInitDestroyComponent.class, + Scope.MODULE); + ca[1] = MockFactory.createComponent("TestServiceInitOnly", ModuleScopeInitOnlyComponent.class, + Scope.MODULE); + ca[2] = MockFactory.createComponent("TestServiceDestroyOnly", ModuleScopeDestroyOnlyComponent.class, + Scope.MODULE); + List> configs = new ArrayList>(); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ca[0].getImplementation().setComponentType(introspector.introspect(ModuleScopeInitDestroyComponent.class)); + ca[1].getImplementation().setComponentType(introspector.introspect(ModuleScopeInitOnlyComponent.class)); + ca[2].getImplementation().setComponentType(introspector.introspect(ModuleScopeDestroyOnlyComponent.class)); + for (AtomicComponent aCa : ca) { + builder.build(aCa); + configs.add((ContextFactory) aCa.getContextFactory()); + + } + return configs; + } + + private List> createEagerInitComponents() throws + BuilderException, ConfigurationLoadException { + AtomicComponent[] ca = new AtomicComponent[2]; + ca[0] = MockFactory.createComponent("TestServiceEagerInitDestroy", ModuleScopeEagerInitDestroyComponent.class, + Scope.MODULE); + ca[1] = MockFactory.createComponent("TestServiceEagerInit", ModuleScopeEagerInitComponent.class, + Scope.MODULE); + List> configs = new ArrayList>(); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ComponentType type = introspector.introspect(OrderedInitPojo.class); + ca[0].getImplementation().setComponentType(introspector.introspect(ModuleScopeEagerInitDestroyComponent.class)); + ca[1].getImplementation().setComponentType(introspector.introspect(ModuleScopeEagerInitComponent.class)); + for (AtomicComponent aCa : ca) { + builder.build(aCa); + configs.add((ContextFactory) aCa.getContextFactory()); + } + return configs; + } + + private List> createOrderedInitComponents() throws + BuilderException, ConfigurationLoadException { + AtomicComponent[] ca = new AtomicComponent[3]; + ca[0] = MockFactory.createComponent("one", OrderedInitPojo.class, Scope.MODULE); + ca[1] = MockFactory.createComponent("two", OrderedInitPojo.class, Scope.MODULE); + ca[2] = MockFactory.createComponent("three", OrderedInitPojo.class, Scope.MODULE); + List> configs = new ArrayList>(); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ComponentType type = introspector.introspect(OrderedInitPojo.class); + ca[0].getImplementation().setComponentType(type); + ca[1].getImplementation().setComponentType(type); + ca[2].getImplementation().setComponentType(type); + for (AtomicComponent aCa : ca) { + builder.build(aCa); + configs.add((ContextFactory) aCa.getContextFactory()); + } + return configs; + } + + private List> createOrderedEagerInitComponents() throws + BuilderException, ConfigurationLoadException { + AtomicComponent[] ca = new AtomicComponent[3]; + ca[0] = MockFactory.createComponent("one", OrderedEagerInitPojo.class, Scope.MODULE); + ca[1] = MockFactory.createComponent("two", OrderedEagerInitPojo.class, Scope.MODULE); + ca[2] = MockFactory.createComponent("three", OrderedEagerInitPojo.class, Scope.MODULE); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ComponentType type = introspector.introspect(OrderedEagerInitPojo.class); + ca[0].getImplementation().setComponentType(type); + ca[1].getImplementation().setComponentType(type); + ca[2].getImplementation().setComponentType(type); + List> configs = new ArrayList>(); + for (AtomicComponent aCa : ca) { + builder.build(aCa); + configs.add((ContextFactory) aCa.getContextFactory()); + + } + return configs; + } + + protected void setUp() throws Exception { + super.setUp(); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); + builder = new JavaContextFactoryBuilder(wireService); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderException.java new file mode 100644 index 0000000000..fc5f7c8c58 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderException.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +public class OrderException extends Exception { + + public OrderException() { + super(); + } + + public OrderException(String message) { + super(message); + } + + public OrderException(String message, Throwable cause) { + super(message, cause); + } + + public OrderException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedDependentPojo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedDependentPojo.java new file mode 100644 index 0000000000..f8fe2af7be --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedDependentPojo.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class OrderedDependentPojo extends OrderedInitPojo { + + private OrderedDependentPojo pojo; + + public OrderedDependentPojo getPojo() { + return pojo; + } + + public void setPojo(OrderedDependentPojo pojo) { + this.pojo = pojo; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedEagerInitPojo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedEagerInitPojo.java new file mode 100644 index 0000000000..f9aeefccbe --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedEagerInitPojo.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +@Scope("MODULE") +public class OrderedEagerInitPojo { + + private static Object lock = new Object(); + private static int numberInstantied; + private int initOrder; + + @Init(eager = true) + public void init() { + synchronized (lock) { + ++numberInstantied; + initOrder = numberInstantied; + } + } + + @Destroy + public void destroy() throws OrderException { + synchronized (lock) { + if (initOrder != numberInstantied) { + throw new OrderException("Instance shutdown done out of order"); + } + --numberInstantied; + } + } + + public int getNumberInstantiated() { + return numberInstantied; + } + + public int getInitOrder() { + return initOrder; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedInitPojo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedInitPojo.java new file mode 100644 index 0000000000..b4d4eb03ba --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/OrderedInitPojo.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +@Scope("MODULE") +public class OrderedInitPojo { + + private static Object lock = new Object(); + private static int numberInstantied; + private int initOrder; + + @Init + public void init() { + synchronized (lock) { + ++numberInstantied; + initOrder = numberInstantied; + } + } + + @Destroy + public void destroy() throws OrderException { + synchronized (lock) { + if (initOrder != numberInstantied) { + throw new OrderException("Instance shutdown done out of order"); + } + --numberInstantied; + } + } + + public int getNumberInstantiated() { + return numberInstantied; + } + + public int getInitOrder() { + return initOrder; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopeLifecycleTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopeLifecycleTestCase.java new file mode 100644 index 0000000000..bca1e57cbc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopeLifecycleTestCase.java @@ -0,0 +1,166 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.RequestScopeDestroyOnlyComponent; +import org.apache.tuscany.container.java.mock.components.RequestScopeInitDestroyComponent; +import org.apache.tuscany.container.java.mock.components.RequestScopeInitOnlyComponent; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.RequestScopeContext; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.model.assembly.AtomicComponent; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Lifecycle unit tests for the Http session scope container + * + * @version $Rev$ $Date$ + */ +public class RequestScopeLifecycleTestCase extends TestCase { + + /** + * Tests instance identity is properly maintained + */ + public void testInitDestroy() throws Exception { + EventContext ctx = new EventContextImpl(); + RequestScopeContext scope = new RequestScopeContext(ctx); + scope.registerFactories(createComponents()); + scope.start(); + RequestScopeInitDestroyComponent initDestroy = (RequestScopeInitDestroyComponent) scope.getContext( + "TestServiceInitDestroy").getInstance(null); + Assert.assertNotNull(initDestroy); + RequestScopeInitOnlyComponent initOnly = (RequestScopeInitOnlyComponent) scope.getContext("TestServiceInitOnly") + .getInstance(null); + Assert.assertNotNull(initOnly); + RequestScopeDestroyOnlyComponent destroyOnly = (RequestScopeDestroyOnlyComponent) scope.getContext( + "TestServiceDestroyOnly").getInstance(null); + Assert.assertNotNull(destroyOnly); + + Assert.assertTrue(initDestroy.isInitialized()); + Assert.assertTrue(initOnly.isInitialized()); + Assert.assertFalse(initDestroy.isDestroyed()); + Assert.assertFalse(destroyOnly.isDestroyed()); + + // end request + scope.onEvent(new RequestEnd(this, new Object())); + Assert.assertTrue(initDestroy.isDestroyed()); + Assert.assertTrue(destroyOnly.isDestroyed()); + + scope.stop(); + } + + /** + * Test instances destroyed in proper (i.e. reverse) order + */ + public void testDestroyOrder() throws Exception { + EventContext ctx = new EventContextImpl(); + RequestScopeContext scope = new RequestScopeContext(ctx); + scope.registerFactories(createOrderedInitComponents()); + scope.start(); + // request start + RequestScopedOrderedInitPojo one = (RequestScopedOrderedInitPojo) scope.getContext("one").getInstance(null); + Assert.assertNotNull(one); + Assert.assertEquals(1, one.getNumberInstantiated()); + Assert.assertEquals(1, one.getInitOrder()); + + RequestScopedOrderedInitPojo two = (RequestScopedOrderedInitPojo) scope.getContext("two").getInstance(null); + Assert.assertNotNull(two); + Assert.assertEquals(2, two.getNumberInstantiated()); + Assert.assertEquals(2, two.getInitOrder()); + + RequestScopedOrderedInitPojo three = (RequestScopedOrderedInitPojo) scope.getContext("three").getInstance(null); + Assert.assertNotNull(three); + Assert.assertEquals(3, three.getNumberInstantiated()); + Assert.assertEquals(3, three.getInitOrder()); + + // end request + scope.onEvent(new RequestEnd(this, new Object())); + + Assert.assertEquals(0, one.getNumberInstantiated()); + scope.stop(); + } + + + JavaContextFactoryBuilder builder; + + private List> createComponents() throws BuilderException, ConfigurationLoadException { + AtomicComponent[] ca = new AtomicComponent[3]; + ca[0] = MockFactory.createComponent("TestServiceInitDestroy", RequestScopeInitDestroyComponent.class, + Scope.REQUEST); + ca[1] = MockFactory.createComponent("TestServiceInitOnly", RequestScopeInitOnlyComponent.class, + Scope.REQUEST); + ca[2] = MockFactory.createComponent("TestServiceDestroyOnly", RequestScopeDestroyOnlyComponent.class, + Scope.REQUEST); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ca[0].getImplementation().setComponentType(introspector.introspect(RequestScopeInitDestroyComponent.class)); + ca[1].getImplementation().setComponentType(introspector.introspect(RequestScopeInitOnlyComponent.class)); + ca[2].getImplementation().setComponentType(introspector.introspect(RequestScopeDestroyOnlyComponent.class)); + List> configs = new ArrayList>(); + for (AtomicComponent aCa : ca) { + builder.build(aCa); + configs.add((ContextFactory) aCa.getContextFactory()); + + } + return configs; + } + + private List> createOrderedInitComponents() throws + BuilderException, ConfigurationLoadException { + AtomicComponent[] ca = new AtomicComponent[3]; + ca[0] = MockFactory.createComponent("one", RequestScopedOrderedInitPojo.class, Scope.REQUEST); + ca[1] = MockFactory.createComponent("two", RequestScopedOrderedInitPojo.class, Scope.REQUEST); + ca[2] = MockFactory.createComponent("three", RequestScopedOrderedInitPojo.class, Scope.REQUEST); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ComponentType type = introspector.introspect(RequestScopedOrderedInitPojo.class); + ca[0].getImplementation().setComponentType(type); + ca[1].getImplementation().setComponentType(type); + ca[2].getImplementation().setComponentType(type); + List> configs = new ArrayList>(); + for (AtomicComponent aCa : ca) { + builder.build(aCa); + configs.add((ContextFactory) aCa.getContextFactory()); + + } + return configs; + } + + protected void setUp() throws Exception { + super.setUp(); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry()); + builder = new JavaContextFactoryBuilder(wireService); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopedOrderedInitPojo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopedOrderedInitPojo.java new file mode 100644 index 0000000000..717c7008c9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/RequestScopedOrderedInitPojo.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Destroy; + +@Scope("REQUEST") +public class RequestScopedOrderedInitPojo { + + private static Object lock = new Object(); + private static int numberInstantied; + private int initOrder; + + @Init + public void init() { + synchronized (RequestScopedOrderedInitPojo.lock) { + ++RequestScopedOrderedInitPojo.numberInstantied; + initOrder = RequestScopedOrderedInitPojo.numberInstantied; + } + } + + @Destroy + public void destroy() throws OrderException { + synchronized (RequestScopedOrderedInitPojo.lock) { + if (initOrder != RequestScopedOrderedInitPojo.numberInstantied) { + throw new OrderException("Instance shutdown done out of order"); + } + --RequestScopedOrderedInitPojo.numberInstantied; + } + } + + public int getNumberInstantiated() { + return RequestScopedOrderedInitPojo.numberInstantied; + } + + public int getInitOrder() { + return initOrder; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopeLifecycleTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopeLifecycleTestCase.java new file mode 100644 index 0000000000..80d8cb71cb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopeLifecycleTestCase.java @@ -0,0 +1,176 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.container.java.builder.JavaContextFactoryBuilder; +import org.apache.tuscany.container.java.mock.MockFactory; +import org.apache.tuscany.container.java.mock.components.SessionScopeDestroyOnlyComponent; +import org.apache.tuscany.container.java.mock.components.SessionScopeInitDestroyComponent; +import org.apache.tuscany.container.java.mock.components.SessionScopeInitOnlyComponent; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.system.DefaultPolicyBuilderRegistry; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.event.HttpSessionEnd; +import org.apache.tuscany.core.context.event.HttpSessionEvent; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.SessionScopeContext; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.core.wire.service.DefaultWireFactoryService; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.AtomicComponent; +import org.apache.tuscany.model.assembly.ComponentType; + +/** + * Lifecycle unit tests for the Http session scope container + * + * @version $Rev$ $Date$ + */ +public class SessionScopeLifecycleTestCase extends TestCase { + + /** + * Tests instance identity is properly maintained + */ + public void testInitDestroy() throws Exception { + EventContext ctx = new EventContextImpl(); + SessionScopeContext scope = new SessionScopeContext(ctx); + scope.registerFactories(createComponents()); + scope.start(); + Object session = new Object(); + // first request, no need to notify scope container since sessions are + // evaluated lazily + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER,session); + SessionScopeInitDestroyComponent initDestroy = (SessionScopeInitDestroyComponent) scope.getContext( + "TestServiceInitDestroy").getInstance(null); + Assert.assertNotNull(initDestroy); + SessionScopeInitOnlyComponent initOnly = (SessionScopeInitOnlyComponent) scope.getContext("TestServiceInitOnly") + .getInstance(null); + Assert.assertNotNull(initOnly); + SessionScopeDestroyOnlyComponent destroyOnly = (SessionScopeDestroyOnlyComponent) scope.getContext( + "TestServiceDestroyOnly").getInstance(null); + Assert.assertNotNull(destroyOnly); + + Assert.assertTrue(initDestroy.isInitialized()); + Assert.assertTrue(initOnly.isInitialized()); + Assert.assertFalse(initDestroy.isDestroyed()); + Assert.assertFalse(destroyOnly.isDestroyed()); + // end request + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + // expire session + scope.onEvent(new HttpSessionEnd(this,session)); + Assert.assertTrue(initDestroy.isDestroyed()); + Assert.assertTrue(destroyOnly.isDestroyed()); + + scope.stop(); + } + + /** + * Test instances destroyed in proper (i.e. reverse) order + */ + public void testDestroyOrder() throws Exception { + EventContext ctx = new EventContextImpl(); + SessionScopeContext scope = new SessionScopeContext(ctx); + scope.registerFactories(createOrderedInitComponents()); + scope.start(); + Object session = new Object(); + // request start + ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER,session); + + SessionScopedOrderedInitPojo one = (SessionScopedOrderedInitPojo) scope.getContext("one").getInstance(null); + Assert.assertNotNull(one); + Assert.assertEquals(1, one.getNumberInstantiated()); + Assert.assertEquals(1, one.getInitOrder()); + + SessionScopedOrderedInitPojo two = (SessionScopedOrderedInitPojo) scope.getContext("two").getInstance(null); + Assert.assertNotNull(two); + Assert.assertEquals(2, two.getNumberInstantiated()); + Assert.assertEquals(2, two.getInitOrder()); + + SessionScopedOrderedInitPojo three = (SessionScopedOrderedInitPojo) scope.getContext("three").getInstance(null); + Assert.assertNotNull(three); + Assert.assertEquals(3, three.getNumberInstantiated()); + Assert.assertEquals(3, three.getInitOrder()); + + // end request + ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + + // expire session + scope.onEvent(new HttpSessionEnd(this, session)); + Assert.assertEquals(0, one.getNumberInstantiated()); + scope.stop(); + } + + JavaContextFactoryBuilder builder; + + private List> createComponents() throws BuilderException, ConfigurationLoadException { + AtomicComponent[] ca = new AtomicComponent[3]; + ca[0] = MockFactory.createComponent("TestServiceInitDestroy", SessionScopeInitDestroyComponent.class, + Scope.SESSION); + ca[1] = MockFactory.createComponent("TestServiceInitOnly", SessionScopeInitOnlyComponent.class, Scope.SESSION); + ca[2] = MockFactory.createComponent("TestServiceDestroyOnly", SessionScopeDestroyOnlyComponent.class, + Scope.SESSION); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ca[0].getImplementation().setComponentType(introspector.introspect(SessionScopeInitDestroyComponent.class)); + ca[1].getImplementation().setComponentType(introspector.introspect(SessionScopeInitOnlyComponent.class)); + ca[2].getImplementation().setComponentType(introspector.introspect(SessionScopeDestroyOnlyComponent.class)); + List> configs = new ArrayList>(); + for (AtomicComponent aCa : ca) { + builder.build(aCa); + configs.add((ContextFactory) aCa.getContextFactory()); + + } + return configs; + } + + private List> createOrderedInitComponents() throws + BuilderException, ConfigurationLoadException { + AtomicComponent[] ca = new AtomicComponent[3]; + ca[0] = MockFactory.createComponent("one", SessionScopedOrderedInitPojo.class, Scope.SESSION); + ca[1] = MockFactory.createComponent("two", SessionScopedOrderedInitPojo.class, Scope.SESSION); + ca[2] = MockFactory.createComponent("three", SessionScopedOrderedInitPojo.class, Scope.SESSION); + ComponentTypeIntrospector introspector = MockFactory.getIntrospector(); + ComponentType type = introspector.introspect(SessionScopedOrderedInitPojo.class); + ca[0].getImplementation().setComponentType(type); + ca[1].getImplementation().setComponentType(type); + ca[2].getImplementation().setComponentType(type); + List> configs = new ArrayList>(); + for (AtomicComponent aCa : ca) { + builder.build(aCa); + configs.add((ContextFactory) aCa.getContextFactory()); + + } + return configs; + } + + protected void setUp() throws Exception { + super.setUp(); + WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(),new DefaultPolicyBuilderRegistry()); + builder = new JavaContextFactoryBuilder(wireService); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopedOrderedInitPojo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopedOrderedInitPojo.java new file mode 100644 index 0000000000..683247a5c8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/java/org/apache/tuscany/container/java/scopes/SessionScopedOrderedInitPojo.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.java.scopes; + +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Destroy; + +@Scope("SESSION") +public class SessionScopedOrderedInitPojo { + + private static Object lock = new Object(); + private static int numberInstantied; + private int initOrder; + + @Init + public void init() { + synchronized (SessionScopedOrderedInitPojo.lock) { + ++SessionScopedOrderedInitPojo.numberInstantied; + initOrder = SessionScopedOrderedInitPojo.numberInstantied; + } + } + + @Destroy + public void destroy() throws OrderException { + synchronized (SessionScopedOrderedInitPojo.lock) { + if (initOrder != SessionScopedOrderedInitPojo.numberInstantied) { + throw new OrderException("Instance shutdown done out of order"); + } + --SessionScopedOrderedInitPojo.numberInstantied; + } + } + + public int getNumberInstantiated() { + return SessionScopedOrderedInitPojo.numberInstantied; + } + + public int getInitOrder() { + return initOrder; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworld/example.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworld/example.wsdl new file mode 100644 index 0000000000..3a23e7b717 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworld/example.wsdl @@ -0,0 +1,23 @@ + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworld/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworld/sca.module new file mode 100644 index 0000000000..d5bc2cd5f9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworld/sca.module @@ -0,0 +1,32 @@ + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworldmc/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworldmc/sca.module new file mode 100644 index 0000000000..8c590976de --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/helloworldmc/sca.module @@ -0,0 +1,40 @@ + + + + + + + + + + + bar + en + + + + HelloWorld/greetingProvider + GreetingProvider + + + + + Hello + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/assembly/tests/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/assembly/tests/sca.module new file mode 100644 index 0000000000..d0f0856225 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/assembly/tests/sca.module @@ -0,0 +1,54 @@ + + + + + + + + AccountServiceComponent + + + + + + EURO + + + AccountDataServiceComponent + StockQuoteService + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/config/ModuleComponentLoaderTest1.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/config/ModuleComponentLoaderTest1.module new file mode 100644 index 0000000000..46169aa304 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.java/src/test/resources/org/apache/tuscany/container/java/config/ModuleComponentLoaderTest1.module @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/pom.xml new file mode 100644 index 0000000000..3f8d8fe9cd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/pom.xml @@ -0,0 +1,68 @@ + + + + + + org.apache.tuscany.sca.containers + tuscany-sca-containers + incubating-M1 + + + 4.0.0 + tuscany-container-rhino + Tuscany Rhino JavaScript Container + Tuscany Rhino JavaScript Container + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + compile + + + + rhino + js + 1.6R2 + compile + + + + org.apache.tuscany.databinding + tuscany-databinding-sdo + ${pom.version} + compile + + + + xmlbeans + xbean + 2.1.0 + compile + + + + junit + junit + 3.8.1 + test + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java new file mode 100644 index 0000000000..c68bf239a3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/assembly/JavaScriptImplementation.java @@ -0,0 +1,74 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.assembly; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.model.assembly.impl.AtomicImplementationImpl; + +import commonj.sdo.helper.TypeHelper; + +/** + * Default implementation of a JavScript component implementation type + * + * @version $Rev$ $Date$ + */ +public class JavaScriptImplementation extends AtomicImplementationImpl { + + private String scriptFile; + + private String script; + + private ResourceLoader resourceLoader; + + private TypeHelper typeHelper; + + public JavaScriptImplementation() { + super(); + } + + public void setResourceLoader(ResourceLoader resourceLoader) { + this.resourceLoader = resourceLoader; + } + + public ResourceLoader getResourceLoader() { + return resourceLoader; + } + + public TypeHelper getTypeHelper() { + return typeHelper; + } + + public void setTypeHelper(TypeHelper typeHelper) { + this.typeHelper = typeHelper; + } + + public String getScriptFile() { + return scriptFile; + } + + public void setScriptFile(String fn) { + scriptFile = fn; + } + + public String getScript() { + return script; + } + + public void setScript(String script) { + this.script = script; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java new file mode 100644 index 0000000000..2012971014 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptContextFactoryBuilder.java @@ -0,0 +1,132 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.builder; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Input; +import javax.wsdl.Message; +import javax.wsdl.Operation; +import javax.wsdl.Part; +import javax.wsdl.PortType; + +import org.apache.tuscany.container.rhino.assembly.JavaScriptImplementation; +import org.apache.tuscany.container.rhino.config.JavaScriptContextFactory; +import org.apache.tuscany.container.rhino.rhino.E4XDataBinding; +import org.apache.tuscany.container.rhino.rhino.RhinoE4XScript; +import org.apache.tuscany.container.rhino.rhino.RhinoScript; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.extension.ContextFactoryBuilderSupport; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; + +import commonj.sdo.helper.TypeHelper; + +/** + * Builds {@link org.apache.tuscany.container.rhino.config.JavaScriptContextFactory}s from a JavaScript component type + * + * @version $Rev$ $Date$ + */ +@org.osoa.sca.annotations.Scope("MODULE") +public class JavaScriptContextFactoryBuilder extends ContextFactoryBuilderSupport { + + @Override + protected ContextFactory createContextFactory(String componentName, JavaScriptImplementation jsImplementation, Scope scope) { + + Map services = new HashMap(); + for (Service service : jsImplementation.getComponentType().getServices()) { + services.put(service.getName(), service.getServiceContract().getInterface()); + } + + Map defaultProperties = new HashMap(); + for (org.apache.tuscany.model.assembly.Property property : jsImplementation.getComponentType().getProperties()) { + defaultProperties.put(property.getName(), property.getDefaultValue()); + } + + String script = jsImplementation.getScript(); + ClassLoader cl = jsImplementation.getResourceLoader().getClassLoader(); + + RhinoScript invoker; + if (isE4XStyle(componentName, jsImplementation.getComponentType().getServices())) { + E4XDataBinding dataBinding = createDataBinding(jsImplementation); + invoker = new RhinoE4XScript(componentName, script, defaultProperties, cl, dataBinding); + } else { + invoker = new RhinoScript(componentName, script, defaultProperties, cl); + } + + Map properties = new HashMap(); + JavaScriptContextFactory contextFactory = new JavaScriptContextFactory(componentName, scope, services, properties, invoker); + + return contextFactory; + } + + /** + * Tests if this should be an E4X style service + * Its E4X if the JavaScript component uses WSDL to define its interface + */ + protected boolean isE4XStyle(String componentName, List services) { + Boolean isE4XStyle = null; + for (Service service : services) { + ServiceContract sc = service.getServiceContract(); + if (sc instanceof WSDLServiceContract) { + if (isE4XStyle != null && !isE4XStyle.booleanValue()) { + throw new BuilderConfigException("mixed service interface types not supportted"); + } + isE4XStyle = Boolean.TRUE; + } else { + isE4XStyle = Boolean.FALSE; + } + } + return isE4XStyle.booleanValue(); + } + + /** + * Create the data binding for the component initialized for each operation in the service + */ + protected E4XDataBinding createDataBinding(JavaScriptImplementation jsImplementation) { + ClassLoader classLoader = jsImplementation.getResourceLoader().getClassLoader(); + TypeHelper typeHelper = jsImplementation.getTypeHelper(); + E4XDataBinding dataBinding = new E4XDataBinding(classLoader, typeHelper); + for (Service service : jsImplementation.getComponentType().getServices()) { + ServiceContract sc = service.getServiceContract(); + if (sc instanceof WSDLServiceContract) { + PortType pt = ((WSDLServiceContract) sc).getPortType(); + for (Object o : pt.getOperations()) { + Operation operation = (Operation) o; + Input input = operation.getInput(); + if (input != null) { + Message message = input.getMessage(); + if (message != null) { + List parts = message.getOrderedParts(null); + if (parts != null && parts.size() > 0) { + Part part = (Part) parts.get(0); + dataBinding.addElementQName(operation.getName(), part.getElementName()); + } + } + } + } + } + } + return dataBinding; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptTargetWireBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptTargetWireBuilder.java new file mode 100644 index 0000000000..0c45aee35e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/builder/JavaScriptTargetWireBuilder.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.builder; + +import java.lang.reflect.Method; + +import org.apache.tuscany.container.rhino.config.JavaScriptContextFactory; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.extension.ComponentTargetInvoker; +import org.apache.tuscany.core.extension.WireBuilderSupport; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.osoa.sca.annotations.Scope; + +/** + * Responsible for bridging source- and target-side invocations chains when the target type is a JavaScript implementation + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class JavaScriptTargetWireBuilder extends WireBuilderSupport { + + protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) { + return new ComponentTargetInvoker(targetName, operation, context); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/config/JavaScriptContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/config/JavaScriptContextFactory.java new file mode 100644 index 0000000000..28a0302a4f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/config/JavaScriptContextFactory.java @@ -0,0 +1,114 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.config; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.container.rhino.context.JavaScriptComponentContext; +import org.apache.tuscany.container.rhino.rhino.RhinoScript; +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Creates instance contexts for JavaScript component types + * + * @version $Rev$ $Date$ + */ +public class JavaScriptContextFactory implements ContextFactory, ContextResolver { + + private Scope scope; + + private String name; + + private Map targetProxyFactories = new HashMap(); + + private List sourceProxyFactories = new ArrayList(); + + private Map services; + + private Map properties; + + private RhinoScript invoker; + + private CompositeContext parentContext; + + public JavaScriptContextFactory(String name, Scope scope, Map services, Map properties, RhinoScript invoker) { + this.name = name; + this.scope = scope; + this.services = services; + this.properties = properties; + this.invoker = invoker; + } + + public AtomicContext createContext() throws ContextCreationException { + return new JavaScriptComponentContext(name, services, properties, sourceProxyFactories, targetProxyFactories, invoker.copy()); + } + + public Scope getScope() { + return scope; + } + + public String getName() { + return name; + } + + public void addProperty(String propertyName, Object value) { + properties.put(propertyName, value); + } + + public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { + targetProxyFactories.put(serviceName, factory); + } + + public TargetWireFactory getTargetWireFactory(String serviceName) { + return targetProxyFactories.get(serviceName); + } + + public Map getTargetWireFactories() { + return targetProxyFactories; + } + + public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { + sourceProxyFactories.add(factory); + } + + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factories, boolean multiplicity) { + sourceProxyFactories.addAll(factories); + } + + public List getSourceWireFactories() { + return sourceProxyFactories; + } + + public void prepare(CompositeContext parent) { + parentContext = parent; + } + + public CompositeContext getCurrentContext() { + return parentContext; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/context/JavaScriptComponentContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/context/JavaScriptComponentContext.java new file mode 100644 index 0000000000..bfa4eeaffb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/context/JavaScriptComponentContext.java @@ -0,0 +1,140 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.context; + +import org.apache.tuscany.container.rhino.rhino.RhinoScript; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.event.InstanceCreated; +import org.apache.tuscany.core.context.impl.AbstractContext; +import org.apache.tuscany.core.wire.ProxyCreationException; +import org.apache.tuscany.core.wire.WireFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.osoa.sca.ServiceRuntimeException; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class JavaScriptComponentContext extends AbstractContext implements AtomicContext { + + private Map services; + + private RhinoScript rhinoInvoker; + + private Map properties; + + private List sourceProxyFactories; + + private Map targetProxyFactories; + + private Object instance; + + public JavaScriptComponentContext(String name, Map services, Map properties, + List sourceProxyFactories, Map targetProxyFactories, RhinoScript invoker) { + super(name); + assert (services != null) : "No service interface mapping specified"; + assert (properties != null) : "No properties specified"; + this.services = services; + this.properties = properties; + this.rhinoInvoker = invoker; + this.sourceProxyFactories = sourceProxyFactories; + this.targetProxyFactories = targetProxyFactories; + } + + public Object getInstance(QualifiedName qName) throws TargetException { + return getInstance(qName, true); + } + + public void init() throws TargetException { + getInstance(null, false); + } + + public void destroy() throws TargetException { + + } + + private synchronized Object getInstance(QualifiedName qName, boolean notify) throws TargetException { + String portName = qName.getPortName(); + WireFactory targetFactory; + if (portName != null) { + targetFactory = targetProxyFactories.get(portName); + } else { + //FIXME The port name is null here, either locateService needs more information (the expected interface) to + // select the correct port, or we need to return a factory that matches the whole set of services exposed by + // the component. + targetFactory = targetProxyFactories.values().iterator().next(); + } + if (targetFactory == null) { + TargetException e = new TargetException("Target service not found"); + e.setIdentifier(qName.getPortName()); + e.addContextName(getName()); + throw e; + } + try { + Object proxy = targetFactory.createProxy(); //createProxy(new Class[] { iface }); + if (notify) { + publish(new InstanceCreated(this)); + } + return proxy; + } catch (ProxyCreationException e) { + TargetException te = new TargetException("Error returning target", e); + e.setIdentifier(qName.getPortName()); + e.addContextName(getName()); + throw te; + } + } + + public Object getTargetInstance() throws TargetException { + rhinoInvoker.updateScriptScope(createServiceReferences()); // create references + rhinoInvoker.updateScriptScope(properties); // create prop values + return rhinoInvoker; + } + + /** + * Creates a map containing any ServiceReferences + */ + private Map createServiceReferences() { + try { + Map context = new HashMap(); + for (SourceWireFactory proxyFactory : sourceProxyFactories) { + context.put(proxyFactory.getConfiguration().getReferenceName(), proxyFactory.createProxy()); + } + return context; + } catch (ProxyCreationException e) { + throw new ServiceRuntimeException(e); + } + } + + public boolean isEagerInit() { + return false; + } + + public boolean isDestroyable() { + return false; + } + + public void start() throws CoreRuntimeException { + } + + public void stop() throws CoreRuntimeException { + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java new file mode 100644 index 0000000000..e28776049c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/loader/JavaScriptImplementationLoader.java @@ -0,0 +1,168 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.loader; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.container.rhino.assembly.JavaScriptImplementation; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.InvalidRootElementException; +import org.apache.tuscany.core.config.MissingResourceException; +import org.apache.tuscany.core.config.SidefileLoadException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.StAXElementLoader; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.core.loader.assembly.AssemblyConstants; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.model.assembly.ComponentType; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class JavaScriptImplementationLoader implements StAXElementLoader { + + public static final QName IMPLEMENTATION_JS = new QName("http://org.apache.tuscany/xmlns/js/0.9", "implementation.js"); + + protected StAXLoaderRegistry registry; + + private XMLInputFactory xmlFactory; + + public JavaScriptImplementationLoader() { + // todo make this a reference to a system service + xmlFactory = XMLInputFactory.newInstance(); + } + + @Autowire + public void setRegistry(StAXLoaderRegistry registry) { + this.registry = registry; + } + + @Init(eager = true) + public void start() { + registry.registerLoader(IMPLEMENTATION_JS, this); + } + + @Destroy + public void stop() { + registry.unregisterLoader(IMPLEMENTATION_JS, this); + } + + public JavaScriptImplementation load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + String scriptFile = reader.getAttributeValue(null, "scriptFile"); + String script = loadScript(scriptFile, loaderContext.getResourceLoader()); + ComponentType componentType = loadComponentType(scriptFile, loaderContext); + + JavaScriptImplementation jsImpl = new JavaScriptImplementation(); + jsImpl.setComponentType(componentType); + jsImpl.setScriptFile(scriptFile); + jsImpl.setScript(script); + jsImpl.setResourceLoader(loaderContext.getResourceLoader()); + jsImpl.setTypeHelper(registry.getContext().getTypeHelper()); + return jsImpl; + } + + protected String loadScript(String scriptFile, ResourceLoader resourceLoader) throws ConfigurationLoadException { + URL url = resourceLoader.getResource(scriptFile); + if (url == null) { + throw new ConfigurationLoadException(scriptFile); + } + InputStream inputStream; + try { + inputStream = url.openStream(); + } catch (IOException e) { + throw new ConfigurationLoadException(scriptFile, e); + } + try { + StringBuilder sb = new StringBuilder(1024); + int n; + while ((n = inputStream.read()) != -1) { + sb.append((char) n); + } + return sb.toString(); + } catch (IOException e) { + throw new ConfigurationLoadException(scriptFile, e); + } finally { + try { + inputStream.close(); + } catch (IOException e) { + // ignore + } + } + } + + protected ComponentType loadComponentType(String scriptFile, LoaderContext loaderContext) throws SidefileLoadException, MissingResourceException{ + String sidefile = scriptFile.substring(0, scriptFile.lastIndexOf('.')) + ".componentType"; + URL componentTypeFile = loaderContext.getResourceLoader().getResource(sidefile); + if (componentTypeFile == null) { + throw new MissingResourceException(sidefile); + } + + try { + XMLStreamReader reader; + InputStream is; + is = componentTypeFile.openStream(); + try { + reader = xmlFactory.createXMLStreamReader(is); + try { + reader.nextTag(); + if (!AssemblyConstants.COMPONENT_TYPE.equals(reader.getName())) { + InvalidRootElementException e = new InvalidRootElementException(AssemblyConstants.COMPONENT_TYPE, reader.getName()); + e.setResourceURI(componentTypeFile.toString()); + throw e; + } + return (ComponentType) registry.load(reader, loaderContext); + } finally { + try { + reader.close(); + } catch (XMLStreamException e) { + // ignore + } + } + } finally { + try { + is.close(); + } catch (IOException e) { + // ignore + } + } + } catch (IOException e) { + SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); + sfe.setResourceURI(componentTypeFile.toString()); + throw sfe; + } catch (XMLStreamException e) { + SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); + sfe.setResourceURI(componentTypeFile.toString()); + throw sfe; + } catch (ConfigurationLoadException e) { + SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); + sfe.setResourceURI(componentTypeFile.toString()); + throw sfe; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/E4XDataBinding.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/E4XDataBinding.java new file mode 100644 index 0000000000..3969735b23 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/E4XDataBinding.java @@ -0,0 +1,108 @@ +/** + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.rhino; + +import java.io.ByteArrayInputStream; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.core.wire.InvocationRuntimeException; +import org.apache.tuscany.databinding.sdo.SDOXMLHelper; +import org.apache.xmlbeans.XmlObject; +import org.mozilla.javascript.Context; +import org.mozilla.javascript.Scriptable; + +import commonj.sdo.helper.TypeHelper; + +/** + * DataBinding to convert between Java objects and JavaScript E4X XML objects. This uses SDO to do the conversion between XML and Java so WSDL/XSDs + * need to have be registered with the SDO runtime. + * + * TODO: suport non-wrapped WSDL + */ +public class E4XDataBinding { + + private ClassLoader classLoader; + + private TypeHelper typeHelper; + + private Map function2ElementMap; + + private static final boolean IS_WRAPPED = true; + + public E4XDataBinding(ClassLoader classLoader, TypeHelper typeHelper) { + this.classLoader = classLoader; + this.typeHelper = typeHelper; + this.function2ElementMap = new HashMap(); + } + + /** + * Convert E4X XML to Java objects + * + * @param e4xXML + * @return the array of Objects + */ + public Object[] toObjects(Scriptable e4xXML) { + byte[] xmlBytes = e4xXML.toString().getBytes(); + Object[] os = SDOXMLHelper.toObjects(classLoader, typeHelper, xmlBytes, IS_WRAPPED); + return os; + } + + /** + * Convert request Java objects to XML + * + * @param functionName + * @param os + * @param scope + * @return a JavaScript E4X XML object + */ + public Scriptable toE4X(String functionName, Object[] os, Scriptable scope) { + QName elementQN = function2ElementMap.get(functionName); + byte[] xmlBytes = SDOXMLHelper.toXMLBytes(classLoader, typeHelper, os, elementQN, IS_WRAPPED); + + XmlObject xmlObject; + try { + xmlObject = XmlObject.Factory.parse(new ByteArrayInputStream(xmlBytes)); + } catch (Exception e) { + throw new InvocationRuntimeException(e); + } + + Context cx = Context.enter(); + try { + + Object xml = cx.getWrapFactory().wrap(cx, scope, xmlObject, XmlObject.class); + Scriptable jsXML = cx.newObject(scope, "XML", new Object[] { xml }); + + return jsXML; + + } finally { + Context.exit(); + } + } + + /** + * Add the XML element name to use for an operation when converting from + * Java objects to XML. + * + * @param functionName + * @param elementQN + */ + public void addElementQName(String functionName, QName elementQN) { + function2ElementMap.put(functionName, elementQN); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScript.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScript.java new file mode 100644 index 0000000000..5f42f6d164 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScript.java @@ -0,0 +1,76 @@ +/** + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.rhino; + +import java.util.Map; + +import org.mozilla.javascript.Function; +import org.mozilla.javascript.Scriptable; +import org.mozilla.javascript.xml.XMLObject; + +/** + * Invokes a JavaScript/E4X function with argument and return values that may be E4X XML objects. + */ +public class RhinoE4XScript extends RhinoScript { + + private E4XDataBinding dataBinding; + + public RhinoE4XScript(String scriptName, String script, Map context, ClassLoader cl, E4XDataBinding dataBinding) { + super(scriptName, script, context, cl); + this.dataBinding = dataBinding; + } + + protected RhinoE4XScript(String scriptName, String script, Scriptable scriptScope, E4XDataBinding dataBinding) { + super(scriptName, script, scriptScope); + this.dataBinding = dataBinding; + } + + /** + * Turn args to JS objects and convert any OMElement to E4X XML + */ + @Override + protected Object[] processArgs(String functionName, Object[] args, Scriptable scope) { + return new Object[] { dataBinding.toE4X(functionName, args, scope) }; + } + + /** + * Unwrap and convert response converting any E4X XML into Java objects + */ + @Override + protected Object processResponse(String functionName, Object response, Class responseClass) { + if (response instanceof XMLObject) { + Object[] os = dataBinding.toObjects((XMLObject) response); + if (os == null || os.length < 1) { + return null; + } else { + return os[0]; + } + } else { + return super.processResponse(functionName, response, responseClass); + } + } + + @Override + protected Function getFunction(Scriptable scope, String functionName) { + return super.getFunction(scope, "process"); + } + + @Override + public RhinoE4XScript copy() { + return new RhinoE4XScript(scriptName, script, scriptScope, dataBinding); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoScript.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoScript.java new file mode 100644 index 0000000000..5518159f69 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/java/org/apache/tuscany/container/rhino/rhino/RhinoScript.java @@ -0,0 +1,290 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.rhino; + +import java.util.Iterator; +import java.util.Map; + +import org.apache.tuscany.core.extension.ExternalServiceInvoker; +import org.mozilla.javascript.Context; +import org.mozilla.javascript.ContextFactory; +import org.mozilla.javascript.Function; +import org.mozilla.javascript.ImporterTopLevel; +import org.mozilla.javascript.Script; +import org.mozilla.javascript.Scriptable; +import org.mozilla.javascript.Wrapper; + +/** + * Represents, and is responsible for dispatching to, a JavaScript artifact in Rhino + */ +public class RhinoScript implements ExternalServiceInvoker { + + protected String scriptName; + + protected String script; + + protected Scriptable scriptScope; + + private Scriptable sharedScope; + + /* + * Enable dynamic scopes so a script can be used concurrently with a global shared scope and individual execution + * scopes. See http://www.mozilla.org/rhino/scopes.html TODO: need to review how ths fits in with Tuscany scopes + */ + private static class MyFactory extends ContextFactory { + protected boolean hasFeature(Context cx, int featureIndex) { + if (featureIndex == Context.FEATURE_DYNAMIC_SCOPE) { + return true; + } + return super.hasFeature(cx, featureIndex); + } + } + + static { + ContextFactory.initGlobal(new MyFactory()); + } + + /** + * Create a new RhinoInvoker. + * + * @param scriptName the name of the script. Can be anything, only used in messages to identify the script + * @param script the complete script + */ + public RhinoScript(String scriptName, String script) { + this(scriptName, script, (Map) null, null); + } + + /** + * Create a new RhinoInvoker. + * + * @param scriptName the name of the script. Can be anything, only used in messages to identify the script + * @param script the complete script + * @param context name-value pairs that are added in to the scope where the script is compiled. May be null. The + * value objects are made available to the script by using a variable with the name. + */ + public RhinoScript(String scriptName, String script, Map context, ClassLoader cl) { + this.scriptName = scriptName; + this.script = script; + initScriptScope(scriptName, script, context, cl); + initSharedScope(); + } + + /** + * Construct a RhinoInvoker from another RhinoInvoker object. This uses the original script scope so the script + * doesn't need to be recompiled. + */ + protected RhinoScript(String scriptName, String script, Scriptable scriptScope) { + this.scriptName = scriptName; + this.script = script; + this.scriptScope = scriptScope; + initSharedScope(); + } + + /** + * Invoke a script function + * + * @param functionName the name of the function to invoke. + * @param arg arguments to the function, may be a single object or an array of objects. + * @return the function return value. + */ + public Object invoke(String functionName, Object[] args) { + return invoke(functionName, args, null, null); + } + + /** + * Invoke a script function + * + * @param functionName the name of the function to invoke. + * @param arg arguments to the function, may be a single object or an array of objects. + * @param contexts a Map of name-value pairs which are added to the wire Scope to enable the script to access + * the values by using the variable in name. + * @return the function return value. + */ + public Object invoke(String functionName, Object[] args, Map contexts) { + return invoke(functionName, args, null, contexts); + } + + /** + * Invoke a script function + * + * @param functionName the name of the function to invoke. + * @param arg arguments to the function, may be a single object or an array of objects. + * @param responseClass the desired class of the response object. + * @param contexts a Map of name-value pairs which are added to the wire Scope to enable the script to access + * the values by using the variable in name. + * @return the function return value. + */ + public Object invoke(String functionName, Object[] args, Class responseClass, Map contexts) { + Context cx = Context.enter(); + try { + Function function = getFunction(scriptScope, functionName); + Scriptable invocationScope = getInvocationScope(cx, contexts); + Object[] jsArgs = processArgs(functionName, args, invocationScope); + Object jsResponse = function.call(cx, invocationScope, invocationScope, jsArgs); + Object response = processResponse(functionName, jsResponse, responseClass); + return response; + } finally { + Context.exit(); + } + } + + /** + * Turn args to JS objects and convert any OMElement to E4X XML + */ + protected Object[] processArgs(String functionName, Object[] arg, Scriptable scope) { + Object[] args; + if (arg == null) { + args = new Object[] { null }; + } else if (arg.getClass().isArray()) { + args = (Object[]) arg; + for (int i = 0; i < args.length; i++) { + args[i] = Context.toObject(args[i], scope); + } + } else { + args = new Object[] { Context.toObject(arg, scope) }; + } + return args; + } + + /** + * Unwrap and convert response + */ + protected Object processResponse(String functionName, Object response, Class responseClass) { + if (Context.getUndefinedValue().equals(response)) { + response = null; + } else if (response instanceof Wrapper) { + response = ((Wrapper) response).unwrap(); + } else { + if (responseClass != null) { + response = Context.jsToJava(response, responseClass); + } else { + response = Context.jsToJava(response, String.class); + } + } + return response; + } + + /** + * Create a Rhino scope and compile the script into it + */ + protected void initScriptScope(String fileName, String scriptCode, Map context, ClassLoader cl) { + Context cx = Context.enter(); + try { + + if (cl != null) { + cx.setApplicationClassLoader(cl); + } + this.scriptScope = new ImporterTopLevel( cx, true ); + Script compiledScript = cx.compileString(scriptCode, fileName, 1, null); + compiledScript.exec(cx, scriptScope); + addContexts(scriptScope, context); + + } finally { + Context.exit(); + } + } + + /** + * Initializes the shared scope + */ + protected void initSharedScope() { + Context cx = Context.enter(); + try { + + this.sharedScope = cx.newObject(scriptScope); + sharedScope.setPrototype(scriptScope); + sharedScope.setParentScope(null); + + } finally { + Context.exit(); + } + } + + /** + * Get a Rhino scope for the function wire. If the wire has no context objects then this will use the + * shared scope otherwise a new scope is created to hold the context objects. Any new variables the executing script + * might define will go in the sharedScope. This new scope is just to hold the wire specific context objects. + */ + protected Scriptable getInvocationScope(Context cx, Map contexts) { + + Scriptable scope; + if (contexts == null || contexts.size() == 0) { + scope = sharedScope; + } else { + scope = cx.newObject(sharedScope); + scope.setPrototype(sharedScope); + scope.setParentScope(null); + addContexts(scope, contexts); + } + + return scope; + } + + /** + * Add the context to the scope. This will make the objects available to a script by using the name it was added + * with. + */ + protected void addContexts(Scriptable scope, Map contexts) { + if (contexts != null) { + for (Iterator i = contexts.keySet().iterator(); i.hasNext();) { + String name = (String) i.next(); + Object value = contexts.get(name); + if (value != null) { + scope.put(name, scope, Context.toObject(value, scope)); + } + } + } + } + + /** + * Get the Rhino Function object for the named script function + */ + protected Function getFunction(Scriptable scope, String functionName) { + + Object handleObj = scope.get(functionName, scope); + + if (!(handleObj instanceof Function)) { + throw new RuntimeException("script function '" + functionName + "' is undefined or not a function in script " + + scriptName); + } + + return (Function) handleObj; + } + + /** + * Make a copy of this RhinoScript object. This shares the script scope to avoid the overhead of recompiling the + * script, and to allow any initialization done by the script to be shared. + */ + public RhinoScript copy() { + return new RhinoScript(scriptName, script, scriptScope); + } + + /** + * Update the scope where the script is complied with new context values + * + * @param properties + */ + public void updateScriptScope(Map context) { + Context.enter(); + try { + addContexts(scriptScope, context); + } finally { + Context.exit(); + } + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/system.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/system.fragment new file mode 100644 index 0000000000..840efd10bc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/main/resources/system.fragment @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/AbstractJavaScriptTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/AbstractJavaScriptTestCase.java new file mode 100644 index 0000000000..ee6b533ddf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/AbstractJavaScriptTestCase.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.rhino.integration; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * Integration tests for JavaScript components + */ +public abstract class AbstractJavaScriptTestCase extends TestCase { + + protected TuscanyRuntime tuscany; + + protected ModuleContext moduleContext; + + @Override + protected void setUp() throws Exception { + super.setUp(); + + tuscany = new TuscanyRuntime("tests", null); + tuscany.start(); + moduleContext = CurrentModuleContext.getContext(); + + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + tuscany.stop(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/BasicTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/BasicTestCase.java new file mode 100644 index 0000000000..f66f2e1079 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/BasicTestCase.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.rhino.integration; + +/** + * Integration tests for JavaScript components + */ +public class BasicTestCase extends AbstractJavaScriptTestCase { + + public void testBasicInvocation() throws Exception { + HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent1"); + String response = helloworldService.getGreetings("petra"); + assertEquals("jsHello petra", response); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/E4XTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/E4XTestCase.java new file mode 100644 index 0000000000..d6060aea90 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/E4XTestCase.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.rhino.integration; + +/** + * Integration tests for JavaScript components and composite contexts + * + * @version $Rev$ $Date$ + */ +public class E4XTestCase extends AbstractJavaScriptTestCase { + + public void testE4X() throws Exception { + HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponentE4X"); + String response = helloworldService.getGreetings("petra"); + assertEquals("e4xHello petra", response); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/HelloWorld.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/HelloWorld.java new file mode 100644 index 0000000000..3a90be0102 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/HelloWorld.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.integration; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorld { + + public String getGreetings(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/InitializationTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/InitializationTestCase.java new file mode 100644 index 0000000000..138d9a8452 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/InitializationTestCase.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.rhino.integration; + +/** + * Integration tests for JavaScript components + */ +public class InitializationTestCase extends AbstractJavaScriptTestCase { + + public void testInitialization() throws Exception { + HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent4"); + String response = helloworldService.getGreetings("petra"); + assertEquals("Bonjour petra", response); + } + + public void testImports1() throws Exception { + HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent5"); + String response = helloworldService.getGreetings("petra"); + assertEquals("Kia ora petra", response); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/PropertiesTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/PropertiesTestCase.java new file mode 100644 index 0000000000..7b14376dbe --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/PropertiesTestCase.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.rhino.integration; + +/** + * Integration tests for JavaScript components + */ +public class PropertiesTestCase extends AbstractJavaScriptTestCase { + + public void testDefaultProperty() throws Exception { + HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent2a"); + String response = helloworldService.getGreetings("petra"); + assertEquals("Hi petra", response); + } + + public void testOverrideProperty() throws Exception { + HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent2b"); + String response = helloworldService.getGreetings("petra"); + assertEquals("Guten Tag petra", response); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/Salutation.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/Salutation.java new file mode 100644 index 0000000000..42d46c16d1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/Salutation.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.integration; + +/** + */ +public interface Salutation { + + public String getSalutation(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/ServiceRefsTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/ServiceRefsTestCase.java new file mode 100644 index 0000000000..27993c2b99 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/ServiceRefsTestCase.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.container.rhino.integration; + +/** + * Integration tests for JavaScript components + */ +public class ServiceRefsTestCase extends AbstractJavaScriptTestCase { + + public void testServiceReference() throws Exception { + HelloWorld helloworldService = (HelloWorld) moduleContext.locateService("HelloWorldComponent3a"); + String response = helloworldService.getGreetings("petra"); + assertEquals("Guten Tag petra", response); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/TestMethods.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/TestMethods.java new file mode 100644 index 0000000000..327edd1cbb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/integration/TestMethods.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.integration; + +public class TestMethods { + + private String salutation = "Kia ora"; + + public String getSalutation() { + return salutation; + } + + public void getSalutation(String s) { + salutation = s; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.java new file mode 100644 index 0000000000..714814f2cf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.java @@ -0,0 +1,89 @@ +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.rhino; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XSDHelper; + +/** + * Tests for the RhinoE4XScript + */ +public class RhinoE4XScriptTestCase extends TestCase { + + private static final String scriptName = "RhinoE4XScriptTestCase.js"; + + private String script; + + private E4XDataBinding dataBinding; + + protected void setUp() throws Exception { + super.setUp(); + this.script = readResource(scriptName); + TypeHelper th = SDOUtil.createTypeHelper(); + XSDHelper xsdHelper = new XSDHelperImpl(th); + URL url = getClass().getResource("helloworld.wsdl"); + xsdHelper.define(url.openStream(), null); + + dataBinding = new E4XDataBinding(getClass().getClassLoader(),th); + dataBinding.addElementQName("getGreetings", new QName("http://helloworld.samples.tuscany.apache.org", "getGreetings")); + } + + public void testSimpleInvocation() throws IOException { + RhinoE4XScript ri = new RhinoE4XScript(scriptName, script, null, null, dataBinding); + Object x = ri.invoke("getGreetings", new Object[] { "petra" }, null); + assertEquals(x, "hello petra"); + } + + /** + * Read a resource into a String + */ + private String readResource(String name) { + try { + URL url = getClass().getResource(name); + if (url == null) { + throw new RuntimeException("resource not found: " + name); + } + InputStream inputStream = url.openStream(); + + StringBuffer resource = new StringBuffer(); + int n = 0; + + while ((n = inputStream.read()) != -1) { + resource.append((char) n); + } + + inputStream.close(); + + String s = resource.toString(); + return s; + + } catch (IOException e) { + throw new RuntimeException("IOException reading resource " + name, e); + } + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.java new file mode 100644 index 0000000000..19c0d9bcf6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/java/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.java @@ -0,0 +1,186 @@ +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.container.rhino.rhino; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; + +import junit.framework.TestCase; + +import org.apache.tuscany.container.rhino.rhino.RhinoScript; +import org.mozilla.javascript.EcmaError; + +/** + * Tests for the RhinoScript + */ +public class RhinoScriptTestCase extends TestCase { + + private static final String scriptName = "RhinoScriptTestCase.js"; + + private String script; + + protected void setUp() throws Exception { + super.setUp(); + this.script = readResource(scriptName); + } + + public void testSimpleInvocation() { + RhinoScript ri = new RhinoScript(scriptName, script); + Object x = ri.invoke("echo", new Object[] { "petra" }, null); + assertEquals("petra", x); + } + + public void testCopy() { + RhinoScript ri = new RhinoScript(scriptName, script); + Object x = ri.invoke("echo", new Object[] { "petra" }, null); + assertEquals("petra", x); + + ri = ri.copy(); + x = ri.invoke("echo", new Object[] { "sue" }, null); + assertEquals("sue", x); + + } + + public void testContexts1() { + RhinoScript ri = new RhinoScript(scriptName, script); + Map contexts = new HashMap(); + contexts.put("a", "petra"); + Object x = ri.invoke("getA", null, contexts); + assertEquals("petra", x); + } + + /** + * Tests context not accessable across invocations + */ + public void testContexts2() { + RhinoScript ri = new RhinoScript(scriptName, script); + Map contexts = new HashMap(); + contexts.put("a", "petra"); + Object x = ri.invoke("getA", null, contexts); + assertEquals("petra", x); + + try { + x = ri.invoke("getA", null, null); + assertTrue("expected ReferenceError", false); + } catch (EcmaError e) { + assertEquals("ReferenceError", e.getName()); + } + } + + /** + * Tests shared scope is accessable across invocations + */ + public void testScopes1() { + RhinoScript ri = new RhinoScript(scriptName, script); + ri.invoke("setGlobalVarY", new Object[] { "petra" }, null); + + Object x = ri.invoke("getGlobalVarY", null, null); + assertEquals("petra", x); + } + + /** + * Tests local vars are NOT accessable across invocations + */ + public void testScopes2() { + RhinoScript ri = new RhinoScript(scriptName, script); + ri.invoke("setLocalVarY", new Object[] { "petra" }, null); + + try { + ri.invoke("getGlobalVarY", null, null); + assertTrue("expected ReferenceError", false); + } catch (EcmaError e) { + assertEquals("ReferenceError", e.getName()); + } + } + + /** + * Tests shared scope is accessable when using contexts (ie an wire scope) + */ + public void testScopes3() { + RhinoScript ri = new RhinoScript(scriptName, script); + ri.invoke("setGlobalVarY", new Object[] { "petra" }, null); + + Map contexts = new HashMap(); + contexts.put("a", "sue"); + Object x = ri.invoke("getGlobalVarY", null, contexts); + assertEquals("petra", x); + + x = ri.invoke("getA", null, contexts); + assertEquals("sue", x); + + } + + /** + * Tests a copy only retains the script scope not the shared scope + */ + public void testScopes4() { + RhinoScript ri = new RhinoScript(scriptName, script); + ri.invoke("setGlobalVarY", new Object[] { "petra" }, null); + + ri = ri.copy(); + try { + ri.invoke("getGlobalVarY", null, null); + assertTrue("expected ReferenceError", false); + } catch (EcmaError e) { + assertEquals("ReferenceError", e.getName()); + } + try { + ri.invoke("getA", null, null); + assertTrue("expected ReferenceError", false); + } catch (EcmaError e) { + assertEquals("ReferenceError", e.getName()); + } + + } + + public void testGetInt() { + RhinoScript ri = new RhinoScript(scriptName, script); + Object x = ri.invoke("getInt", null, Integer.TYPE, null); + assertEquals(Integer.class, x.getClass()); + } + + /** + * Read a resource into a String + */ + private String readResource(String name) { + try { + URL url = getClass().getResource(name); + if (url == null) { + throw new RuntimeException("resource not found: " + name); + } + InputStream inputStream = url.openStream(); + + StringBuffer resource = new StringBuffer(); + int n = 0; + + while ((n = inputStream.read()) != -1) { + resource.append((char) n); + } + + inputStream.close(); + + String s = resource.toString(); + return s; + + } catch (IOException e) { + throw new RuntimeException("IOException reading resource " + name, e); + } + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.js b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.js new file mode 100644 index 0000000000..20dc2245f9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoE4XScriptTestCase.js @@ -0,0 +1,11 @@ + +function process(inXML) { + + var greeting = "hello " + inXML..*::in0; + var outXML = + + { greeting } + ; + + return outXML; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.js b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.js new file mode 100644 index 0000000000..2de740d5f8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/RhinoScriptTestCase.js @@ -0,0 +1,22 @@ + +function echo(x) { + return x; +} + +function getA(x) { + return a; +} + +function setGlobalVarY(x) { + y = x; +} +function setLocalVarY(x) { + var y = x; +} +function getGlobalVarY(x) { + return y; +} + +function getInt(x) { + return 42; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/helloworld.wsdl new file mode 100644 index 0000000000..a402cc4d7c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/org/apache/tuscany/container/rhino/rhino/helloworld.wsdl @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/sca.module new file mode 100644 index 0000000000..f78a41381a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/sca.module @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + Guten Tag + + + + + + + SalutationComponent3b + + + + + + + Guten Tag + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.componentType b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.componentType new file mode 100644 index 0000000000..90b6c09015 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.componentType @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.js b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.js new file mode 100644 index 0000000000..b3104f78a5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl1.js @@ -0,0 +1,20 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function getGreetings(name) { + return "jsHello " + name; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.componentType b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.componentType new file mode 100644 index 0000000000..33208811bf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.componentType @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.js b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.js new file mode 100644 index 0000000000..4f91dba40e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl2.js @@ -0,0 +1,20 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function getGreetings(name) { + return salutation + " " + name; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.componentType b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.componentType new file mode 100644 index 0000000000..1bc6922e6d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.componentType @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.js b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.js new file mode 100644 index 0000000000..f3160f6f65 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl3a.js @@ -0,0 +1,20 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function getGreetings(name) { + return SalutationService.getSalutation() + " " + name; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.componentType b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.componentType new file mode 100644 index 0000000000..90b6c09015 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.componentType @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.js b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.js new file mode 100644 index 0000000000..338c3ac3cd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl4.js @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +initSalutation(); + +function getGreetings(name) { + return SALUTATION + name; +} + +function initSalutation() { + SALUTATION = "Bonjour "; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.componentType b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.componentType new file mode 100644 index 0000000000..90b6c09015 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.componentType @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.js b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.js new file mode 100644 index 0000000000..f01cd1727f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/HelloWorldImpl5.js @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +//importPackage(Packages.sample.utils); +importClass(Packages.org.apache.tuscany.container.rhino.integration.TestMethods); + +initSalutation(); + +function getGreetings(name) { + return SALUTATION.getSalutation() + " " + name; +} + +function initSalutation() { + SALUTATION = new TestMethods(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.componentType b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.componentType new file mode 100644 index 0000000000..1c819bff32 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.componentType @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.js b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.js new file mode 100644 index 0000000000..2116e40ae3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/SalutationImpl.js @@ -0,0 +1,20 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function getSalutation() { + return GREETING; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/e4x.componentType b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/e4x.componentType new file mode 100644 index 0000000000..6bf89d2ef8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/e4x.componentType @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/e4x.js b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/e4x.js new file mode 100644 index 0000000000..7fe882df55 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/tests/e4x.js @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function process(xmlIn) { + + var greeting = "e4xHello " + xmlIn..*::in0; + + var xmlOut = + + { greeting } + ; + + return xmlOut; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..7bcb48dcf2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/container.rhino/src/test/resources/wsdl/helloworld.wsdl @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/pom.xml new file mode 100644 index 0000000000..e3a992c3a3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/containers/pom.xml @@ -0,0 +1,37 @@ + + + + + + org.apache.tuscany + tuscany-sca + incubating-M1 + + + 4.0.0 + org.apache.tuscany.sca.containers + tuscany-sca-containers + pom + Tuscany SCA Containers + incubating-M1 + + + container.java + container.rhino + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/pom.xml new file mode 100644 index 0000000000..b5e934d45e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/pom.xml @@ -0,0 +1,107 @@ + + + + + org.apache.tuscany + tuscany-sca + incubating-M1 + + 4.0.0 + tuscany-core + Tuscany Core + Core Tuscany runtime. + incubating-M1 + + + + org.apache.tuscany + tuscany-model + ${pom.version} + compile + + + + stax + stax-api + 1.0 + compile + + + + woodstox + wstx-asl + 2.9.3 + runtime + + + + tomcat + servlet-api + 5.0.18 + provided + + + + org.apache.geronimo.specs + geronimo-j2ee-connector_1.5_spec + 1.0 + compile + + + + org.apache.geronimo + geronimo-connector + 1.0 + compile + + + org.apache.geronimo + geronimo-transaction + 1.0 + compile + + + + org.apache.geronimo.specs + geronimo-jta_1.0.1B_spec + 1.0 + runtime + + + + concurrent + concurrent + 1.3.4 + runtime + + + + commons-logging + commons-logging + 1.0.4 + runtime + + + + junit + junit + 3.8.1 + test + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/builder/AsyncPolicyBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/builder/AsyncPolicyBuilder.java new file mode 100644 index 0000000000..6acebdaa8e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/builder/AsyncPolicyBuilder.java @@ -0,0 +1,86 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.async.builder; + +import java.util.List; + +import javax.resource.spi.work.WorkManager; + +import org.apache.tuscany.core.async.invocation.AsyncInterceptor; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.SourcePolicyBuilder; +import org.apache.tuscany.core.builder.TargetPolicyBuilder; +import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.OneWay; + +/** + * Builds context factories for component implementations that map to {@link org.apache.tuscany.container.java.assembly.JavaImplementation}. + * The logical model is then decorated with the runtime configuration. + * + * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ + * @see org.apache.tuscany.core.builder.ContextFactory + */ +@org.osoa.sca.annotations.Scope("MODULE") +public class AsyncPolicyBuilder implements SourcePolicyBuilder, TargetPolicyBuilder { + + private PolicyBuilderRegistry builderRegistry; + private WorkManager workManager; + private MessageFactory messageFactory; + + public AsyncPolicyBuilder() { + } + + @Init(eager = true) + public void init() { + builderRegistry.registerSourceBuilder(this); + builderRegistry.registerTargetBuilder(this); + } + + @Autowire + public void setBuilderRegistry(PolicyBuilderRegistry builderRegistry) { + this.builderRegistry = builderRegistry; + } + + @Autowire + public void setWorkManager(WorkManager workManager) { + this.workManager = workManager; + } + + @Autowire + public void setMessageFactory(MessageFactory messageFactory) { + this.messageFactory = messageFactory; + } + + public void build(ConfiguredReference arg0, List arg1) throws BuilderException { + } + + public void build(ConfiguredService service, WireTargetConfiguration wireTargetConfiguration) throws BuilderException { + for (TargetInvocationConfiguration configuration : wireTargetConfiguration.getInvocationConfigurations().values()) { + if (configuration.getMethod().getAnnotation(OneWay.class)!=null) { + configuration.addInterceptor(new AsyncInterceptor(workManager, messageFactory)); + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/invocation/AsyncInterceptor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/invocation/AsyncInterceptor.java new file mode 100644 index 0000000000..08a718bd73 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/invocation/AsyncInterceptor.java @@ -0,0 +1,108 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.async.invocation; + +import javax.resource.spi.work.Work; +import javax.resource.spi.work.WorkException; +import javax.resource.spi.work.WorkManager; + +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.wire.Interceptor; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; +import org.osoa.sca.ServiceRuntimeException; + +/** + * A wire interceptor that uses a WorkManager to schedule asynchronous execution of invocations in Work instances. + */ +public class AsyncInterceptor implements Interceptor { + + private static final ContextBinder BINDER = new ContextBinder(); + + private WorkManager workManager; + private MessageFactory messageFactory; + private Interceptor next; + + /** + * Constructs a new instance + * @param workManager + */ + public AsyncInterceptor(WorkManager workManager, MessageFactory messageFactory) { + this.workManager=workManager; + this.messageFactory=messageFactory; + } + + public Message invoke(final Message message) { + + final ModuleContext currentModuleContext=CurrentModuleContext.getContext(); + + // Schedule the invocation of the next interceptor in a new Work instance + try { + workManager.scheduleWork(new Work() { + + public void run() { + ModuleContext oldModuleContext=CurrentModuleContext.getContext(); + try { + BINDER.setContext(currentModuleContext); + + // Invoke the next interceptor + next.invoke(message); + + } catch (Exception e) { + //FIXME How do we report exceptions? + e.printStackTrace(); + + } finally { + + BINDER.setContext(oldModuleContext); + } + } + + public void release() { + } + + }); + } catch (WorkException e) { + //FIXME Which exception should we throw here? + throw new ServiceRuntimeException(e); + } + + // No return on a OneWay invocation. + return messageFactory.createMessage(); + } + + public void setNext(Interceptor next) { + this.next=next; + } + + private static class ContextBinder extends SCA { + public void setContext(ModuleContext context) { + setModuleContext(context); + } + + public void start() { + throw new AssertionError(); + } + + public void stop() { + throw new AssertionError(); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/work/DefaultWorkManager.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/work/DefaultWorkManager.java new file mode 100644 index 0000000000..866e101b0e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/async/work/DefaultWorkManager.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.async.work; + +import javax.resource.spi.work.WorkManager; + +import org.apache.geronimo.connector.work.GeronimoWorkManager; +import org.apache.geronimo.transaction.context.TransactionContextManager; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * A Work Manager service component implementation which just reuses the Geronimo WorkManager. + * + * @version $Rev$ $Date$ + */ +@Service(WorkManager.class) +@Scope("MODULE") +public class DefaultWorkManager extends GeronimoWorkManager implements WorkManager { + + private final static int DEFAULT_POOL_SIZE = 10; + + @Property + public int scheduledMaximumPoolSize; + + /** + * Constructs a new instance. + */ + public DefaultWorkManager() { + super(DEFAULT_POOL_SIZE, new TransactionContextManager()); + } + + @Init(eager=true) + public void init() throws Exception { + doStart(); + } + + @Destroy + public void destroy() throws Exception { + doStop(); + } + + public void setScheduledMaximumPoolSize(int maxSize) { + super.setScheduledMaximumPoolSize(maxSize); + } + + public int getScheduledMaximumPoolSize() { + return super.getScheduledMaximumPoolSize(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderConfigException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderConfigException.java new file mode 100644 index 0000000000..c2402d9141 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderConfigException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder; + +/** + * Represents an error processing an assembly model + * + * @version $Rev$ $Date$ + */ +public class BuilderConfigException extends BuilderException { + + public BuilderConfigException() { + super(); + } + + public BuilderConfigException(String message) { + super(message); + } + + public BuilderConfigException(String message, Throwable cause) { + super(message, cause); + } + + public BuilderConfigException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderException.java new file mode 100644 index 0000000000..246f188988 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderException.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.core.context.CoreRuntimeException; + +/** + * The root exception for the builder package. Builder exceptions denote a non-recoverable failure. + * + * @version $Rev$ $Date$ + */ +public abstract class BuilderException extends CoreRuntimeException { + + public BuilderException() { + super(); + } + + public BuilderException(String message) { + super(message); + } + + public BuilderException(String message, Throwable cause) { + super(message, cause); + } + + public BuilderException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderInitException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderInitException.java new file mode 100644 index 0000000000..cd57eaf7ab --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderInitException.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +/** + * Denotes an exception initializing a builder + * + * @version $Rev$ $Date$ + */ +public class BuilderInitException extends BuilderException { + + public BuilderInitException() { + super(); + } + + public BuilderInitException(String message, Throwable cause) { + super(message, cause); + } + + public BuilderInitException(String message) { + super(message); + } + + public BuilderInitException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextCreationException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextCreationException.java new file mode 100644 index 0000000000..24b526371d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextCreationException.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + + +/** + * Denotes an exception creating an instance context + * + * @version $Rev$ $Date$ + */ +public class ContextCreationException extends BuilderException { + + public ContextCreationException() { + super(); + } + + public ContextCreationException(String message) { + super(message); + } + + public ContextCreationException(String message, Throwable cause) { + super(message, cause); + } + + public ContextCreationException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactory.java new file mode 100644 index 0000000000..ccef8024e8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactory.java @@ -0,0 +1,123 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.List; +import java.util.Map; + +/** + * Implementations create {@link org.apache.tuscany.core.context.Context}s based on an assembly configuration. + *

+ * Context factories are "built" in two phases. {@link ContextFactoryBuilder}s analyze an assembly, producing + * ContextFactorys for {@link org.apache.tuscany.model.assembly.Component}s, {@link + * org.apache.tuscany.model.assembly.EntryPoint}s, and {@link org.apache.tuscany.model.assembly.ExternalService}s. During this + * phase, {@link org.apache.tuscany.core.wire.WireFactory}s for source- and target-side wires are produced for the + * ContextFactorys. Ê + *

+ * The second build phase connects the source- and target-side WireFactories, thereby completing wire configuration. + *

+ * At runtime, ContextFactorys are called to create new Contexts when a new implementation instance is + * required for a component, entry point, or external service. The Context is then responsible for instantiating and + * managing the actual implementation instance. When a Context creates a new instance, the previously configured + * WireFactorys are used to create wires to and from the instance. A wire is a collection of stateless invocation + * chains that are managed by the Context's ContextFactory. + * + * @version $Rev: 385747 $ $Date: 2006-03-13 22:12:53 -0800 (Mon, 13 Mar 2006) $ + */ +public interface ContextFactory { + + /** + * Creates a Context based on configuration supplied by a logical model assembly + * + * @return a new instance context + * @throws ContextCreationException if an error occurs creating the context + */ + public T createContext() throws ContextCreationException; + + /** + * Returns the scope identifier associated with the type of contexts produced by the current factory + */ + public Scope getScope(); + + /** + * Returns the name of the Context produced by the current factory + */ + public String getName(); + + /** + * Adds a property to the context + */ + public void addProperty(String propertyName, Object value); + + /** + * Adds a target-side wire factory for the given service name. Target-side wire factories contain the invocation chains + * associated with the destination service of a wire and are responsible for generating proxies + */ + public void addTargetWireFactory(String serviceName, TargetWireFactory factory); + + /** + * Returns the target-side wire factory associated with the given service name + */ + public TargetWireFactory getTargetWireFactory(String serviceName); + + /** + * Returns a collection of target-side wire factories keyed by service name + */ + public Map getTargetWireFactories(); + + /** + * Adds a source-side wire factory for the given reference. Source-side wire factories contain the invocation chains for a + * reference in the implementation associated with the instance context created by this configuration. Source-side wire + * factories also produce proxies that are injected on a reference in a component implementation. + * + * @param referenceName + * @param factory + */ + public void addSourceWireFactory(String referenceName, SourceWireFactory factory); + + /** + * Adds a set of source-side wire factories for the given reference. Source-side wire factories contain the invocation chains + * for a reference in the implementation associated with the instance context created by this configuration. Source-side wire + * factories also produce proxies that are injected on a reference in a component implementation. + * + * @param referenceName + * @param referenceInterface + * @param factory + * @param multiplicity + */ + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity); + + /** + * Returns a collection of source-side wire factories for references. There may 1..n wire factories per reference. + */ + public List getSourceWireFactories(); + + /** + * Called to signal to the configuration that its parent context has been activated and that it shoud perform any required + * initialization steps + * + * @param parent the parent context + */ + public void prepare(CompositeContext parent); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilder.java new file mode 100644 index 0000000000..786298809e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilder.java @@ -0,0 +1,50 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.model.assembly.AssemblyObject; + +/** + * The extension point for component types in the runtime. Implementations perform the first phase of converting an assembly model + * into a series of runtime artifacts. Specifically, ContextFactoryBuilders are responsible for analyzing the + * assembly model and producing {@link ContextFactory}s that are used to generate executable artifacts such as an {@link + * org.apache.tuscany.core.context.Context}. In the case of components, the ContextFactory will typically contain + * configuration for instantiating implementation instances with injected properties and references. + *

+ * As the assembly model is analyzed, ContextFactoryBuilders are guaranteed to be called first and are expected to + * decorate the assembly model with ContextFactorys. + *

+ * The second phase uses {@link WireBuilder}s to connect the source and target wire chains held in these + * ContextFactorys to form a completed wire. WireBuilders may use a similar delegation strategy and + * perform various optimizations. + * + * @version $Rev$ $Date$ + * @see ContextFactory + * @see WireBuilder + */ +public interface ContextFactoryBuilder { + + /** + * Creates or updates a context factory based on configuration contained in the given model object. The model object is + * decorated with the factory. + * + * @param object the logical configuration model node + * @throws BuilderException + */ + public void build(AssemblyObject object) throws BuilderException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilderRegistry.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilderRegistry.java new file mode 100644 index 0000000000..a002627c2e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilderRegistry.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder; + +/** + * System wide registry for ContextFactoryBuilder implementations. + * + * @version $Rev$ $Date$ + */ +public interface ContextFactoryBuilderRegistry { + /** + * Register a builder. Called by extensions to register their builders. + * + * @param builder the builder to register + */ + void register(ContextFactoryBuilder builder); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextResolver.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextResolver.java new file mode 100644 index 0000000000..5c99d6dd43 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextResolver.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.core.context.CompositeContext; + +/** + * Implementations are responsible for resolving the current composite context + * + * @version $Rev$ $Date$ + */ +public interface ContextResolver { + + /** + * Returns the current composite context + */ + CompositeContext getCurrentContext(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/HierarchicalWireBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/HierarchicalWireBuilder.java new file mode 100644 index 0000000000..ace34a1ad5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/HierarchicalWireBuilder.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +/** + * A wire builder that delegates to child wire builders + * + * @version $Rev$ $Date$ + */ +public interface HierarchicalWireBuilder extends WireBuilder{ + + /** + * Registers a child wire builder + */ + public void addWireBuilder(WireBuilder builder); + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/NoAccessorException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/NoAccessorException.java new file mode 100644 index 0000000000..34b6294638 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/NoAccessorException.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +/** + * Denotes an attempt to access a non-existent field or method + * + * @version $Rev$ $Date$ + */ +public class NoAccessorException extends BuilderException { + + public NoAccessorException() { + super(); + } + + public NoAccessorException(String message) { + super(message); + } + + public NoAccessorException(String message, Throwable cause) { + super(message, cause); + } + + public NoAccessorException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ObjectFactory.java new file mode 100644 index 0000000000..ab2cfd9bac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ObjectFactory.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.core.injection.ObjectCreationException; + +/** + * Implementations create new instances of a particular type + * + * @version $Rev$ $Date$ + */ +public interface ObjectFactory { + + /** + * Return a instance of the type that this factory creates. + * + * @return a instance from this factory + */ + T getInstance() throws ObjectCreationException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyBuilder.java new file mode 100644 index 0000000000..489541a213 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyBuilder.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +/** + * A marker for policy extensions in the runtime. Implementations evaluate wire-related policy metadata on a {@link + * org.apache.tuscany.model.assembly.ConfiguredReference} or {@link org.apache.tuscany.model.assembly.ConfiguredService} and + * contribute {@link org.apache.tuscany.core.wire.Interceptor}s or {@link org.apache.tuscany.core.wire.MessageHandler}s + * implementing a policy to {@link org.apache.tuscany.core.wire.InvocationConfiguration}s that are part of a {@link + * org.apache.tuscany.core.wire.WireConfiguration}. The contributed Interceptors or Handlers will be + * called as part of an invocation over a wire. + * + * @version $$Rev$$ $$Date$$ + */ +public interface PolicyBuilder { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyOrderer.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyOrderer.java new file mode 100644 index 0000000000..1038b6e878 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyOrderer.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +/** + * A marker for implementations that order source- or target-side policy {@link org.apache.tuscany.core.wire.Interceptor}s or + * {@link org.apache.tuscany.core.wire.MessageHandler}s in a {@link org.apache.tuscany.core.wire.WireConfiguration}. + * + * @see SourcePolicyOrderer + * @see TargetPolicyOrderer + * @version $$Rev$$ $$Date$$ + */ +public interface PolicyOrderer { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyBuilder.java new file mode 100644 index 0000000000..76a376e3d5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyBuilder.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.model.assembly.ConfiguredReference; + +import java.util.List; + +/** + * Implementations contribute {@link org.apache.tuscany.core.wire.Interceptor}s or {@link + * org.apache.tuscany.core.wire.MessageHandler}s that handle source-side policy on a wire. + * + * @version $$Rev$$ $$Date$$ + */ +public interface SourcePolicyBuilder extends PolicyBuilder { + + public void build(ConfiguredReference reference, List configurations) throws BuilderException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyOrderer.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyOrderer.java new file mode 100644 index 0000000000..6bc3bcda6e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyOrderer.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.core.wire.WireSourceConfiguration; + +/** + * Implementations order source-side policy {@link org.apache.tuscany.core.wire.Interceptor}s or + * {@link org.apache.tuscany.core.wire.MessageHandler}s in a {@link org.apache.tuscany.core.wire.WireConfiguration}. + * + * @version $$Rev$$ $$Date$$ + */ +public interface SourcePolicyOrderer extends PolicyOrderer{ + + public void order(WireSourceConfiguration configuration); + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyBuilder.java new file mode 100644 index 0000000000..10c34751e2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyBuilder.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.core.wire.WireTargetConfiguration; + +/** + * Implementations contribute {@link org.apache.tuscany.core.wire.Interceptor}s or {@link + * org.apache.tuscany.core.wire.MessageHandler}s that handle target-side policy on a wire. + * + * @version $$Rev$$ $$Date$$ + */ +public interface TargetPolicyBuilder extends PolicyBuilder{ + + public void build(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyOrderer.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyOrderer.java new file mode 100644 index 0000000000..4b596bfdc1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyOrderer.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.core.wire.WireTargetConfiguration; + +/** + * Implementation order target-side policy {@link org.apache.tuscany.core.wire.Interceptor}s or + * {@link org.apache.tuscany.core.wire.MessageHandler}s in a {@link org.apache.tuscany.core.wire.WireConfiguration}. + + * @version $$Rev$$ $$Date$$ + */ +public interface TargetPolicyOrderer { + + public void order(WireTargetConfiguration configuration); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/UnknownTypeException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/UnknownTypeException.java new file mode 100644 index 0000000000..24c1fa24ff --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/UnknownTypeException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder; + +/** + * Denotes an unknown configuration parameter type + * + * @version $Rev$ $Date$ + */ +public class UnknownTypeException extends BuilderException { + + public UnknownTypeException() { + super(); + } + + public UnknownTypeException(String message) { + super(message); + } + + public UnknownTypeException(String message, Throwable cause) { + super(message, cause); + } + + public UnknownTypeException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java new file mode 100644 index 0000000000..54f2ff4b4e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java @@ -0,0 +1,71 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder; + +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; + +/** + * Implementations perform the second phase of converting a logical model representing an assembly into a series of + * runtime or executable artifacts. Specifically, they are responsible for finalizing target-side proxy factories and + * bridging {@link org.apache.tuscany.core.wire.InvocationConfiguration}s held by source- and target-side proxy + * factories. WireBuilders generally operate by target implementation type. In other words, for a wire + * from a Java source to a JavaScript target, the Javascript WireBuilder will complete the wire. This is + * necessary as a WireBuilder must set a {@link org.apache.tuscany.core.wire.TargetInvoker} that is + * responsible for dispatching to an implementation on the source side of the wire. + *

+ * Runtimes are generally configured with a {@link org.apache.tuscany.core.builder.impl.DefaultWireBuilder} as a + * top-most wire builder, which delegates to other builders wired to it as part of a system configuration. + *

+ * Wire builders may optimize the wire chains based on certain characteristics of th wire, such as source and + * target scopes. + * + * @see org.apache.tuscany.core.builder.ContextFactoryBuilder + * @see org.apache.tuscany.core.builder.impl.DefaultWireBuilder + * @version $Rev$ $Date$ + */ +public interface WireBuilder { + + /** + * Connects wire configurations of the source proxy factory to corresponding ones in the target proxy to + * factory + * + * @param sourceFactory the proxy factory used in constructing the source side of the wire chain + * @param targetFactory the proxy factory used in constructing the target side of the wire chain + * @param targetType the context type of the target. Used to determine if a paricular wire builder should construct + * the wire + * @param downScope true if the component containing the reference (source side) is of a lesser scope than the + * target service + * @param targetScopeContext the scope context responsible for managing intance contexts of the target component + * type + * @throws BuilderConfigException if an error occurs during the wire buildSource process + */ + public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, + ScopeContext targetScopeContext) throws BuilderConfigException; + + /** + * Finishes processing the target side wire chain. For example, a + * {@link org.apache.tuscany.core.wire.TargetInvoker} used by target-side proxies is usually set during this + * phase. + * + * @param targetFactory the target-side proxy factory + * @param targetType the target context type + * @param targetScopeContext the target scope + * @throws BuilderConfigException if an error occurs during the wire buildSource process + */ + public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) + throws BuilderConfigException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ArrayMultiplicityObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ArrayMultiplicityObjectFactory.java new file mode 100644 index 0000000000..8f0cbbf91b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ArrayMultiplicityObjectFactory.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder.impl; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.injection.ObjectCreationException; + +import java.lang.reflect.Array; +import java.util.List; + +/** + * Resolves targets configured in a multiplicity by delegating to object factories and returning an + * Array containing object instances + * + * @version $Rev$ $Date$ + */ +public class ArrayMultiplicityObjectFactory implements ObjectFactory { + + private ObjectFactory[] factories; + + private Class interfaceType; + + public ArrayMultiplicityObjectFactory(Class interfaceType, List factories) { + assert (interfaceType != null) : "Interface type was null"; + assert (factories != null) : "Object factories were null"; + this.interfaceType = interfaceType; + this.factories = factories.toArray(new ObjectFactory[factories.size()]); + } + + public Object getInstance() throws ObjectCreationException { + Object array = Array.newInstance(interfaceType, factories.length); + for (int i = 0; i < factories.length; i++) { + Array.set(array, i, factories[i].getInstance()); + } + return array; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/AssemblyVisitorImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/AssemblyVisitorImpl.java new file mode 100644 index 0000000000..178d3d4de6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/AssemblyVisitorImpl.java @@ -0,0 +1,63 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder.impl; + +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.ContextFactoryHolder; + +import java.util.List; + +/** + * Decorates an assembly object graph with runtime configurations using a set of builders + * + * @version $Rev: 392146 $ $Date: 2006-04-06 18:11:28 -0700 (Thu, 06 Apr 2006) $ + */ +public class AssemblyVisitorImpl implements AssemblyVisitor { + + private List builders; + + /** + * Constructs a visitor + * + * @param builders the collection of builders for creating context factories + */ + public AssemblyVisitorImpl(List builders) { + this.builders = builders; + } + + /** + * Initiate walking the object graph + */ + public boolean start(AssemblyObject modelObject) { + return modelObject.accept(this); + } + + /** + * Callback when walking the graph + */ + public boolean visit(AssemblyObject modelObject) { + if (modelObject instanceof ContextFactoryHolder){ + if (((ContextFactoryHolder)modelObject).getContextFactory() != null){ + return true; // HACK FIX for TUSCANY 249 + } + } + for (ContextFactoryBuilder builder : builders) { + builder.build(modelObject); + } + return true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ContextFactoryBuilderRegistryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ContextFactoryBuilderRegistryImpl.java new file mode 100644 index 0000000000..d500b2e503 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ContextFactoryBuilderRegistryImpl.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; + +/** + * @version $Rev$ $Date$ + */ +public class ContextFactoryBuilderRegistryImpl implements ContextFactoryBuilderRegistry { + + private final List builders = new ArrayList(); + + public void register(ContextFactoryBuilder builder) { + builders.add(builder); + } + + public List getBuilders() { + return builders; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilder.java new file mode 100644 index 0000000000..5243c2a8cd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilder.java @@ -0,0 +1,111 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder.impl; + +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.HierarchicalWireBuilder; +import org.apache.tuscany.core.builder.WireBuilder; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.impl.InvokerInterceptor; +import org.apache.tuscany.core.wire.impl.MessageChannelImpl; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * The top-most WireBuilder configured in a runtime. Responsible for constructing wires from source and target chains, + * this implementation first bridges the chains and then delegates to any other wire builders. + * + * @version $Rev$ $Date$ + */ +public class DefaultWireBuilder implements HierarchicalWireBuilder { + + // collection configured wire builders + private List builders = new ArrayList(); + + public DefaultWireBuilder() { + } + + /** + * Adds a wire builder to delegate to + */ + public void addWireBuilder(WireBuilder builder) { + builders.add(builder); + } + + public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, + ScopeContext targetScopeContext) { + // get the proxy chain for the target + if (targetFactory != null) { + // if null, the target side has no interceptors or handlers + Map targetInvocationConfigs = targetFactory.getConfiguration().getInvocationConfigurations(); + for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration() + .getInvocationConfigurations().values()) { + // match wire chains + TargetInvocationConfiguration targetInvocationConfig = targetInvocationConfigs.get(sourceInvocationConfig.getMethod()); + if (targetInvocationConfig == null){ + BuilderConfigException e= new BuilderConfigException("Incompatible source and target interface types for reference"); + //FIXME xcv + e.setIdentifier(sourceFactory.getConfiguration().getReferenceName()); + throw e; + } + // if handler is configured, add that + if (targetInvocationConfig.getRequestHandlers() != null) { + sourceInvocationConfig.setTargetRequestChannel(new MessageChannelImpl(targetInvocationConfig + .getRequestHandlers())); + sourceInvocationConfig.setTargetResponseChannel(new MessageChannelImpl(targetInvocationConfig + .getResponseHandlers())); + } else { + // no handlers, just connect interceptors + if (targetInvocationConfig.getHeadInterceptor() == null) { + BuilderConfigException e = new BuilderConfigException("No target handler or interceptor for operation"); + e.setIdentifier(targetInvocationConfig.getMethod().getName()); + throw e; + } + //xcv if (!(sourceInvocationConfig.getLastTargetInterceptor() instanceof InvokerInterceptor && targetInvocationConfig + if (!(sourceInvocationConfig.getTailInterceptor() instanceof InvokerInterceptor && targetInvocationConfig + .getHeadInterceptor() instanceof InvokerInterceptor)) { + // check that we do not have the case where the only interceptors are invokers since we just need one + sourceInvocationConfig.setTargetInterceptor(targetInvocationConfig.getHeadInterceptor()); + } + } + } + } + // delegate to other wire builders + for (WireBuilder builder : builders) { + builder.connect(sourceFactory, targetFactory, targetType, downScope, targetScopeContext); + } + // signal that wire buildSource process is complete + for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration().getInvocationConfigurations() + .values()) { + sourceInvocationConfig.build(); + // TODO optimize if no proxy needed using NullWireFactory + } + } + + public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) + throws BuilderConfigException { + // delegate to other wire builders + for (WireBuilder builder : builders) { + builder.completeTargetChain(targetFactory, targetType, targetScopeContext); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/HierarchicalBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/HierarchicalBuilder.java new file mode 100644 index 0000000000..ffab32bd37 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/HierarchicalBuilder.java @@ -0,0 +1,57 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder.impl; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.model.assembly.AssemblyObject; + +import java.util.Collections; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +/** + * A builder that contains nested builders. Used for synchronizing parts of the buildSource process, such as references. + * + * @version $Rev$ $Date$ + */ +public class HierarchicalBuilder implements ContextFactoryBuilder { + private List builders = new CopyOnWriteArrayList(); + + private List readOnlyBuilders = Collections.unmodifiableList(builders); + + public HierarchicalBuilder() { + } + + public void addBuilder(ContextFactoryBuilder builder) { + builders.add(builder); + } + + public void removeBuilder(ContextFactoryBuilder builder){ + builders.remove(builder); + } + + public List getBuilders(){ + return readOnlyBuilders; + } + + public void build(AssemblyObject object) throws BuilderException { + for (ContextFactoryBuilder builder : builders) { + builder.build(object); + } + + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ListMultiplicityObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ListMultiplicityObjectFactory.java new file mode 100644 index 0000000000..5d37eb8e89 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ListMultiplicityObjectFactory.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder.impl; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.injection.ObjectCreationException; + +import java.util.ArrayList; +import java.util.List; + +/** + * Resolves targets configured in a multiplicity by delegating to object factories and returning an + * List containing object instances + * + * @version $Rev$ $Date$ + */ +public class ListMultiplicityObjectFactory implements ObjectFactory { + + private ObjectFactory[] factories; + + public ListMultiplicityObjectFactory(List factories) { + assert (factories != null) : "Object factories were null"; + this.factories = factories.toArray(new ObjectFactory[factories.size()]); + } + + public List getInstance() throws ObjectCreationException { + List list = new ArrayList(); + for (ObjectFactory factory : factories) { + list.add(factory.getInstance()); + } + return list; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ProxyObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ProxyObjectFactory.java new file mode 100644 index 0000000000..1dc6627306 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ProxyObjectFactory.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder.impl; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.injection.ObjectCreationException; +import org.apache.tuscany.core.wire.ProxyCreationException; +import org.apache.tuscany.core.wire.WireFactory; + +/** + * Uses a proxy factory to return an object instance + * + * @version $Rev$ $Date$ + */ +public class ProxyObjectFactory implements ObjectFactory { + + private WireFactory factory; + + public ProxyObjectFactory(WireFactory factory) { + this.factory = factory; + } + + public Object getInstance() throws ObjectCreationException { + try { + return factory.createProxy(); + } catch (ProxyCreationException e) { + throw new ObjectCreationException(e); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/DefaultPolicyBuilderRegistry.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/DefaultPolicyBuilderRegistry.java new file mode 100644 index 0000000000..4c53a2c830 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/DefaultPolicyBuilderRegistry.java @@ -0,0 +1,102 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.builder.system; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.SourcePolicyBuilder; +import org.apache.tuscany.core.builder.SourcePolicyOrderer; +import org.apache.tuscany.core.builder.TargetPolicyBuilder; +import org.apache.tuscany.core.builder.TargetPolicyOrderer; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * A system service that serves as the default implementation of a policy builder registry + * + * @version $$Rev$$ $$Date$$ + */ + +@Scope("MODULE") +@Service(interfaces = {PolicyBuilderRegistry.class}) +public class DefaultPolicyBuilderRegistry implements PolicyBuilderRegistry { + + private final List sourceBuilders = new ArrayList(); + private final List targetBuilders = new ArrayList(); + + private TargetPolicyOrderer targetOrderer; + + private SourcePolicyOrderer sourceOrderer; + + @Autowire + public void setTargetOrderer(TargetPolicyOrderer orderer) { + this.targetOrderer = orderer; + } + + @Autowire + public void setSourceOrderer(SourcePolicyOrderer orderer) { + this.sourceOrderer = orderer; + } + + public void registerTargetBuilder(TargetPolicyBuilder builder) { + targetBuilders.add(builder); + } + + public void unregisterTargetBuilder(TargetPolicyBuilder builder) { + targetBuilders.remove(builder); + } + + public void registerSourceBuilder(SourcePolicyBuilder builder) { + sourceBuilders.add(builder); + } + + public void unregisterSourceBuilder(SourcePolicyBuilder builder) { + sourceBuilders.remove(builder); + } + + public List getTargetBuilders() { + return targetBuilders; + } + + public List getSourceBuilders() { + return sourceBuilders; + } + + public void buildSource(ConfiguredReference reference, List configurations) throws BuilderException { + for (SourcePolicyBuilder builder : sourceBuilders) { + builder.build(reference, configurations); + } + if (sourceOrderer != null) { + for (WireSourceConfiguration configuration : configurations) { + sourceOrderer.order(configuration); + } + } + } + + public void buildTarget(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException { + for (TargetPolicyBuilder builder : targetBuilders) { + builder.build(service, configuration); + } + if (targetOrderer != null) { + targetOrderer.order(configuration); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/PolicyBuilderRegistry.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/PolicyBuilderRegistry.java new file mode 100644 index 0000000000..fb9b0b25db --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/PolicyBuilderRegistry.java @@ -0,0 +1,92 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder.system; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.SourcePolicyBuilder; +import org.apache.tuscany.core.builder.TargetPolicyBuilder; +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; + +import java.util.List; + +/** + * A System registry for {@link org.apache.tuscany.core.builder.PolicyBuilder}s. PolicyBuilders will be invoked when + * a {@link org.apache.tuscany.core.wire.WireFactory} is constructed by the {@link org.apache.tuscany.core.wire.WireFactory} + * service. + *

+ * PolicyBuilders operate on either a source- or target-side wire and typically are registered by runtime extensions + * through {@link #registerTargetBuilder} or {@link #registerSourceBuilder} + * + * @version $Rev$ $Date$ + */ +public interface PolicyBuilderRegistry { + + /** + * Registers a target-side policy builder. Called by extensions to register their builders. + * + * @param builder the builder to register + */ + public void registerTargetBuilder(TargetPolicyBuilder builder); + + /** + * De-registers a target-side builder. Called by extensions to register their builders. + * + * @param builder the builder to register + */ + public void unregisterTargetBuilder(TargetPolicyBuilder builder); + + /** + * Registers a source-side policy builder. Called by extensions to register their builders. + * + * @param builder the builder to register + */ + public void registerSourceBuilder(SourcePolicyBuilder builder); + + /** + * De-registers a source-side builder. Called by extensions to register their builders. + * + * @param builder the builder to register + */ + public void unregisterSourceBuilder(SourcePolicyBuilder builder); + + /** + * Returns the list of registered target-side builders + */ + public List getTargetBuilders(); + + /** + * Returns the list of registered source-side builders + */ + public List getSourceBuilders(); + + /** + * Evaluates source-side policy metadata for configured reference and updates the curresponding collection of wire configurations + * + * @throws BuilderException + */ + public void buildSource(ConfiguredReference reference, List configurations) throws BuilderException; + + /** + * Evaluates target-side policy metadata for configured reference and updates the curresponding collection of wire configurations + * + * @throws BuilderException + */ + public void buildTarget(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/client/BootstrapHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/client/BootstrapHelper.java new file mode 100644 index 0000000000..556b0991f7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/client/BootstrapHelper.java @@ -0,0 +1,138 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.client; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.stream.XMLInputFactory; + +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.impl.ContextFactoryBuilderRegistryImpl; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; +import org.apache.tuscany.core.config.impl.StAXModuleComponentConfigurationLoaderImpl; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.core.loader.StAXUtil; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.core.system.builder.SystemContextFactoryBuilder; +import org.apache.tuscany.core.system.builder.SystemEntryPointBuilder; +import org.apache.tuscany.core.system.builder.SystemExternalServiceBuilder; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; +import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; +import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl; + +/** + * @version $Rev$ $Date$ + */ +public final class BootstrapHelper { + private BootstrapHelper() { + } + + /** + * Returns a default AssemblyModelContext. + * + * @param classLoader the classloader to use for application artifacts + * @return a default AssemblyModelContext + */ + public static AssemblyContext getModelContext(ClassLoader classLoader) { + // Create an assembly model factory + AssemblyFactory modelFactory = new SystemAssemblyFactoryImpl(); + + // Create a default assembly model loader + AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl(); + + // Create a resource loader from the supplied classloader + ResourceLoader resourceLoader = new ResourceLoaderImpl(classLoader); + + // Create an assembly model context + return new AssemblyContextImpl(modelFactory, modelLoader, resourceLoader); + } + + /** + * Returns a default list of configuration builders. + * + * @param monitorFactory + * @return a default list of configuration builders + */ + public static List getBuilders(MonitorFactory monitorFactory) { + List configBuilders = new ArrayList(); + configBuilders.add((new SystemContextFactoryBuilder(monitorFactory))); + configBuilders.add(new SystemEntryPointBuilder()); + configBuilders.add(new SystemExternalServiceBuilder()); + return configBuilders; + } + + /** + * Returns a ContextFactoryBuilderRegistry with default builders registered for system contexts. + * + * @param monitorFactory a monitorFactory that will be used to obtain monitors for system components + * @return a default ContextFactoryBuilderRegistry + */ + public static ContextFactoryBuilderRegistry bootstrapContextFactoryBuilders(MonitorFactory monitorFactory) { + ContextFactoryBuilderRegistryImpl registry = new ContextFactoryBuilderRegistryImpl(); + registry.register(new SystemContextFactoryBuilder(monitorFactory)); + registry.register(new SystemEntryPointBuilder()); + registry.register(new SystemExternalServiceBuilder()); + return registry; + } + + public static final String SYSTEM_LOADER_COMPONENT = "tuscany.loader"; + + /** + * Returns the default module configuration loader. + * + * @param systemContext the runtime's system context + * @param modelContext the model context the loader will use + * @return the default module configuration loader + */ + public static ModuleComponentConfigurationLoader getConfigurationLoader(SystemCompositeContext systemContext, AssemblyContext modelContext) { + return new StAXModuleComponentConfigurationLoaderImpl(modelContext, XMLInputFactory.newInstance(), systemContext.resolveInstance(StAXLoaderRegistry.class)); + } + + /** + * Bootstrap the StAX-based loader. + * + * @param parentContext the parent system context + * @param modelContext + * @return the system context for the loader + * @throws ConfigurationException + */ + public static CompositeContext bootstrapStaxLoader(SystemCompositeContext parentContext, AssemblyContext modelContext) throws ConfigurationException { + ModuleComponent loaderComponent = StAXUtil.bootstrapLoader(SYSTEM_LOADER_COMPONENT, modelContext); + CompositeContext loaderContext = registerModule(parentContext, loaderComponent); + loaderContext.publish(new ModuleStart(loaderComponent)); + return loaderContext; + } + + public static CompositeContext registerModule(CompositeContext parent, ModuleComponent component) throws ConfigurationException { + // register the component + parent.registerModelObject(component); + + // Get the composite context representing the component + return (CompositeContext) parent.getContext(component.getName()); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java new file mode 100644 index 0000000000..fe78cd712a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java @@ -0,0 +1,182 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.client; + +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; +import org.osoa.sca.ServiceRuntimeException; + +import org.apache.tuscany.common.monitor.LogLevel; +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.event.HttpSessionBound; +import org.apache.tuscany.core.context.event.HttpSessionEnd; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.event.RequestStart; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.runtime.RuntimeContextImpl; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.ModuleComponent; + +/** + * Create and initialize a Tuscany SCA runtime environment. + * + * @version $Rev$ $Date$ + */ +public class TuscanyRuntime extends SCA { + private final Monitor monitor; + private final Object sessionKey = new Object(); + + private final RuntimeContext runtime; + private final CompositeContext moduleContext; + + private static final String SYSTEM_MODULE_COMPONENT = "org.apache.tuscany.core.system"; + + /** + * Construct a runtime using a null MonitorFactory. + * + * @param name the name of the module component + * @param uri the URI to assign to the module component + * @throws ConfigurationException if there was a problem loading the SCA configuration + * @see TuscanyRuntime#TuscanyRuntime(String, String, org.apache.tuscany.common.monitor.MonitorFactory) + */ + public TuscanyRuntime(String name, String uri) throws ConfigurationException { + this(name, uri, new NullMonitorFactory()); + } + + /** + * Construct a runtime containing a single module component with the + * specified name. The module definition is loaded from a "/sca.module" + * resource found on the classpath of the current Thread context classloader. + * + * @param name the name of the module component + * @param uri the URI to assign to the module component + * @param monitorFactory the MonitorFactory for this runtime + * @throws ConfigurationException if there was a problem loading the SCA configuration + */ + public TuscanyRuntime(String name, String uri, MonitorFactory monitorFactory) throws ConfigurationException { + assert(monitorFactory != null): "monitor factory was null"; + this.monitor = monitorFactory.getMonitor(Monitor.class); + + // Create an assembly model context + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + AssemblyContext modelContext = BootstrapHelper.getModelContext(classLoader); + + // Create a runtime context and start it + ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); + runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, new DefaultWireBuilder()); + runtime.start(); + + // Load and start the system configuration + SystemCompositeContext systemContext = runtime.getSystemContext(); + BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext); + ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext); + ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT); + CompositeContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent); + context.publish(new ModuleStart(this)); + + // Load the SCDL configuration of the application module + CompositeContext rootContext = runtime.getRootContext(); + ModuleComponent moduleComponent = loader.loadModuleComponent(name, uri); + moduleContext = BootstrapHelper.registerModule(rootContext, moduleComponent); + if (moduleContext.getURI() == null){ + moduleContext.setURI(uri); + } + //TODO remove hack + moduleContext.setAssemblyContext(modelContext); + } + + /** + * Start the runtime and associate the module context with the calling thread. + */ + @Override + public void start() { + setModuleContext((ModuleContext) moduleContext); + try { + //moduleContext.start(); + moduleContext.publish(new ModuleStart(this)); + moduleContext.publish(new RequestStart(this, new Object())); + moduleContext.publish(new HttpSessionBound(this, sessionKey)); + monitor.moduleStarted(moduleContext.getName()); + } catch (CoreRuntimeException e) { + setModuleContext(null); + monitor.moduleStartFailed(moduleContext.getName(), e); + //FIXME throw a better exception + throw new ServiceRuntimeException(e); + } + } + + /** + * Disassociate the module context from the current thread and shut down the runtime. + */ + @Override + public void stop() { + setModuleContext(null); + moduleContext.publish(new RequestEnd(this, new Object())); + moduleContext.publish(new HttpSessionEnd(this, sessionKey)); + moduleContext.publish(new ModuleStop(this)); + moduleContext.stop(); + monitor.moduleStopped(moduleContext.getName()); + } + + /** + * Shut down the Tuscany runtime. + */ + public void shutdown() { + runtime.getSystemContext().publish(new ModuleStop(this)); + runtime.stop(); + } + + /** + * Monitor interface for a TuscanyRuntime. + */ + public static interface Monitor { + /** + * Event emitted after an application module has been started. + * + * @param name the name of the application module + */ + @LogLevel("INFO") + void moduleStarted(String name); + + /** + * Event emitted when an attempt to start an application module failed. + * + * @param name the name of the application module + * @param e the exception that caused the failure + */ + @LogLevel("SEVERE") + void moduleStartFailed(String name, CoreRuntimeException e); + + /** + * Event emitted after an application module has been stopped. + * + * @param name the name of the application module + */ + @LogLevel("INFO") + void moduleStopped(String name); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ComponentTypeIntrospector.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ComponentTypeIntrospector.java new file mode 100644 index 0000000000..9f9c125a5e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ComponentTypeIntrospector.java @@ -0,0 +1,57 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.core.extension.config.ImplementationProcessor; + +/** + * Interface for implementations that are able create SCA definitions by inspecting Java classes. + * + * @version $Rev$ $Date$ + */ +public interface ComponentTypeIntrospector { + + /** + * Create a componentType definition by introspecting a Java Class. + * + * @param implClass the class to inspect + * @return a componentType definition + * @throws ConfigurationLoadException if the Class does not define a valid component type + */ + ComponentType introspect(Class implClass) throws ConfigurationLoadException; + + /** + * Completes the given componentType definition by introspecting a Java Class. + * + * @param implClass the class to inspect + * @return a componentType definition + * @throws ConfigurationLoadException if the Class does not define a valid component type + */ + ComponentType introspect(Class implClass, ComponentType compType) throws ConfigurationLoadException; + + /** + * Registers an annotation processor + */ + void registerProcessor(ImplementationProcessor processor); + + /** + * De-registers an annotation processor + */ + void unregisterProcessor(ImplementationProcessor processor); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationException.java new file mode 100644 index 0000000000..de0e4a3733 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationException.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +import org.apache.tuscany.common.TuscanyException; + + +/** + * Base class for exceptions that pertain to configuration. + * + * @version $Rev$ $Date$ + */ +public abstract class ConfigurationException extends TuscanyException { + private static final long serialVersionUID = 7441469809266868036L; + + public ConfigurationException() { + } + + public ConfigurationException(String message) { + super(message); + } + + public ConfigurationException(String message, Throwable cause) { + super(message, cause); + } + + public ConfigurationException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationLoadException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationLoadException.java new file mode 100644 index 0000000000..2a9e325b0b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ConfigurationLoadException.java @@ -0,0 +1,59 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +/** + * Exception indicating that there was a problem loading a configuration resource. + * + * @version $Rev$ $Date$ + */ +public class ConfigurationLoadException extends ConfigurationException { + private static final long serialVersionUID = -2310798146091959144L; + + private String resourceURI; + + public ConfigurationLoadException() { + } + + public ConfigurationLoadException(String message) { + super(message); + } + + public ConfigurationLoadException(String message, Throwable cause) { + super(message, cause); + } + + public ConfigurationLoadException(Throwable cause) { + super(cause); + } + + /** + * Returns the location of the resource that was being loaded. + * @return the location of the resource that was being loaded + */ + public String getResourceURI() { + return resourceURI; + } + + /** + * Sets the location of the resource that was being loaded. + * @param resourceURI the location of the resource that was being loaded + */ + public void setResourceURI(String resourceURI) { + this.resourceURI = resourceURI; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ImplementationCache.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ImplementationCache.java new file mode 100644 index 0000000000..cc5f2999fe --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ImplementationCache.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +import org.apache.tuscany.model.assembly.Implementation; + +import javax.xml.namespace.QName; + +/** + * Cache of introspected implementations. + * + * @version $Rev$ $Date$ + */ +public interface ImplementationCache { + /** + * Return an implementation from a given namespace. + * + * @param type the namespace that defines the type of implementation + * @param name the name of an implementation in that namespace + * @return the implementation or null if it is not present in the cache + */ + Implementation get(QName type, String name); + + /** + * Add an implementation to the cache + * + * @param type the namespace that defines the type of implementation + * @param name the name of an implementation in that namespace + * @param implementation the introspected implementation + */ + void put(QName type, String name, Implementation implementation); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidMetaDataException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidMetaDataException.java new file mode 100644 index 0000000000..71b2329044 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidMetaDataException.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config; + +/** + * Denotes an validation error processing component metadata + * @version $$Rev$$ $$Date$$ + */ +public class InvalidMetaDataException extends MetaDataException { + public InvalidMetaDataException() { + } + + public InvalidMetaDataException(String message) { + super(message); + } + + public InvalidMetaDataException(String message, Throwable cause) { + super(message, cause); + } + + public InvalidMetaDataException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidRootElementException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidRootElementException.java new file mode 100644 index 0000000000..a355d884a5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidRootElementException.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +import javax.xml.namespace.QName; + +/** + * Configuration exception that indicates the actual root element in an XML file was not the one expected. + * + * @version $Rev$ $Date$ + */ +public class InvalidRootElementException extends ConfigurationLoadException { + private static final long serialVersionUID = 2376629433948140418L; + + private final QName expected; + private final QName actual; + + public InvalidRootElementException(QName expected, QName actual) { + super("Invalid root element, expected [" + expected + "], was [" + actual + ']'); + this.expected = expected; + this.actual = actual; + } + + public QName getExpected() { + return expected; + } + + public QName getActual() { + return actual; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidSetterException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidSetterException.java new file mode 100644 index 0000000000..ed4e53645f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/InvalidSetterException.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +/** + * @version $Rev$ $Date$ + */ +public class InvalidSetterException extends ConfigurationLoadException { + private static final long serialVersionUID = -3298236203808038211L; + + public InvalidSetterException() { + } + + public InvalidSetterException(String message) { + super(message); + } + + public InvalidSetterException(String message, Throwable cause) { + super(message, cause); + } + + public InvalidSetterException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/JavaIntrospectionHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/JavaIntrospectionHelper.java new file mode 100644 index 0000000000..9d74633519 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/JavaIntrospectionHelper.java @@ -0,0 +1,446 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +import java.lang.reflect.AccessibleObject; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Implements various reflection-related operations + * + * @version $Rev$ $Date$ + */ +public class JavaIntrospectionHelper { + + private static final Class[] EMPTY_CLASS_ARRY = new Class[0]; + + /** + * Hide the constructor + */ + private JavaIntrospectionHelper() { + } + + /** + * Returns a collection of public, private, protected, or default fields declared by a class or one of its + * supertypes + */ + public static Set getAllFields(Class pClass) { + return getAllFields(pClass, new HashSet()); + } + + /** + * Recursively evaluates the type hierachy to return all fields on a given type + */ + private static Set getAllFields(Class pClass, Set fields) { + if (pClass == null || pClass.isArray() || Object.class.equals(pClass)) { + return fields; + } + fields = getAllFields(pClass.getSuperclass(), fields); + Field[] declaredFields = pClass.getDeclaredFields(); + for (Field field : declaredFields) { + field.setAccessible(true); // ignore Java accessibility + fields.add(field); + } + return fields; + } + + /** + * Returns a collection of public, and protected fields declared by a class or one of its + * supertypes + */ + public static Set getAllPublicAndProtectedFields(Class clazz) { + return getAllPublicAndProtectedFields(clazz, new HashSet()); + } + + /** + * Recursively evaluates the type hierachy to return all fields that are public or protected + */ + private static Set getAllPublicAndProtectedFields(Class clazz, Set fields) { + if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) { + return fields; + } + fields = getAllPublicAndProtectedFields(clazz.getSuperclass(), fields); + Field[] declaredFields = clazz.getDeclaredFields(); +// fields = new HashSet(); +// Field[] declaredFields = clazz.getFields(); + for (Field field : declaredFields) { + int modifiers = field.getModifiers(); + if ((Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)) && !Modifier.isStatic(modifiers)){ + field.setAccessible(true); // ignore Java accessibility + fields.add(field); + } + } + return fields; + } + + /** + * Returns a collection of public, private, protected, or default methods declared by a class or one of + * its supertypes. Note that overriden methods will not be returned in the collection (i.e. only the + * method override will be).

This method can potentially be expensive as reflection information is + * not cached. It is assumed that this method will be used during a configuration phase. + */ + public static Set getAllUniqueMethods(Class clazz) { + return getAllUniqueMethods(clazz, new HashSet()); + } + + /** + * Recursively evaluates the type hierarchy to return all unique methods + */ + private static Set getAllUniqueMethods(Class pClass, Set methods) { + if (pClass == null || pClass.isArray() || Object.class.equals(pClass)) { + return methods; + } + // we first evaluate methods of the subclass and then move to the parent + Method[] declaredMethods = pClass.getDeclaredMethods(); + for (Method declaredMethod : declaredMethods) { + if (methods.size() == 0) { + methods.add(declaredMethod); + } else { + List temp = new ArrayList(); + boolean matched = false; + for (Method method : methods) { + // only add if not already in the set from a supclass (i.e. the + // method is not overrided) + if (exactMethodMatch(declaredMethod, method)) { + matched = true; + break; + } + } + if (!matched) { + // TODO ignore Java accessibility + declaredMethod.setAccessible(true); + temp.add(declaredMethod); + + } + methods.addAll(temp); + temp.clear(); + } + } + // evaluate class hierarchy - this is done last to track inherited methods + methods = getAllUniqueMethods(pClass.getSuperclass(), methods); + return methods; + } + + /** + * Finds the closest matching field with the given name, that is, a field of the exact specified type or, + * alternately, of a supertype. + * + * @param name the name of the field + * @param type the field type + * @param fields the collection of fields to search + * @return the matching field or null if not found + */ + public static Field findClosestMatchingField(String name, Class type, Set fields) { + Field candidate = null; + for (Field field : fields) { + if (field.getName().equals(name)) { + if (field.getType().equals(type)) { + return field; // exact match + } else if (field.getType().isAssignableFrom(type) + || (field.getType().isPrimitive() && primitiveAssignable(field.getType(), type))) { + // We could have the situation where a field parameter is a primitive and the demarshalled value is + // an object counterpart (e.g. Integer and int) + // @spec issue + // either an interface or super class, so keep a reference until + // we know there are no closer types + candidate = field; + } + } + } + if (candidate != null) { + return candidate; + } else { + return null; + } + } + + /** + * Finds the closest matching method with the given name, that is, a method taking the exact parameter + * types or, alternately, parameter supertypes. + * + * @param name the name of the method + * @param types the method parameter types + * @param methods the collection of methods to search + * @return the matching method or null if not found + */ + public static Method findClosestMatchingMethod(String name, Class[] types, Set methods) { + if (types == null) { + types = EMPTY_CLASS_ARRY; + } + Method candidate = null; + for (Method method : methods) { + if (method.getName().equals(name) && method.getParameterTypes().length == types.length) { + Class[] params = method.getParameterTypes(); + boolean disqualify = false; + boolean exactMatch = true; + for (int i = 0; i < params.length; i++) { + if (!params[i].equals(types[i]) && !params[i].isAssignableFrom(types[i])) { + // no match + disqualify = true; + exactMatch = false; + break; + } else if (!params[i].equals(types[i]) && params[i].isAssignableFrom(types[i])) { + // not exact match + exactMatch = false; + } + } + if (disqualify) { + continue; + } else if (exactMatch) { + return method; + } else { + candidate = method; + } + } + } + if (candidate != null) { + return candidate; + } else { + return null; + } + } + + /** + * Searches a collection of fields for one that matches by name and has a multiplicity type. i.e. a List + * or Array of interfaces + * + * @return a matching field or null + */ + public static Field findMultiplicityFieldByName(String name, Set fields) { + for (Field candidate : fields) { + if (candidate.getName().equals(name) + && (List.class.isAssignableFrom(candidate.getType()) || (candidate.getType().isArray() + && candidate.getType().getComponentType() != null && candidate.getType().getComponentType() + .isInterface()))) { + return candidate; + } + } + return null; + } + + /** + * Searches a collection of method for one that matches by name and has single parameter of a multiplicity + * type. i.e. a List or Array of interfaces + * + * @return a matching method or null + */ + public static Method findMultiplicityMethodByName(String name, Set methods) { + for (Method candidate : methods) { + if (candidate.getName().equals(name) + && candidate.getParameterTypes().length == 1 + && (List.class.isAssignableFrom(candidate.getParameterTypes()[0]) || (candidate.getParameterTypes()[0] + .isArray() + && candidate.getParameterTypes()[0].getComponentType() != null && candidate.getParameterTypes()[0] + .getComponentType().isInterface()))) { + return candidate; + } + } + return null; + } + + /** + * Returns a field or method defined in the given class or its superclasses matching a literal name and + * parameter types

This method can potentially be expensive as reflection information is not cached. + * It is assumed that this method will be used during a configuration phase. + * + * @param clazz the class to introspect + * @param propertName the literal name of the property (i.e. JavaBean conventions are not applied) + * @param paramTypes the parameter types for a method or null for fields or methods with no parameters + * @return the field, method or null + */ + public static AccessibleObject getBeanProperty(Class clazz, String propertName, Class[] paramTypes) { + + Set methods = getAllUniqueMethods(clazz); + for (Method method : methods) { + if (method.getName().equals(propertName)) { + Class[] types = method.getParameterTypes(); + if (types.length == 0 && paramTypes == null) { + return method; + } else if (types.length != 0 && paramTypes == null) { + break; + } else if (types.length == paramTypes.length) { + for (int n = 0; n < types.length - 1; n++) { + if (!types[n].equals(paramTypes[n]) || !types[n].isAssignableFrom(paramTypes[n])) { + break; + } + } + return method; + } + } + } + + Set fields = getAllFields(clazz); + for (Field field : fields) { + if (field.getName().equals(propertName)) { + return field; + } + } + return null; + } + + /** + * Determines if two methods "match" - that is, they have the same method names and exact parameter types + * (one is not a supertype of the other) + */ + public static boolean exactMethodMatch(Method method1, Method method2) { + if (!method1.getName().equals(method2.getName())) { + return false; + } + Class[] types1 = method1.getParameterTypes(); + Class[] types2 = method2.getParameterTypes(); + if (types1.length == 0 && types2.length == 0) { + return true; + } else if (types1.length == types2.length) { + for (int n = 0; n < types1.length; n++) { + if (!types1[n].equals(types2[n])) { + return false; + } + } + return true; + } + return false; + } + + public static Constructor getDefaultConstructor(Class clazz) throws NoSuchMethodException { + return clazz.getConstructor((Class[]) null); + } + + /** + * Loads a class corresponding to the class name using the current context class loader. + * + * @throws ClassNotFoundException if the class was not found on the classpath + */ + public static Class loadClass(String pName) throws ClassNotFoundException { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + return Class.forName(pName, true, loader); + } + + /** + * Returns the simple name of a class - i.e. the class name devoid of its package qualifier + * + * @param implClass + */ + public static String getBaseName(Class implClass) { + String baseName = implClass.getName(); + int lastDot = baseName.lastIndexOf('.'); + if (lastDot != -1) { + baseName = baseName.substring(lastDot + 1); + } + return baseName; + } + + public static boolean isImmutable(Class clazz) { + return (String.class == clazz || clazz.isPrimitive() || Number.class.isAssignableFrom(clazz) + || Boolean.class.isAssignableFrom(clazz) || Character.class.isAssignableFrom(clazz) || Byte.class + .isAssignableFrom(clazz)); + } + + /** + * Takes a property name and converts it to a getter method name according to JavaBean conventions. For + * example, property foo is returned as getFoo + */ + public static String toGetter(String name) { + return "get" + name.toUpperCase().substring(0, 1) + name.substring(1); + } + + /** + * Takes a setter or getter method name and converts it to a property name according to JavaBean + * conventions. For example, setFoo(var) is returned as property foo + */ + public static String toPropertyName(String name) { + return Character.toLowerCase(name.charAt(3)) + name.substring(4); + } + + /** + * Takes a property name and converts it to a setter method name according to JavaBean conventions. For + * example, the property foo is returned as setFoo(var) + */ + public static String toSetter(String name) { + return "set" + name.toUpperCase().substring(0, 1) + name.substring(1); + } + + /** + * Compares a two types, assuming one is a primitive, to determine if the other is its object counterpart + */ + private static boolean primitiveAssignable(Class memberType, Class param) { + if (memberType == Integer.class) { + return (param == Integer.TYPE); + } else if (memberType == Double.class) { + return (param == Double.TYPE); + } else if (memberType == Float.class) { + return (param == Float.TYPE); + } else if (memberType == Short.class) { + return (param == Short.TYPE); + } else if (memberType == Character.class) { + return (param == Character.TYPE); + } else if (memberType == Boolean.class) { + return (param == Boolean.TYPE); + } else if (memberType == Byte.class) { + return (param == Byte.TYPE); + } else if (param == Integer.class) { + return (memberType == Integer.TYPE); + } else if (param == Double.class) { + return (memberType == Double.TYPE); + } else if (param == Float.class) { + return (memberType == Float.TYPE); + } else if (param == Short.class) { + return (memberType == Short.TYPE); + } else if (param == Character.class) { + return (memberType == Character.TYPE); + } else if (param == Boolean.class) { + return (memberType == Boolean.TYPE); + } else if (param == Byte.class) { + return (memberType == Byte.TYPE); + } else { + return false; + } + } + + /** + * Returns the generic types represented in the given type. Usage as follows: + *

+ * // to return the generic type of a field: JavaIntrospectionHelper.getGenerics(field.getGenericType()); + *

+ * // to return the generic types for the first parameter of a method: JavaIntrospectionHelper.getGenerics(m.getGenericParameterTypes()[0];); + *

+ * + * + * @return the generic types in order of declaration or an empty array if the type is not genericized + */ + public static List getGenerics(Type genericType) { + List classes = new ArrayList(); + if (genericType instanceof ParameterizedType) { + ParameterizedType ptype = (ParameterizedType) genericType; + // get the type arguments + Type[] targs = ptype.getActualTypeArguments(); + for (Type targ : targs) { + classes.add(targ); + } + } + return classes; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MetaDataException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MetaDataException.java new file mode 100644 index 0000000000..30840a6e15 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MetaDataException.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config; + +/** + * Denotes an error processing component metadata + * + * @version $$Rev$$ $$Date$$ + */ +public class MetaDataException extends ConfigurationLoadException{ + + public MetaDataException() { + } + + public MetaDataException(String message) { + super(message); + } + + public MetaDataException(String message, Throwable cause) { + super(message, cause); + } + + public MetaDataException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingInterfaceException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingInterfaceException.java new file mode 100644 index 0000000000..6164b6a011 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingInterfaceException.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +/** + * Exception indicating that the interface referenced in an assembly file could not be found. + * + * @version $Rev$ $Date$ + */ +public class MissingInterfaceException extends ConfigurationLoadException { + public MissingInterfaceException() { + } + + public MissingInterfaceException(String message) { + super(message); + } + + public MissingInterfaceException(String message, Throwable cause) { + super(message, cause); + } + + public MissingInterfaceException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingResourceException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingResourceException.java new file mode 100644 index 0000000000..8260dbc8ae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/MissingResourceException.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +/** + * Exception that indicates an expected resource could not be found. + * + * @version $Rev$ $Date$ + */ +public class MissingResourceException extends ConfigurationLoadException { + /** + * Constructor that indicates which resource could not be found. + * The supplied parameter is also returned as the message. + * + * @param resource the resource that could not be found + */ + public MissingResourceException(String resource) { + super(resource); + setResourceURI(resource); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ModuleComponentConfigurationLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ModuleComponentConfigurationLoader.java new file mode 100644 index 0000000000..15857441b1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/ModuleComponentConfigurationLoader.java @@ -0,0 +1,75 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +import org.apache.tuscany.model.assembly.ModuleComponent; + +import java.net.URL; +import java.util.Collection; + +/** + * Interface for loading configuration information from some external + * form into a Tuscany logical model. + * + * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ + */ +public interface ModuleComponentConfigurationLoader { + + /** + * Load a SCDL module component. + * + * @param name the name of the module component + * @param uri + * @return a new module component definition + * @throws ConfigurationLoadException if there was a problem loading the module component. + */ + ModuleComponent loadModuleComponent(String name, String uri) throws ConfigurationLoadException; + + /** + * Load a System SCDL module component. + * + * @param name the name of the module component + * @param uri + * @return a new module component definition + * @throws ConfigurationLoadException if there was a problem loading the module component. + */ + ModuleComponent loadSystemModuleComponent(String name, String uri) throws ConfigurationLoadException; + + /** + * Load a SCDL module component. + * + * @param name the name of the module component + * @param uri + * @param url + * @return a new module component definition + * @throws ConfigurationLoadException if there was a problem loading the module component. + */ + ModuleComponent loadModuleComponent(String name, String uri, URL url) throws ConfigurationLoadException; + + /** + * Load a SCDL module component. + * + * @param name the name of the module component + * @param uri + * @param url + * @param urls + * @return a new module component definition + * @throws ConfigurationLoadException if there was a problem loading the module component. + */ + ModuleComponent loadModuleComponent(String name, String uri, URL url, Collection urls) throws ConfigurationLoadException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/SidefileLoadException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/SidefileLoadException.java new file mode 100644 index 0000000000..b432d4ea68 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/SidefileLoadException.java @@ -0,0 +1,50 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +/** + * Exception indicating that there was a problem loading a sidefile. + * + * @version $Rev$ $Date$ + */ +public class SidefileLoadException extends ConfigurationLoadException { + private static final long serialVersionUID = -3530306758412789392L; + private String sidefileURI; + + public SidefileLoadException() { + } + + public SidefileLoadException(String message) { + super(message); + } + + public SidefileLoadException(String message, Throwable cause) { + super(message, cause); + } + + public SidefileLoadException(Throwable cause) { + super(cause); + } + + public String getSidefileURI() { + return sidefileURI; + } + + public void setSidefileURI(String sidefileURI) { + this.sidefileURI = sidefileURI; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java new file mode 100644 index 0000000000..a77031b8c5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/AbstractModuleComponentConfigurationLoader.java @@ -0,0 +1,164 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.processor.ProcessorUtils; +import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.ModuleFragment; +import org.apache.tuscany.model.assembly.ComponentType; + +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +/** + * @version $Rev$ $Date$ + */ +public abstract class AbstractModuleComponentConfigurationLoader implements ModuleComponentConfigurationLoader { + private static final String SCA_MODULE_FILE_NAME = "sca.module"; + //FIXME can fragments have a variable prefix name? + private static final String SCA_FRAGMENT_FILE_NAME = "sca.fragment"; + private static final String SYSTEM_MODULE_FILE_NAME = "system.module"; + //FIXME can fragments have a variable prefix name? + private static final String SYSTEM_FRAGMENT_FILE_NAME = "system.fragment"; + + protected final AssemblyContext modelContext; + protected final ResourceLoader resourceLoader; + protected final AssemblyFactory assemblyFactory; + + // JFM HACK + private ComponentTypeIntrospector introspector; + + private ComponentType systemType; + + private ComponentType compositeType; + + protected ComponentTypeIntrospector getIntrospector(){ + if (introspector == null){ + introspector = ProcessorUtils.createCoreIntrospector(assemblyFactory); + } + return introspector; + } + + protected ComponentType getSystemCompositeComponentType() throws ConfigurationLoadException { + if (systemType == null){ + systemType = getIntrospector().introspect(SystemCompositeContextImpl.class); + } + return systemType; + } + + protected ComponentType getCompositeComponentType() throws ConfigurationLoadException { + if (compositeType == null){ + compositeType = getIntrospector().introspect(CompositeContextImpl.class); + } + return compositeType; + } + /// JFM HACK + + protected AbstractModuleComponentConfigurationLoader(AssemblyContext modelContext) { + this.modelContext = modelContext; + resourceLoader = modelContext.getApplicationResourceLoader(); + assemblyFactory = modelContext.getAssemblyFactory(); + } + + public ModuleComponent loadSystemModuleComponent(String name, String uri) throws ConfigurationLoadException { + ModuleComponent mc = loadModuleComponent(SYSTEM_MODULE_FILE_NAME, SYSTEM_FRAGMENT_FILE_NAME, name, uri); + //JFM HACK - this is completely gross since it overwrites existing component type + mc.getImplementation().setImplementationClass(SystemCompositeContextImpl.class); + mc.getImplementation().setComponentType(getSystemCompositeComponentType()); + //END HACK + return mc; + } + + public ModuleComponent loadModuleComponent(String name, String uri) throws ConfigurationLoadException { + ModuleComponent mc = loadModuleComponent(SCA_MODULE_FILE_NAME, SCA_FRAGMENT_FILE_NAME, name, uri); + //JFM HACK + mc.getImplementation().setImplementationClass(CompositeContextImpl.class); + mc.getImplementation().setComponentType(getCompositeComponentType()); + //END HACK + return mc; + } + + protected ModuleComponent loadModuleComponent(String moduleFileName, String fragmentFileName, String name, String uri) throws ConfigurationLoadException { + + // Load the sca.module file + URL moduleUrl; + moduleUrl = resourceLoader.getResource(moduleFileName); + + + if (moduleUrl == null) { + throw new ConfigurationLoadException(moduleFileName); + } + + // Load the sca.fragment files + Iterator i; + try { + i = resourceLoader.getResources(fragmentFileName); + } catch (IOException e) { + throw new ConfigurationLoadException(fragmentFileName, e); + } + List moduleFragmentUris=new ArrayList(); + while (i.hasNext()) { + URL url=i.next(); + moduleFragmentUris.add(url); + } + + return loadModuleComponent(name, uri, moduleUrl, moduleFragmentUris); + } + + public ModuleComponent loadModuleComponent(String name, String uri, URL url) throws ConfigurationLoadException { + return loadModuleComponent( name, uri, url, null); + } + + public ModuleComponent loadModuleComponent(String name, String uri, URL moduleUri, Collection moduleFragmentUris) throws ConfigurationLoadException { + + // Load the module file + Module module=loadModule(moduleUri); + // Load the sca.fragment files + if (moduleFragmentUris!=null) { + for (URL moduleFragmentUri : moduleFragmentUris) { + ModuleFragment moduleFragment=loadModuleFragment(moduleFragmentUri); + module.getModuleFragments().add(moduleFragment); + } + } + + // Create the module component + ModuleComponent moduleComponent=assemblyFactory.createModuleComponent(); + moduleComponent.setName(name); + moduleComponent.setURI(uri); + moduleComponent.setImplementation(module); + moduleComponent.initialize(modelContext); + + return moduleComponent; + } + + public abstract Module loadModule(URL url) throws ConfigurationLoadException; + + public abstract ModuleFragment loadModuleFragment(URL url) throws ConfigurationLoadException; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java new file mode 100644 index 0000000000..fdbb6e0942 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/Java5ComponentTypeIntrospector.java @@ -0,0 +1,139 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.config.processor.ProcessorUtils; +import org.apache.tuscany.core.extension.config.ImplementationProcessor; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.ComponentName; + +/** + * Introspects Java annotation-based metata data + * + * @version $Rev$ $Date$ + */ +@org.osoa.sca.annotations.Service(ComponentTypeIntrospector.class) +public class Java5ComponentTypeIntrospector implements ComponentTypeIntrospector { + + private AssemblyFactory factory; + + private List processors = new ArrayList(); + + public Java5ComponentTypeIntrospector() { + } + + public Java5ComponentTypeIntrospector(AssemblyFactory factory) { + this.factory = factory; + } + + @Autowire + public void setFactory(SystemAssemblyFactory factory) { + this.factory = factory; + //FIXME JFM HACK + List processors = ProcessorUtils.createCoreProcessors(factory); + for (ImplementationProcessor processor : processors) { + this.registerProcessor(processor); + } + // END hack + } + + @ComponentName + protected String name; + + @Init(eager = true) + public void init(){ + } + + public void registerProcessor(ImplementationProcessor processor) { + processors.add(processor); + } + + public void unregisterProcessor(ImplementationProcessor processor) { + processors.remove(processor); + } + + /** + * Visits the given implementation type and calls back to {@link org.apache.tuscany.core.extension.config.ImplementationProcessor}s + * registered with this introspector to build up a {@link ComponentType} + * + * @return ComponentType representing the implementation type metadata + * @throws ConfigurationLoadException if there is an error introspecting the implementation type + */ + public ComponentType introspect(Class implClass) throws ConfigurationLoadException { + ComponentType compType = factory.createComponentType(); + return introspect(implClass, compType); + } + + public ComponentType introspect(Class implClass, ComponentType compType) throws ConfigurationLoadException { + for (ImplementationProcessor processor : processors) { + processor.visitClass(implClass, compType); + } + Constructor[] constructors = implClass.getConstructors(); + for (Constructor constructor : constructors) { + for (ImplementationProcessor processor : processors) { + processor.visitConstructor(constructor, compType); + } + } + Method[] methods = implClass.getMethods(); + for (Method method : methods) { + for (ImplementationProcessor processor : processors) { + processor.visitMethod(method, compType); + } + } + Set fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(implClass); + for (Field field : fields) { + for (ImplementationProcessor processor : processors) { + processor.visitField(field, compType); + } + } + Class superClass = implClass.getSuperclass(); + if (superClass != null) { + visitSuperClass(superClass, compType); + } + for (ImplementationProcessor processor : processors) { + processor.visitEnd(implClass, compType); + } + return compType; + } + + private void visitSuperClass(Class superClass, ComponentType compType) throws ConfigurationLoadException { + if (!Object.class.equals(superClass)) { + for (ImplementationProcessor processor : processors) { + processor.visitSuperClass(superClass, compType); + } + superClass = superClass.getSuperclass(); + if (superClass != null) { + visitSuperClass(superClass, compType); + } + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/StAXModuleComponentConfigurationLoaderImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/StAXModuleComponentConfigurationLoaderImpl.java new file mode 100644 index 0000000000..3bd6e6361d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/impl/StAXModuleComponentConfigurationLoaderImpl.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleFragment; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import java.io.IOException; +import java.net.URL; + +/** + * @version $Rev$ $Date$ + */ +public class StAXModuleComponentConfigurationLoaderImpl extends AbstractModuleComponentConfigurationLoader { + private final XMLInputFactory xmlFactory; + private final StAXLoaderRegistry registry; + + public StAXModuleComponentConfigurationLoaderImpl(AssemblyContext modelContext, XMLInputFactory xmlFactory, StAXLoaderRegistry registry) { + super(modelContext); + this.xmlFactory = xmlFactory; + this.registry = registry; + } + + public Module loadModule(URL url) throws ConfigurationLoadException { + registry.setContext(modelContext); + try { + XMLStreamReader reader = xmlFactory.createXMLStreamReader(url.openStream()); + getDocumentRoot(reader); + return (Module) registry.load(reader, new LoaderContext(resourceLoader)); + } catch (XMLStreamException e) { + ConfigurationLoadException ce = new ConfigurationLoadException(e); + ce.setResourceURI(url.toString()); + throw ce; + } catch (IOException e) { + ConfigurationLoadException ce = new ConfigurationLoadException(e); + ce.setResourceURI(url.toString()); + throw ce; + } finally { + registry.setContext(null); + } + } + + public ModuleFragment loadModuleFragment(URL url) throws ConfigurationLoadException { + registry.setContext(modelContext); + try { + XMLStreamReader reader = xmlFactory.createXMLStreamReader(url.openStream()); + getDocumentRoot(reader); + return (ModuleFragment) registry.load(reader, new LoaderContext(resourceLoader)); + } catch (XMLStreamException e) { + ConfigurationLoadException ce = new ConfigurationLoadException(e); + ce.setResourceURI(url.toString()); + throw ce; + } catch (IOException e) { + ConfigurationLoadException ce = new ConfigurationLoadException(e); + ce.setResourceURI(url.toString()); + throw ce; + } finally { + registry.setContext(null); + } + } + + private static void getDocumentRoot(XMLStreamReader reader) throws XMLStreamException { + while (true) { + if (reader.next() == XMLStreamConstants.START_ELEMENT) { + return; + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ComponentNameProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ComponentNameProcessor.java new file mode 100644 index 0000000000..0314bcc9bf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ComponentNameProcessor.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.extension.config.extensibility.ComponentNameExtensibilityElement; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.osoa.sca.annotations.ComponentName; + +/** + * Processes the {@link ComponentName} annotation + * + * @version $$Rev$$ $$Date$$ + */ +public class ComponentNameProcessor extends ImplementationProcessorSupport { + + public ComponentNameProcessor(AssemblyFactory factory) { + super(factory); + } + + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + ComponentName name = method.getAnnotation(ComponentName.class); + if (name == null) { + return; + } + type.getExtensibilityElements().add(new ComponentNameExtensibilityElement(method)); + } + + public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { + ComponentName name = field.getAnnotation(ComponentName.class); + if (name == null) { + return; + } + type.getExtensibilityElements().add(new ComponentNameExtensibilityElement(field)); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ContextProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ContextProcessor.java new file mode 100644 index 0000000000..ff5c3736b7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ContextProcessor.java @@ -0,0 +1,50 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.extension.config.extensibility.ContextExtensibilityElement; +import org.apache.tuscany.model.assembly.ComponentType; +import org.osoa.sca.annotations.Context; + +/** + * Processes the {@link org.osoa.sca.annotations.Context} annotation + * + * @version $$Rev$$ $$Date$$ + */ +public class ContextProcessor extends ImplementationProcessorSupport { + + public ContextProcessor() { + } + + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + Context context = method.getAnnotation(Context.class); + if (context == null) { + return; + } + type.getExtensibilityElements().add(new ContextExtensibilityElement(method)); + } + + public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { + Context context = field.getAnnotation(Context.class); + if (context == null) { + return; + } + type.getExtensibilityElements().add(new ContextExtensibilityElement(field)); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DefaultProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DefaultProcessor.java new file mode 100644 index 0000000000..8445526dc8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DefaultProcessor.java @@ -0,0 +1,112 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Set; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Property; +import org.apache.tuscany.model.assembly.Reference; + +/** + * Adds public methods and public/protected fields as properties that are not declared explicitly with an + * {@link org.osoa.sca.annotations.Property} or {@link org.osoa.sca.annotations.Reference} annotation + * + * @version $$Rev$$ $$Date$$ + */ +public class DefaultProcessor extends ImplementationProcessorSupport { + + public DefaultProcessor(AssemblyFactory factory) { + super(factory); + } + + public DefaultProcessor() { + } + + public void visitEnd(Class clazz, ComponentType type) throws ConfigurationLoadException { + // add any public/protected fields and public setter methods as properties + Set fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(clazz); + List properties = type.getProperties(); + List references = type.getReferences(); + boolean contains; + Method[] methods = clazz.getMethods(); + String name; + for (Method method : methods) { + if (Object.class.equals(method.getDeclaringClass()) || method.getParameterTypes().length != 1 + || method.isAnnotationPresent(org.osoa.sca.annotations.Property.class) + || method.isAnnotationPresent(org.osoa.sca.annotations.Reference.class)) { + continue; + } + contains = containsProperty(properties, method.getName()); + if (contains) { + continue; + } + name = method.getName(); + if (name.length() > 3 && name.startsWith("set")) { + // follow JavaBeans conventions + name = JavaIntrospectionHelper.toPropertyName(name); + } + contains = containsReference(references, name); + if (!contains) { + addProperty(name, method.getParameterTypes()[0], type); + } + } + for (Field field : fields) { + if (field.isAnnotationPresent(org.osoa.sca.annotations.Property.class) + || field.isAnnotationPresent(org.osoa.sca.annotations.Reference.class)) { + continue; + } + contains = containsProperty(properties, field.getName()); + if (contains) { + continue; + } + contains = containsReference(references, field.getName()); + if (!contains) { + addProperty(field.getName(), field.getType(), type); + } + } + } + + private boolean containsProperty(List properties, String name) { + for (Property prop : properties) { + if (prop.getName().equals(name)) { + return true; + } + } + return false; + } + + private boolean containsReference(List references, String name) { + for (Reference ref : references) { + if (ref.getName().equals(name)) { + return true; + } + } + return false; + } + + private void addProperty(String name, Class propType, ComponentType type) { + Property property = factory.createProperty(); + property.setName(name); + property.setRequired(false); + property.setType(propType); + type.getProperties().add(property); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DestroyProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DestroyProcessor.java new file mode 100644 index 0000000000..a16845bbf8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/DestroyProcessor.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.lang.reflect.Method; + +import org.apache.tuscany.core.extension.config.extensibility.DestroyInvokerExtensibilityElement; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.osoa.sca.annotations.Destroy; + +/** + * Processes a {@link Destroy} + * + * @version $$Rev$$ $$Date$$ + */ +public class DestroyProcessor extends ImplementationProcessorSupport { + + public DestroyProcessor() { + } + + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + Destroy destroy = method.getAnnotation(Destroy.class); + if (destroy == null) { + return; + } + if (method.getParameterTypes().length != 0) { + throw new ConfigurationLoadException("Destroy methods cannot take parameters"); + } + type.getExtensibilityElements().add(new DestroyInvokerExtensibilityElement(method)); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ImplementationProcessorSupport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ImplementationProcessorSupport.java new file mode 100644 index 0000000000..175de28a92 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ImplementationProcessorSupport.java @@ -0,0 +1,107 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.extension.config.ImplementationProcessor; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +/** + * A base implementation of an ImplementationProcessor + * + * @version $$Rev$$ $$Date$$ + */ +@Scope("MODULE") +public abstract class ImplementationProcessorSupport implements ImplementationProcessor { + + protected ComponentTypeIntrospector introspector; + protected AssemblyFactory factory; + + protected ImplementationProcessorSupport(AssemblyFactory factory) { + this.factory = factory; + } + + protected ImplementationProcessorSupport() { + } + + @Init(eager = true) + public void init() throws Exception { + introspector.registerProcessor(this); + } + + @Autowire + public void setIntrospector(ComponentTypeIntrospector introspector) { + this.introspector = introspector; + } + + @Autowire + public void setFactory(AssemblyFactory factory) { + this.factory = factory; + + } + + public void visitClass(Class clazz, ComponentType type) throws ConfigurationLoadException { + + } + + public void visitSuperClass(Class clazz, ComponentType type) throws ConfigurationLoadException { + + } + + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + + } + + public void visitConstructor(Constructor constructor, ComponentType type) throws ConfigurationLoadException { + + } + + public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { + + } + + public void visitInterface(Class clazz, Annotation[] annotations, ComponentType type) throws ConfigurationLoadException { + + } + + public void visitInterfaceMethod(Method method, Annotation[] annotations, ComponentType type) throws ConfigurationLoadException { + + } + + public void visitEnd(Class clazz, ComponentType type) throws ConfigurationLoadException { + + } + +// /** +// * Creates a {@link JavaExtensibilityElement} subclasses may update while processing annotations +// */ +// protected JavaExtensibilityElement getExtensibilityElement(ComponentType type) { +// JavaExtensibilityElement element = (JavaExtensibilityElement) type.getExtensibilityElements().get(JAVA_ELEMENT); +// if (element == null) { +// element = new JavaExtensibilityElementImpl(); +// type.getExtensibilityElements().put(JAVA_ELEMENT, element); +// } +// return element; +// } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/InitProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/InitProcessor.java new file mode 100644 index 0000000000..9f4a53a651 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/InitProcessor.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.lang.reflect.Method; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.extension.config.extensibility.InitInvokerExtensibilityElement; +import org.apache.tuscany.model.assembly.ComponentType; +import org.osoa.sca.annotations.Init; + +/** + * Processes the {@link org.osoa.sca.annotations.Init} annotation + * + * @version $$Rev$$ $$Date$$ + */ +public class InitProcessor extends ImplementationProcessorSupport { + + public InitProcessor() { + } + + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + Init init = method.getAnnotation(Init.class); + if (init == null) { + return; + } + if (method.getParameterTypes().length != 0) { + throw new ConfigurationLoadException("Initialize methods cannot take parameters"); + } + type.getExtensibilityElements().add(new InitInvokerExtensibilityElement(method, init.eager())); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorHelper.java new file mode 100644 index 0000000000..d4c6c4a40e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorHelper.java @@ -0,0 +1,59 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.util.List; + +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; + +/** + * Provides utility functions for {@link org.apache.tuscany.core.extension.config.ImplementationProcessor}s + * + * @version $$Rev$$ $$Date$$ + */ +public class ProcessorHelper { + + private ProcessorHelper() { + } + + /** + * Returns the first Service from a collection matching the interface type + */ + public static Service getService(Class interfaceType, List services) { + for (Service service : services) { + Class serviceInterface = service.getServiceContract().getInterface(); + if (serviceInterface.equals(interfaceType)) { + return service; + } + } + return null; + } + + /** + * Returns the scope enum specified by the annotation + */ + public static Scope getScope(org.osoa.sca.annotations.Scope annotation) { + if ("MODULE".equalsIgnoreCase(annotation.value())) { + return Scope.MODULE; + } else if ("SESSION".equalsIgnoreCase(annotation.value())) { + return Scope.SESSION; + } else if ("REQUEST".equalsIgnoreCase(annotation.value())) { + return Scope.REQUEST; + } else { + return Scope.INSTANCE; + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorUtils.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorUtils.java new file mode 100644 index 0000000000..b0400c183f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ProcessorUtils.java @@ -0,0 +1,65 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.core.extension.config.ImplementationProcessor; +import org.apache.tuscany.core.system.config.processor.AutowireProcessor; +import org.apache.tuscany.core.system.config.processor.MonitorProcessor; +import org.apache.tuscany.core.system.config.processor.ParentContextProcessor; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector; +import org.apache.tuscany.core.sdo.helper.SDOHelperProcessor; +import org.apache.tuscany.model.assembly.AssemblyFactory; + +/** + * Temporary class to create bootstrap {@link ImplementationProcessor}s + * + * @version $$Rev$$ $$Date$$ + */ +public class ProcessorUtils { + + private ProcessorUtils() { + } + + public static List createCoreProcessors(AssemblyFactory factory) { + List processors = new ArrayList(); + processors.add(new PropertyProcessor(factory)); + processors.add(new ReferenceProcessor(factory)); + processors.add(new ScopeProcessor()); + processors.add(new ServiceProcessor(factory)); + processors.add(new InitProcessor()); + processors.add(new DestroyProcessor()); + processors.add(new ContextProcessor()); + processors.add(new ComponentNameProcessor(factory)); + processors.add(new DefaultProcessor(factory)); + processors.add(new AutowireProcessor()); + processors.add(new MonitorProcessor()); + processors.add(new ParentContextProcessor()); + processors.add(new SDOHelperProcessor()); + return processors; + } + + public static ComponentTypeIntrospector createCoreIntrospector(AssemblyFactory factory){ + ComponentTypeIntrospector introspector = new Java5ComponentTypeIntrospector(factory); + List processors = createCoreProcessors(factory); + for (ImplementationProcessor processor : processors) { + introspector.registerProcessor(processor); + } + return introspector; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyProcessor.java new file mode 100644 index 0000000000..9191b75793 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyProcessor.java @@ -0,0 +1,104 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.InvalidSetterException; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Property; +import org.osoa.sca.annotations.Scope; + +/** + * Processes the {@link org.osoa.sca.annotations.Property} annotation + * + * @version $$Rev$$ $$Date$$ + */ +@Scope("MODULE") +public class PropertyProcessor extends ImplementationProcessorSupport { + + public PropertyProcessor(AssemblyFactory factory) { + super(factory); + } + + public PropertyProcessor() { + } + + @Override + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + if (method.getDeclaringClass().equals(Object.class)) { + return; + } + org.osoa.sca.annotations.Property annotation = method.getAnnotation(org.osoa.sca.annotations.Property.class); + if (annotation != null) { + if (!Modifier.isPublic(method.getModifiers())) { + InvalidSetterException e = new InvalidSetterException("Property setter method is not public"); + e.setIdentifier(method.toString()); + throw e; + } + Class[] params = method.getParameterTypes(); + if (params.length != 1) { + InvalidSetterException e = new InvalidSetterException("Property setter method must have one parameter"); + e.setIdentifier(method.toString()); + throw e; + } + String name = annotation.name(); + if (name.length() == 0) { + name = method.getName(); + if (name.length() > 3 && name.startsWith("set")) { + // follow JavaBeans conventions + name = JavaIntrospectionHelper.toPropertyName(name); + } + } + addProperty(name, method.getParameterTypes()[0], annotation.required(), type); + } + + + } + + @Override + public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { + if (field.getDeclaringClass().equals(Object.class)) { + return; + } + int modifiers = field.getModifiers(); + org.osoa.sca.annotations.Property annotation = field.getAnnotation(org.osoa.sca.annotations.Property.class); + if (annotation != null) { + if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { + InvalidSetterException e = new InvalidSetterException("Property field is not public or protected"); + e.setIdentifier(field.getName()); + throw e; + } + String name = annotation.name(); + if (name.length() == 0) { + name = field.getName(); + } + addProperty(name, field.getType(), annotation.required(), type); + } + } + + private void addProperty(String name, Class propType, boolean required, ComponentType type) { + Property property = factory.createProperty(); + property.setName(name); + property.setRequired(required); + property.setType(propType); + type.getProperties().add(property); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyReferenceValidator.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyReferenceValidator.java new file mode 100644 index 0000000000..bc8ef02777 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/PropertyReferenceValidator.java @@ -0,0 +1,80 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.lang.reflect.Field; +import java.util.Set; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.MetaDataException; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +/** + * Validates the use of {@link org.osoa.sca.annotations.Property} and {@link + * org.osoa.sca.annotations.Reference} annotations beyond native Java syntactic capabilities + * + * @version $$Rev$$ $$Date$$ + */ +public class PropertyReferenceValidator extends ImplementationProcessorSupport { + + public PropertyReferenceValidator(AssemblyFactory factory) { + super(factory); + } + + public void visitEnd(Class clazz, ComponentType type) throws ConfigurationLoadException { + // validate methods do not contain both @Reference and @Property annotations + Method[] methods = clazz.getMethods(); + boolean found; + for (Method method : methods) { + found = false; + Annotation[] anotations = method.getAnnotations(); + for (Annotation annotation : anotations) { + if (Property.class.equals(annotation.annotationType()) + || Reference.class.equals(annotation.annotationType())) { + if (found) { + MetaDataException e = new MetaDataException("Method cannot specify both property and reference"); + e.setIdentifier(method.getName()); + throw e; + } + found = true; + } + } + } + // validate fields do not contain both @Reference and @Property annotations + Set fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(clazz); + for (Field field : fields) { + found = false; + Annotation[] anotations = field.getAnnotations(); + for (Annotation annotation : anotations) { + if (Property.class.equals(annotation.annotationType()) + || Reference.class.equals(annotation.annotationType())) { + if (found) { + MetaDataException e = new MetaDataException("Field cannot specify both property and reference"); + e.setIdentifier(field.getName()); + throw e; + } + found = true; + } + } + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ReferenceProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ReferenceProcessor.java new file mode 100644 index 0000000000..007410b500 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ReferenceProcessor.java @@ -0,0 +1,119 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Collection; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.InvalidSetterException; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.osoa.sca.annotations.Scope; + +/** + * Processes the {@link org.osoa.sca.annotations.Reference} annotation + * + * @version $$Rev$$ $$Date$$ + */ +@Scope("MODULE") +public class ReferenceProcessor extends ImplementationProcessorSupport { + + public ReferenceProcessor() { + } + + public ReferenceProcessor(AssemblyFactory factory) { + super(factory); + } + + @Override + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + if(method.getDeclaringClass().equals(Object.class)){ + return; + } + int modifiers = method.getModifiers(); + org.osoa.sca.annotations.Reference annotation = method.getAnnotation(org.osoa.sca.annotations.Reference.class); + if (annotation != null) { + if (!Modifier.isPublic(modifiers)) { + InvalidSetterException e = new InvalidSetterException("Reference setter method is not public"); + e.setIdentifier(method.getName()); + throw e; + } + if (!Void.TYPE.equals(method.getReturnType())) { + InvalidSetterException e = new InvalidSetterException("Refence setter method must return void"); + e.setIdentifier(method.toString()); + throw e; + } + Class[] params = method.getParameterTypes(); + if (params.length != 1) { + InvalidSetterException e = new InvalidSetterException("Reference setter method must have one parameter"); + e.setIdentifier(method.toString()); + throw e; + } + String name = annotation.name(); + if (name.length() == 0) { + name = method.getName(); + if (name.length() > 3 && name.startsWith("set")) { + // follow JavaBeans conventions + name = JavaIntrospectionHelper.toPropertyName(name); + } + } + addReference(name, params[0], annotation.required(), type); + } + } + + @Override + public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { + if(field.getDeclaringClass().equals(Object.class)){ + return; + } + int modifiers = field.getModifiers(); + org.osoa.sca.annotations.Reference annotation = field.getAnnotation(org.osoa.sca.annotations.Reference.class); + if (annotation != null) { + if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { + InvalidSetterException e = new InvalidSetterException("Reference field is not public or protected"); + e.setIdentifier(field.getName()); + throw e; + } + String name = annotation.name(); + if (name.length() == 0) { + name = field.getName(); + } + addReference(name, field.getType(), annotation.required(), type); + } + } + + private void addReference(String name, Class paramType, boolean required, ComponentType type) { + Reference reference = factory.createReference(); + reference.setName(name); + ServiceContract contract = factory.createJavaServiceContract(); + contract.setInterface(paramType); + reference.setServiceContract(contract); + boolean many = paramType.isArray() || Collection.class.isAssignableFrom(paramType); + Multiplicity multiplicity; + if (required) + multiplicity = many ? Multiplicity.ONE_N : Multiplicity.ONE_ONE; + else + multiplicity = many ? Multiplicity.ZERO_N : Multiplicity.ZERO_ONE; + reference.setMultiplicity(multiplicity); + type.getReferences().add(reference); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ScopeProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ScopeProcessor.java new file mode 100644 index 0000000000..e81430115a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ScopeProcessor.java @@ -0,0 +1,74 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; + +/** + * Processes the {@link org.osoa.sca.annotations.Scope} annotation + * + * @version $$Rev$$ $$Date$$ + */ +public class ScopeProcessor extends ImplementationProcessorSupport { + + public ScopeProcessor() { + } + + @Override + public void visitEnd(Class clazz, ComponentType type) throws ConfigurationLoadException { + Scope scope = null; + org.osoa.sca.annotations.Scope annotation = clazz.getAnnotation(org.osoa.sca.annotations.Scope.class); + if (annotation != null) { + scope = ProcessorHelper.getScope(annotation); + } else { + Class superClass = clazz.getSuperclass(); + if (superClass != null) { + scope = recurseScope(superClass); + } + } + if (scope == null) { + scope = Scope.INSTANCE; + } + //FIXME hack for now - set scope to implementation scope + //This will be clean up with spec change + for (Service service : type.getServices()) { + Scope serviceScope = service.getServiceContract().getScope(); + if (serviceScope == Scope.INSTANCE || serviceScope == null) { + service.getServiceContract().setScope(scope); + } + } + + } + + /** + * Walks the class hierarchy until a scope annotation is found + */ + private Scope recurseScope(Class superClass) { + if (Object.class.equals(superClass)) { + return null; + } + org.osoa.sca.annotations.Scope scope = superClass.getAnnotation(org.osoa.sca.annotations.Scope.class); + if (scope == null) { + superClass = superClass.getSuperclass(); + if (superClass != null) { + return recurseScope(superClass); + } + } + return ProcessorHelper.getScope(scope); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java new file mode 100644 index 0000000000..2c7ba823f2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/config/processor/ServiceProcessor.java @@ -0,0 +1,129 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.processor; + +import java.util.List; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.InvalidMetaDataException; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.types.java.JavaServiceContract; +import org.osoa.sca.annotations.Callback; + +/** + * Processes the {@link org.osoa.sca.annotations.Service} annotation + * + * @version $$Rev$$ $$Date$$ + */ +public class ServiceProcessor extends ImplementationProcessorSupport { + + public ServiceProcessor() { + } + + public ServiceProcessor(AssemblyFactory factory) { + super(factory); + } + + @Override + public void visitClass(Class clazz, ComponentType type) throws ConfigurationLoadException { + if (!clazz.isInterface()) { + processImplementation(clazz,type); + } else { + processInterface(clazz, type); + } + } + + private void processImplementation(Class clazz, ComponentType type) throws ConfigurationLoadException { + // visiting the base implementation class + List services = type.getServices(); + Class[] interfaces = clazz.getInterfaces(); + org.osoa.sca.annotations.Service serviceAnnotation = clazz.getAnnotation(org.osoa.sca.annotations.Service.class); + if (interfaces.length == 0) { + // no interfaces so the class is the service + addService(services, clazz); + } else if (serviceAnnotation == null && interfaces.length == 1) { + // the impl has one interface, assign it to be the service + addService(services, interfaces[0]); + } else { + // visiting the implementation class + if (serviceAnnotation == null) { + return; + } + Class[] serviceInterfaces = serviceAnnotation.interfaces(); + Class value = serviceAnnotation.value(); + if (serviceInterfaces.length > 0) { + if (!Void.class.equals(value)) { + InvalidMetaDataException e = new InvalidMetaDataException("Both interfaces and value specified in @Service on "); + e.setIdentifier(clazz.getName()); + throw e; + } + for (Class intf : interfaces) { + addService(services, intf); + } + } else if (!Void.class.equals(value)) { + addService(services, value); + } + } + } + + + @Override + public void visitEnd(Class clazz, ComponentType type) throws ConfigurationLoadException { + List services = type.getServices(); + if (services.size() == 0) { + // no services processed so the class is the service + addService(services, clazz); + } + } + + private void processInterface(Class clazz, ComponentType type) { + List services = type.getServices(); + // the interface is a remotable service, add it + org.osoa.sca.annotations.Remotable remotableAnnotation = clazz.getAnnotation(org.osoa.sca.annotations.Remotable.class); + if (remotableAnnotation != null) { + // check to see if service added previously b/c it was specified on @Service + if (ProcessorHelper.getService(clazz, services) == null) { + addService(services, clazz); + } + } + } + + + private void addService(List services, Class serviceClass) { + //FIXME how do we support specifying remotable? + JavaServiceContract javaInterface = factory.createJavaServiceContract(); + javaInterface.setInterface(serviceClass); + org.osoa.sca.annotations.Scope scopeAnnotation = serviceClass.getAnnotation(org.osoa.sca.annotations.Scope.class); + Scope scope; + if (scopeAnnotation == null) { + scope = Scope.INSTANCE; + } else { + scope = ProcessorHelper.getScope(scopeAnnotation); + } + javaInterface.setScope(scope); + Callback callback = serviceClass.getAnnotation(Callback.class); + if (callback != null && !Void.class.equals(callback.value())) { + javaInterface.setCallbackInterface(callback.value()); + } + String name = JavaIntrospectionHelper.getBaseName(serviceClass); + Service service = factory.createService(); + service.setName(name); + service.setServiceContract(javaInterface); + services.add(service); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AtomicContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AtomicContext.java new file mode 100644 index 0000000000..7d4b990ab5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AtomicContext.java @@ -0,0 +1,55 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * A runtime entity that manages an atomic (i.e. leaf-type) artifact. + * + * @version $Rev$ $Date$ + */ +public interface AtomicContext extends Context { + + /** + * Returns whether the context should be eagerly initialized + */ + public boolean isEagerInit(); + + /** + * Notifies the context of an initialization event + * @throws TargetException + */ + public void init() throws TargetException; + + /** + * Notifies the context of a destroy event + * @throws TargetException + */ + public void destroy() throws TargetException; + + /** + * Returns whether the context should be called back when its scope ends + */ + public boolean isDestroyable(); + + /** + * Returns the target instance associated with the context. A target instance is the actual + * object a request is dispatched to sans proxy wire chain. + * @throws TargetException + */ + public Object getTargetInstance() throws TargetException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireContext.java new file mode 100644 index 0000000000..7fa459e76d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireContext.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * A specialization of a CompositeContext that is able to automatically resolve references + * for its children using EntryPoint or Service interfaces exposed by it or, recursively, any + * of it parents. + * + * @version $Rev$ $Date$ + */ +public interface AutowireContext extends CompositeContext { + + /** + * Invoked by child contexts to return an an autowire target. Resolved targets may be entry points or + * components in the parent or its ancestors, or entry points in a sibling context + * + * @param instanceInterface the type of service being requested + * @return a reference to the requested service or null if none can be found + * @throws AutowireResolutionException if an error occurs attempting to resolve an autowire + */ + T resolveInstance(Class instanceInterface) throws AutowireResolutionException; + + /** + * Invoked by a parent context to return an autowire target in a child. Resolved targets must be entry points. + * For example, given a parent P and two siblings, A and B, A would request an autowire by invoking + * {@link #resolveInstance(Class)} on P, which in turn could invoke the present method on B in order to resolve + * a target. + * + * @param instanceInterface the type of service being requested + * @return a reference to the requested service or null if none can be found + * @throws AutowireResolutionException if an error occurs attempting to resolve an autowire + */ + T resolveExternalInstance(Class instanceInterface) throws AutowireResolutionException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireResolutionException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireResolutionException.java new file mode 100644 index 0000000000..4da4206a94 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/AutowireResolutionException.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Denotes an exception while resolving an automatic wire + * + * @version $Rev$ $Date$ + */ +public class AutowireResolutionException extends TargetException { + + public AutowireResolutionException() { + super(); + } + + public AutowireResolutionException(String message) { + super(message); + } + + public AutowireResolutionException(String message, Throwable cause) { + super(message, cause); + } + + public AutowireResolutionException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/CompositeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/CompositeContext.java new file mode 100644 index 0000000000..abd23feb38 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/CompositeContext.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.model.assembly.Composite; +import org.apache.tuscany.model.assembly.Part; +import org.apache.tuscany.model.assembly.Extensible; +import org.apache.tuscany.model.assembly.AssemblyContext; + +import java.util.List; + +/** + * A context which contains child component contexts. + * + * @version $Rev$ $Date$ + */ +public interface CompositeContext extends Context { + + public String getURI(); + + public void setURI(String uri); + + /** + * TODO remove this method + * @deprecated + */ + public void setAssemblyContext(AssemblyContext context); + + /** + * Returns the parent context, or null if the context does not have one + */ + public CompositeContext getParent(); + + /** + * Sets the parent context + */ + public void setParent(CompositeContext parent); + + /** + * Adds runtime artifacts represented by the set of model objects to the composite context by merging them with + * existing artifacts. Implementing classes may support only a subset of {@link Part} types. + * + * @see org.apache.tuscany.model.assembly.Component + * @see org.apache.tuscany.model.assembly.ModuleComponent + * @see org.apache.tuscany.model.assembly.AtomicComponent + * @see org.apache.tuscany.model.assembly.EntryPoint + * @see org.apache.tuscany.model.assembly.ExternalService + */ + public void registerModelObjects(List models) throws ConfigurationException; + + /** + * Adds a runtime artifact represented by the model object to the composite context by merging it with existing + * artifacts. Implementing classes may support only a subset of {@link Part} types. + * + * @see org.apache.tuscany.model.assembly.Component + * @see org.apache.tuscany.model.assembly.ModuleComponent + * @see org.apache.tuscany.model.assembly.AtomicComponent + * @see org.apache.tuscany.model.assembly.EntryPoint + * @see org.apache.tuscany.model.assembly.ExternalService + */ + public void registerModelObject(Extensible model) throws ConfigurationException; + + /** + * Returns the child context associated with a given name + */ + public Context getContext(String name); + + /** + * Returns the composite managed by this composite context + */ + @Deprecated + public Composite getComposite(); + + public void removeContext(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ConfigurationContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ConfigurationContext.java new file mode 100644 index 0000000000..558de7609f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ConfigurationContext.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.WireBuilder; + +/** + * Offers configuration services in the runtime. A ConfigurationContext is able to configure a model and then buildSource the + * runtime representation corresponding to that model in the live system. + *

+ * Configuration contexts will typically be hierarchical, delegating to their parent after performing an + * operation. The parent ConfigurationContext will typically be injected into an implementation of this interface during + * registration. + * + * @version $Rev$ $Date$ + */ +public interface ConfigurationContext extends ContextFactoryBuilder, WireBuilder { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/Context.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/Context.java new file mode 100644 index 0000000000..df313d8000 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/Context.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * An entity that provides an execution context for a runtime artifact or artifacts. A Context may + * be a composite, managing child contexts or it may be an atomic, i.e. leaf, context. + * + * @version $Rev$ $Date$ + */ +public interface Context extends EventPublisher, Lifecycle { + /** + * Returns the instance associated with the requested name, which may be in a atomic or composite form. Atomic (i.e. + * leaf) contexts will return an instance associated with the service name part of the compound name, which may be + * null. + *

+ * Composite contexts will return an instance (likely a proxy) of a contained entry point context. In this case, the + * port name on the qualified name will correspond to the composite context name and the part name will be used to + * retrieve the contained entry point context. The latter may be null. If the contained context is not an entry + * point context, an exception will be thrown. + * + * @param qName a qualified name of the requested instance + * @return the implementation instance or a proxy to it + * @throws TargetException + * if an error occurs retrieving the instance or the requested component is not an entry + * point. + * @see CompositeContext + * @see org.apache.tuscany.model.assembly.EntryPoint + */ + public Object getInstance(QualifiedName qName) throws TargetException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextInitException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextInitException.java new file mode 100644 index 0000000000..e024a98b0e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextInitException.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Denotes an error encountered while initializing an instance context + * + * @version $Rev$ $Date$ + */ +public class ContextInitException extends ContextRuntimeException { + + public ContextInitException() { + super(); + } + + public ContextInitException(String message) { + super(message); + } + + public ContextInitException(String message, Throwable cause) { + super(message, cause); + } + + public ContextInitException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextRuntimeException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextRuntimeException.java new file mode 100644 index 0000000000..0d35f145dc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ContextRuntimeException.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * An unchecked exception encountered by an {@link org.apache.tuscany.core.context.Context} + * + * @version $Rev$ $Date$ + */ +public class ContextRuntimeException extends CoreRuntimeException { + + public ContextRuntimeException() { + super(); + } + + public ContextRuntimeException(String message) { + super(message); + } + + public ContextRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public ContextRuntimeException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/CoreRuntimeException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/CoreRuntimeException.java new file mode 100644 index 0000000000..63e6f18e99 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/CoreRuntimeException.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.common.TuscanyRuntimeException; + +/** + * The root exception for the runtime package. Exceptions occurring in the runtime are generally non-recoverable + * + * @version $Rev$ $Date$ + */ +public abstract class CoreRuntimeException extends TuscanyRuntimeException { + + public CoreRuntimeException() { + super(); + } + + public CoreRuntimeException(String message) { + super(message); + } + + public CoreRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public CoreRuntimeException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/DuplicateNameException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/DuplicateNameException.java new file mode 100644 index 0000000000..81a334d3c8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/DuplicateNameException.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Denotes an attempt to add a context with a name equal to an existing context + * + * @version $Rev$ $Date$ + */ +public class DuplicateNameException extends ContextRuntimeException { + + public DuplicateNameException() { + super(); + } + + public DuplicateNameException(String message) { + super(message); + } + + public DuplicateNameException(String message, Throwable cause) { + super(message, cause); + } + + public DuplicateNameException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EntryPointContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EntryPointContext.java new file mode 100644 index 0000000000..63feabc43c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EntryPointContext.java @@ -0,0 +1,69 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.wire.SourceWireFactory; + +/** + * The runtime artifact representing an entry point, EntryPointContext manages wire handler + * instances that expose service operations offered by a component in the parent composite. The wire handler + * instance is responsible for dispatching the request down an wire chain to the target instance. The wire + * chain may contain {@link org.apache.tuscany.core.wire.Interceptor}s and + * {@link org.apache.tuscany.core.wire.MessageHandler}s that implement policies or perform mediations on the + * wire. + *

+ * Entry point contexts are used by transport binding artifacts to invoke an operation on a service. The transport + * binding uses an {@link java.lang.reflect.InvocationHandler} instance obtained from the EntryPointContext + * to perform the wire as in: + * + *

+ *              CompositeContext compositeContext = ...
+ *              EntryPointContext ctx = (EntryPointContext) compositeContext.getContext("source");
+ *              Assert.assertNotNull(ctx);
+ *              InvocationHandler handler = (InvocationHandler) ctx.getHandler();
+ *              Object response = handler.invoke(null, operation, new Object[] { param });
+ * 
+ * + * The Proxy instance passed to InvocationHandler may be null as the client is invoking + * directly on the handler. + *

+ * Alternatively, the following will return a proxy implementing the service interface exposed by the entry point: + * + *

+ *              CompositeContext compositeContext = ...
+ *              EntryPointContext ctx = (EntryPointContext) compositeContext.getContext("source");
+ *              Assert.assertNotNull(ctx);
+ *              HelloWorld proxy = (Helloworld) ctx.getInstance(null); // service name not necessary
+ * 
+ * + * The proxy returned will be backed by the entry point wire chain. + * + * @version $Rev$ $Date$ + */ +public interface EntryPointContext extends Context { + + /** + * Returns the handler responsible for flowing a request through the entry point + * @throws TargetException + */ + public Object getHandler() throws TargetException; + + /** + * Returns the service interface configured for the entry poitn + */ + public Class getServiceInterface(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java new file mode 100644 index 0000000000..36b0f98928 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventContext.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Implementations are responsible for tracking scope keys associated with the current request. + * + * @version $Rev$ $Date$ + */ +public interface EventContext { + + /** + * Returns the unique key for the given identifier associated with the current request + */ + public Object getIdentifier(Object type); + + /** + * Sets the unique key for the given identifier associated with the current request + */ + public void setIdentifier(Object type, Object identifier); + + /** + * Clears the unique key for the given identifier associated with the current request + */ + public void clearIdentifier(Object type); + + /** + * Clears all identifiers associated with the current request + */ + public void clearIdentifiers(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventException.java new file mode 100644 index 0000000000..aaf26aee69 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventException.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Denotes an error encountered while firing a module event + * + * @version $Rev$ $Date$ + */ +public class EventException extends CoreRuntimeException { + + public EventException(String message, Throwable cause) { + super(message, cause); + } + + public EventException(String message) { + super(message); + } + + public EventException(Throwable cause) { + super(cause); + } + + public EventException() { + super(); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventFilter.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventFilter.java new file mode 100644 index 0000000000..ee1334bef2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventFilter.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.context.event.Event; + +import java.util.EventObject; + +/** + * Evaluates whether a {@link RuntimeEventListener} is applicable to a given runtime event + * + * @version $$Rev$$ $$Date$$ + */ +public interface EventFilter { + + /** + * Performs the actual evaluation on an event + */ + public boolean match(Event event); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventPublisher.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventPublisher.java new file mode 100644 index 0000000000..c7ccf88e25 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/EventPublisher.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.context.event.Event; + +/** + * Publishes events in the runtime + * + * @version $$Rev$$ $$Date$$ + */ +public interface EventPublisher { + + public void publish(Event object); + + /** + * Registers a listener to receive notifications for the context + */ + public void addListener(RuntimeEventListener listener); + + /** + * Registers a listener to receive notifications for the context + */ + public void addListener(EventFilter filter, RuntimeEventListener listener); + + + /** + * Removes a previously registered listener + */ + public void removeListener(RuntimeEventListener listener); + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java new file mode 100644 index 0000000000..f7b4a6c572 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ExternalServiceContext.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Manages an external service + * + * @version $Rev$ $Date$ + */ +public interface ExternalServiceContext extends Context { + + /** + * Returns the handler responsible for flowing a request through the external service + * @throws TargetException + */ + public Object getHandler() throws TargetException; + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/InvalidNameException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/InvalidNameException.java new file mode 100644 index 0000000000..65c709e569 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/InvalidNameException.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Denotes an invalid name + * + * @version $Rev$ $Date$ + */ +public class InvalidNameException extends ContextRuntimeException { + + public InvalidNameException() { + super(); + } + + public InvalidNameException(String message) { + super(message); + } + + public InvalidNameException(String message, Throwable cause) { + super(message, cause); + } + + public InvalidNameException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/Lifecycle.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/Lifecycle.java new file mode 100644 index 0000000000..6572841cf0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/Lifecycle.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2006 The Apache Software Foundation or its licensors as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * @version $Rev$ $Date$ + */ +public interface Lifecycle { + /* A configuration error state */ + int CONFIG_ERROR = -1; + /* Has not been initialized */ + int UNINITIALIZED = 0; + /* In the process of being configured and initialized */ + int INITIALIZING = 1; + /* Instantiated and configured */ + int INITIALIZED = 2; + /* Started */ + int STARTED = 4; + /* Configured and initialized */ + int RUNNING = 4; + /* In the process of being shutdown */ + int STOPPING = 5; + /* Has been shutdown and removed from the module */ + int STOPPED = 6; + /* In an error state */ + int ERROR = 7; + + /** + * Returns the lifecycle state + * + * @see #UNINITIALIZED + * @see #INITIALIZING + * @see #INITIALIZED + * @see #RUNNING + * @see #STOPPING + * @see #STOPPED + */ + int getLifecycleState(); + + /** + * Starts the Lifecycle. + * + * @throws CoreRuntimeException + */ + void start() throws CoreRuntimeException; + + /** + * Stops the Lifecycle. + * + * @throws CoreRuntimeException + */ + void stop() throws CoreRuntimeException; + + /** + * Returns the name of the Lifecycle. + * @return the name of the Lifecycle + */ + String getName(); + + /** + * Sets the name of the Lifecycle. + * @param name the name of the Lifecycle + */ + void setName(String name); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingContextFactoryException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingContextFactoryException.java new file mode 100644 index 0000000000..fd4d613e34 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingContextFactoryException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.config.ConfigurationException; + +/** + * + * @version $Rev$ $Date$ + */ +public class MissingContextFactoryException extends ConfigurationException { + private static final long serialVersionUID = 5140433835245354247L; + + public MissingContextFactoryException() { + } + + public MissingContextFactoryException(String message) { + super(message); + } + + public MissingContextFactoryException(String message, Throwable cause) { + super(message, cause); + } + + public MissingContextFactoryException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingImplementationException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingImplementationException.java new file mode 100644 index 0000000000..787e9cae20 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingImplementationException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.config.ConfigurationException; + +/** + * + * @version $Rev$ $Date$ + */ +public class MissingImplementationException extends ConfigurationException { + private static final long serialVersionUID = 7274481740916067128L; + + public MissingImplementationException() { + } + + public MissingImplementationException(String message) { + super(message); + } + + public MissingImplementationException(String message, Throwable cause) { + super(message, cause); + } + + public MissingImplementationException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingScopeException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingScopeException.java new file mode 100644 index 0000000000..53108e6e6b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/MissingScopeException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.config.ConfigurationException; + +/** + * + * @version $Rev$ $Date$ + */ +public class MissingScopeException extends ConfigurationException { + private static final long serialVersionUID = -6999184494724096056L; + + public MissingScopeException() { + } + + public MissingScopeException(String message) { + super(message); + } + + public MissingScopeException(String message, Throwable cause) { + super(message, cause); + } + + public MissingScopeException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ProxyConfigurationException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ProxyConfigurationException.java new file mode 100644 index 0000000000..2d15118c1c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ProxyConfigurationException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.config.ConfigurationException; + +/** + * + * @version $Rev$ $Date$ + */ +public class ProxyConfigurationException extends ConfigurationException { + private static final long serialVersionUID = -5860342620108741058L; + + public ProxyConfigurationException() { + } + + public ProxyConfigurationException(String message) { + super(message); + } + + public ProxyConfigurationException(String message, Throwable cause) { + super(message, cause); + } + + public ProxyConfigurationException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/QualifiedName.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/QualifiedName.java new file mode 100644 index 0000000000..a9a0baeff9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/QualifiedName.java @@ -0,0 +1,84 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * An evaluated name consisting of a part/port pair. In the runtime, a part generally 'contains' or 'provides' ports + * such as a module component/entry point or a component/service pair. + * + * @version $Rev$ $Date$ + */ +public class QualifiedName { + + private String qName; + + private String partName; + + private String portName; + + public static final String NAME_SEPARATOR = "/"; + + /** + * Constructs a new qualified name in the form of part/port where part is the parent context and port represents a + * child, which is either a service in the case of an atomic context or a contained context in the case of a composite. + * + * @throws InvalidNameException if the name is in an invalid format + */ + public QualifiedName(String qualifiedName) throws InvalidNameException { + if (qualifiedName == null){ + return; + } + int pos = qualifiedName.indexOf(QualifiedName.NAME_SEPARATOR); + switch (pos) { + case -1: + partName = qualifiedName; + break; + case 0: + throw new InvalidNameException(qualifiedName); + default: + partName = qualifiedName.substring(0, pos); + portName = qualifiedName.substring(pos + 1); + break; + } + qName = qualifiedName; + } + + /** + * Returns the parsed part name + */ + public String getPartName() { + return partName; + } + + /** + * Returns the parsed port name if the original is of the compound for part/port + */ + public String getPortName() { + return portName; + } + + /** + * Returns the full part/port name pair + */ + public String getQualifiedName() { + return qName; + } + + public String toString() { + return qName; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/RuntimeEventListener.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/RuntimeEventListener.java new file mode 100644 index 0000000000..89cc51f3fc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/RuntimeEventListener.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.context.event.Event; + +import java.util.EventListener; +import java.util.EventObject; + +/** + * Listeners observe events fired in the SCA runtime. + * + * @version $Rev$ $Date$ + */ +public interface RuntimeEventListener extends EventListener { + + public void onEvent(Event event); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeAwareContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeAwareContext.java new file mode 100644 index 0000000000..d57d59cb58 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeAwareContext.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.model.assembly.Scope; + +import java.util.Map; + +/** + * Denotes a composite context that supports scopes + * + * @version $Rev$ $Date$ + */ +public interface ScopeAwareContext extends CompositeContext { + + /** + * Returns an immutable collection of scopes keyed by type for the composite context + */ + public Map getScopeContexts(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeContext.java new file mode 100644 index 0000000000..c582bde2b4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeContext.java @@ -0,0 +1,74 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.builder.ContextFactory; + +import java.util.List; + +/** + * Manages the lifecycle and visibility of Contexts. + * + * @see org.apache.tuscany.core.context.Context + * + * @version $Rev$ $Date$ + */ +public interface ScopeContext extends Lifecycle, RuntimeEventListener { + + public Object getInstance(QualifiedName qName) throws TargetException; + + /** + * Returns whether implementation instances may be held for the duration of an wire + */ + public boolean isCacheable(); + + /** + * Registers the context factory used to construct instance contexts for the scope + */ + public void registerFactories(List> configurations); + + /** + * Adds a context factory to the scope + */ + public void registerFactory(ContextFactory configuration); + + /** + * Returns a context bound to the given name or null if the component does not exist. The returned context is bound + * to a key determined from the thread context. + */ + public Context getContext(String name); + + /** + * Returns a context bound to the given name and scoped to the given key or null if the context does not exist + */ + public Context getContextByKey(String name, Object key); + + /** + * Removes a context with the given name, determining the scope key from the thread context + * + * @throws ScopeRuntimeException + */ + public void removeContext(String name) throws ScopeRuntimeException; + + /** + * Removes a context bound to the given name and scope key + * + * @throws ScopeRuntimeException + */ + public void removeContextByKey(String name, Object key) throws ScopeRuntimeException; + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeIdentifier.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeIdentifier.java new file mode 100644 index 0000000000..d25477f71c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeIdentifier.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Implementations enable lazy retrieval of a scope id associated with a request, i.e. an id (and presumably a context) do not + * have to be generated if the scope is never accessed. Identifiers are associated with the current request thread and keyed on + * scope type. + * + * @version $Rev$ $Date$ + * @see org.apache.tuscany.core.context.EventContext + */ +public interface ScopeIdentifier { + + /** + * Returns the scope id for the request. + */ + public Object getIdentifier(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeInitializationException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeInitializationException.java new file mode 100644 index 0000000000..6ef5bfe9dd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeInitializationException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Denotes an initialization exception thrown by a scope container + * + * @version $Rev$ $Date$ + */ +public class ScopeInitializationException extends ScopeRuntimeException { + + public ScopeInitializationException() { + super(); + } + + public ScopeInitializationException(String message) { + super(message); + } + + public ScopeInitializationException(String message, Throwable cause) { + super(message, cause); + } + + public ScopeInitializationException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeRuntimeException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeRuntimeException.java new file mode 100644 index 0000000000..5022f7589d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeRuntimeException.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Denotes a general runtime exception encountered by a scope container + * + * @version $Rev$ $Date$ + */ +public class ScopeRuntimeException extends CoreRuntimeException { + + public ScopeRuntimeException() { + super(); + } + + public ScopeRuntimeException(String message) { + super(message); + } + + public ScopeRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public ScopeRuntimeException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeStrategy.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeStrategy.java new file mode 100644 index 0000000000..c01df8ff9e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ScopeStrategy.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.model.assembly.Scope; + +import java.util.Map; + +/** + * Implementations provide scope container creation facilities and scope semantics to the runtime + * + * @version $Rev$ $Date$ + */ +public interface ScopeStrategy { + + /* Denotes an undefined scope */ + public static final int SCOPE_NOT_FOUND = -3; + + /** + * Creates and returns new instances of configured scope containers + */ + public Map getScopeContexts(EventContext eventContext); + + /** + * Determines whether a wire proceeds from a source of higher scope to a target of lesser scope + */ + public boolean downScopeReference(Scope sourceScope, Scope targetScope); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ServiceNotFoundException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ServiceNotFoundException.java new file mode 100644 index 0000000000..ee8c9f91b8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/ServiceNotFoundException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.osoa.sca.ServiceRuntimeException; + +/** + * Denotes the specific case where a service was not found at runtime + * + * @version $Rev$ $Date$ + */ +public class ServiceNotFoundException extends ServiceRuntimeException { + + public ServiceNotFoundException() { + super(); + } + + public ServiceNotFoundException(String message) { + super(message); + } + + public ServiceNotFoundException(Throwable cause) { + super(cause); + } + + public ServiceNotFoundException(String message, Throwable cause) { + super(message, cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/SystemCompositeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/SystemCompositeContext.java new file mode 100644 index 0000000000..7e3b4b8045 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/SystemCompositeContext.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +import org.apache.tuscany.core.config.ConfigurationException; + +/** + * Marker type for system composite contexts + * + * @version $Rev$ $Date$ + */ +public interface SystemCompositeContext extends AutowireContext, ScopeAwareContext, ConfigurationContext { + + /** + * Register a simple Java Object as a system component. + * This is primarily intended for use by bootstrap code to create the initial + * configuration components. + * + * @param name the name of the resulting component + * @param service + * @param instance the Object that will become the component's implementation + * @throws ConfigurationException + */ + void registerJavaObject(String name, Class service, Object instance) throws ConfigurationException; +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/TargetException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/TargetException.java new file mode 100644 index 0000000000..dd39d06aa1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/TargetException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context; + +/** + * Denotes an error while performing an operation on a target component implementation instance or proxy + * + * @version $Rev$ $Date$ + */ +public class TargetException extends CoreRuntimeException { + + public TargetException() { + super(); + } + + public TargetException(String message) { + super(message); + } + + public TargetException(String message, Throwable cause) { + super(message, cause); + } + + public TargetException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java new file mode 100644 index 0000000000..cef0c25a63 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractEvent.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * A basic implementation of a runtime event + * + * @version $$Rev$$ $$Date$$ + */ +public abstract class AbstractEvent implements Event{ + + protected transient Object source; + + public AbstractEvent(Object source) { + assert (source !=null): "Source id was null"; + this.source = source; + } + + public Object getSource() { + return source; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java new file mode 100644 index 0000000000..c038f141b5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/AbstractRequestEvent.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Base implementation of a request event + * + * @version $$Rev$$ $$Date$$ + */ +public abstract class AbstractRequestEvent extends AbstractEvent implements RequestEvent { + + private Object id; + + /** + * Creates a new event + * @param source the source of the event + * @param id the id of the request associated with the event + */ + public AbstractRequestEvent(Object source, Object id) { + super(source); + assert (id !=null): "Request id was null"; + this.id = id; + } + + public Object getId(){ + return id; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java new file mode 100644 index 0000000000..5b370b8c73 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/Event.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Represents an event that is propagated in the runtime + * + * @version $$Rev$$ $$Date$$ + */ +public interface Event { + + /** + * Returns the source of the event + */ + public Object getSource(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBound.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBound.java new file mode 100644 index 0000000000..8af7042ad3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionBound.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + + +/** + * An event propagated when an HTTP session is bound to the current request + * + * @version $$Rev$$ $$Date$$ + */ +public class HttpSessionBound extends HttpSessionEvent implements SessionBound { + + /** + * Creates a new event + * @param source the source of the event + * @param id the id of the HTTP session associated with the event or possibly a lazy wrapper + */ + public HttpSessionBound(Object source, Object id) { + super(source,id); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEnd.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEnd.java new file mode 100644 index 0000000000..3b2aff1353 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEnd.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Propagated when an HTTP-based session is expired + * + * @version $$Rev$$ $$Date$$ + */ +public class HttpSessionEnd extends HttpSessionEvent implements SessionEnd { + + /** + * Creates a new event + * @param source the source of the event + * @param id the id of the HTTP session being ended + */ + public HttpSessionEnd(Object source, Object id) { + super(source,id); + } + + } diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java new file mode 100644 index 0000000000..ecfbefa808 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/HttpSessionEvent.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * A base implementation of HTTP-based session events in the runtime + * + * @version $$Rev$$ $$Date$$ + */ +public abstract class HttpSessionEvent implements SessionEvent { + + // FIXME this needs to be made private and not directly referenced in the runtime + public static final Object HTTP_IDENTIFIER = new Object(); + + private Object id; + protected transient Object source; + + public HttpSessionEvent(Object source, Object id) { + assert (source !=null): "Source id was null"; + assert (id !=null): "Session id was null"; + this.source = source; + this.id = id; + } + + public Object getSource() { + return source; + } + + public Object getId(){ + return id; + } + + public Object getSessionTypeIdentifier(){ + return HTTP_IDENTIFIER; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreated.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreated.java new file mode 100644 index 0000000000..d157b4b1e1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/InstanceCreated.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * An event propagated upon the creation of an instance belonging to a {@link org.apache.tuscany.core.context.Context} + * + * @version $$Rev$$ $$Date$$ + */ +public class InstanceCreated extends AbstractEvent { + + public InstanceCreated(Object source) { + super(source); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java new file mode 100644 index 0000000000..48de538048 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleEvent.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Implemented by runtime events associated with a module, e.g. lifecycle events + * + * @version $$Rev$$ $$Date$$ + */ +public interface ModuleEvent extends Event{ + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStart.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStart.java new file mode 100644 index 0000000000..d953ddd65f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStart.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Propagated when a module starts + * + * @version $$Rev$$ $$Date$$ + */ +public class ModuleStart extends AbstractEvent implements ModuleEvent { + + public ModuleStart(Object source) { + super(source); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStop.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStop.java new file mode 100644 index 0000000000..fb3c31bdff --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/ModuleStop.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Propagated when a module stops + * + * @version $$Rev$$ $$Date$$ + */ +public class ModuleStop extends AbstractEvent implements ModuleEvent{ + + public ModuleStop(Object source) { + super(source); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEnd.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEnd.java new file mode 100644 index 0000000000..1cbe024be3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEnd.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Propagated when a request completes or is ended + * + * @version $$Rev$$ $$Date$$ + */ +public class RequestEnd extends AbstractRequestEvent{ + + /** + * Creates a new event + * @param source the source of the event + * @param id the id of the completed/ended request + */ + public RequestEnd(Object source, Object id) { + super(source,id); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java new file mode 100644 index 0000000000..0b7e1b8005 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestEvent.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */package org.apache.tuscany.core.context.event; + +/** + * Implemented by runtime events associated request + * @version $$Rev$$ $$Date$$ + */ +public interface RequestEvent { + + /** + * Returns the id of the request the event is associated with + */ + public Object getId(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStart.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStart.java new file mode 100644 index 0000000000..8c07a3d607 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/RequestStart.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Propagated when a request is started in the runtime + * + * @version $$Rev$$ $$Date$$ + */ +public class RequestStart extends AbstractRequestEvent { + + /** + * Creates a new event + * @param source the source of the event + * @param id the id of the request being started + */ + public RequestStart(Object source, Object id) { + super(source,id); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBound.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBound.java new file mode 100644 index 0000000000..5d977911be --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionBound.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Propagated when a generic session is associated with the current request. + * + * @version $$Rev$$ $$Date$$ + */ +public interface SessionBound extends SessionEvent { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEnd.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEnd.java new file mode 100644 index 0000000000..809d63bd0f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEnd.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Propagated when a session ended or expired + * + * @version $$Rev$$ $$Date$$ + */ +public interface SessionEnd extends SessionEvent{ + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java new file mode 100644 index 0000000000..7eaff1de24 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionEvent.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Implemented by runtime events associated with a session. There may be multiple session types in the runtime such as + * HTTP-based or conversational. + * + * @version $$Rev$$ $$Date$$ + */ +public interface SessionEvent extends Event { + + /** + * Returns the unique key identifying the session type the event is associated with, e.g. an HTTP-based or conversational + * session + */ + public Object getSessionTypeIdentifier(); + + /** + * Returns the session id associated with the event + */ + public Object getId(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionStart.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionStart.java new file mode 100644 index 0000000000..cfe490e2ff --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/event/SessionStart.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.event; + +/** + * Propagated when a session starts + * + * @version $$Rev$$ $$Date$$ + */ +public interface SessionStart extends SessionEvent{ + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/filter/TrueFilter.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/filter/TrueFilter.java new file mode 100644 index 0000000000..35601646f2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/filter/TrueFilter.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.filter; + +import org.apache.tuscany.core.context.EventFilter; +import org.apache.tuscany.core.context.event.Event; + +/** + * An event filter that always returns a true condition + * + * @version $$Rev$$ $$Date$$ + */ +public class TrueFilter implements EventFilter { + + public boolean match(Event event) { + return true; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java new file mode 100644 index 0000000000..c9e563302c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractCompositeContext.java @@ -0,0 +1,852 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import org.apache.tuscany.common.TuscanyRuntimeException; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.AutowireResolutionException; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.ConfigurationContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.ContextInitException; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.DuplicateNameException; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.EventException; +import org.apache.tuscany.core.context.Lifecycle; +import org.apache.tuscany.core.context.MissingContextFactoryException; +import org.apache.tuscany.core.context.MissingImplementationException; +import org.apache.tuscany.core.context.MissingScopeException; +import org.apache.tuscany.core.context.ProxyConfigurationException; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeAwareContext; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.ScopeStrategy; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.event.Event; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.event.SessionBound; +import org.apache.tuscany.core.context.event.SessionEvent; +import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.system.annotation.ParentContext; +import org.apache.tuscany.core.system.assembly.SystemBinding; +import org.apache.tuscany.core.wire.InvocationConfiguration; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.WireConfiguration; +import org.apache.tuscany.core.wire.WireFactory; +import org.apache.tuscany.core.wire.WireFactoryInitException; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.Composite; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Extensible; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Implementation; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; + +/** + * The base implementation of a composite context + * + * @version $Rev$ $Date$ + */ +@SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized", "RawUseOfParameterizedType", "NonPrivateFieldAccessedInSynchronizedContext"}) +public abstract class AbstractCompositeContext extends AbstractContext implements AutowireContext, ScopeAwareContext, ConfigurationContext { + + public static final int DEFAULT_WAIT = 1000 * 60; + + protected AssemblyContext assemblyContext; + + protected CompositeContext parentContext; + + // The parent configuration context, if one exists + @Autowire + protected ConfigurationContext configurationContext; + + // The logical model representing the module assembly + // protected ModuleComponent moduleComponent; + protected Module module; + + protected Map> configurations = new HashMap>(); + + // Factory for scope contexts + protected ScopeStrategy scopeStrategy; + + // The event context for associating context events to threads + protected EventContext eventContext; + + // The scopes for this context + protected Map scopeContexts; + + protected Map immutableScopeContexts; + + // A component context name to scope context index + protected Map scopeIndex; + + // Blocking latch to ensure the module is initialized exactly once prior to servicing requests + protected CountDownLatch initializeLatch = new CountDownLatch(1); + + protected final Object lock = new Object(); + + // Indicates whether the module context has been initialized + protected boolean initialized; + + // a mapping of service type to component name + private final Map autowireInternal = new ConcurrentHashMap(); + private final Map autowireExternal = new ConcurrentHashMap(); + + private AutowireContext autowireContext; + + public AbstractCompositeContext() { + scopeIndex = new ConcurrentHashMap(); + // FIXME the factory should be injected + module = new AssemblyFactoryImpl().createModule(); + scopeStrategy = new DefaultScopeStrategy(); + } + + public AbstractCompositeContext(String name, CompositeContext parent, ScopeStrategy strategy, EventContext ctx, ConfigurationContext configCtx) { + super(name); + if (strategy == null) { + strategy = new DefaultScopeStrategy(); + } + this.scopeStrategy = strategy; + this.eventContext = ctx; + this.configurationContext = configCtx; + scopeIndex = new ConcurrentHashMap(); + parentContext = parent; + // FIXME the factory should be injected + module = new AssemblyFactoryImpl().createModule(); + } + + public void setAssemblyContext(AssemblyContext assemblyContext) { + this.assemblyContext = assemblyContext; + } + + private String uri; + + public String getURI() { + return uri; + } + + public void setURI(String uri) { + this.uri = uri; + } + + + public void start() { + synchronized (lock) { + try { + if (lifecycleState == STOPPED) { + throw new IllegalStateException("Context cannot be restarted - create a new one"); + } else if (lifecycleState != UNINITIALIZED) { + throw new IllegalStateException("Context not in UNINITIALIZED state"); + } + + lifecycleState = INITIALIZING; + initializeScopes(); + + Map>> configurationsByScope = new EnumMap>>(Scope.class); + if (configurations != null) { + for (ContextFactory contextFactory : configurations.values()) { + // FIXME scopes are defined at the interface level + Scope sourceScope = contextFactory.getScope(); + wireSource(contextFactory); + buildTarget(contextFactory); + scopeIndex.put(contextFactory.getName(), scopeContexts.get(sourceScope)); + List> list = configurationsByScope.get(sourceScope); + if (list == null) { + list = new ArrayList>(); + configurationsByScope.put(sourceScope, list); + } + list.add(contextFactory); + } + } + for (EntryPoint ep : module.getEntryPoints()) { + registerAutowire(ep); + } + for (Component component : module.getComponents()) { + if (component instanceof ModuleComponent) { + registerAutowire((ModuleComponent) component); + } else { + registerAutowire(component); + } + } + for (ExternalService es : module.getExternalServices()) { + registerAutowire(es); + } + for (Map.Entry>> entries : configurationsByScope.entrySet()) + { + // register configurations with scope contexts + ScopeContext scope = scopeContexts.get(entries.getKey()); + scope.registerFactories(entries.getValue()); + } + initializeWireFactories(); + for (ScopeContext scope : scopeContexts.values()) { + // register scope contexts as a listeners for events in the composite context + addListener(scope); + scope.start(); + } + lifecycleState = RUNNING; + } catch (WireFactoryInitException e) { + lifecycleState = ERROR; + ContextInitException cie = new ContextInitException(e); + cie.addContextName(getName()); + throw cie; + } catch (CoreRuntimeException e) { + lifecycleState = ERROR; + e.addContextName(getName()); + throw e; + } finally { + initialized = true; + // release the latch and allow requests to be processed + initializeLatch.countDown(); + } + } + } + + public void stop() { + if (lifecycleState == STOPPED) { + return; + } + // need to block a start until reset is complete + initializeLatch = new CountDownLatch(1); //xcv + lifecycleState = STOPPING; + initialized = false; + if (scopeContexts != null) { + for (ScopeContext scopeContext : scopeContexts.values()) { + if (scopeContext.getLifecycleState() == Lifecycle.RUNNING) { + scopeContext.stop(); + } + } + } + scopeContexts = null; + scopeIndex.clear(); + // allow initialized to be called + initializeLatch.countDown(); + lifecycleState = STOPPED; + + } + + public void setModule(Module module) { + assert (module != null) : "Module cannot be null"; + name = module.getName(); + this.module = module; + } + + public void setEventContext(EventContext eventContext) { + this.eventContext = eventContext; + } + + public void setConfigurationContext(ConfigurationContext context) { + this.configurationContext = context; + } + + public CompositeContext getParent() { + return parentContext; + } + + @ParentContext + public void setParent(CompositeContext parent) { + parentContext = parent; + } + + public void registerModelObjects(List models) throws ConfigurationException { + assert (models != null) : "Model object collection was null"; + for (Extensible model : models) { + registerModelObject(model); + } + } + + public void registerModelObject(Extensible model) throws ConfigurationException { + assert (model != null) : "Model object was null"; + initializeScopes(); + if (configurationContext != null) { + try { + configurationContext.build(model); + } catch (BuilderConfigException e) { + e.addContextName(getName()); + throw e; + } + } + ContextFactory configuration; + if (model instanceof Module) { + // merge new module definition with the existing one + Module oldModule = module; + Module newModule = (Module) model; + module = newModule; + for (Component component : newModule.getComponents()) { + Implementation componentImplementation = component.getImplementation(); + if (componentImplementation == null) { + ConfigurationException e = new MissingImplementationException("Component implementation not set"); + e.addContextName(component.getName()); + e.addContextName(getName()); + throw e; + } + configuration = (ContextFactory) component.getContextFactory(); + if (configuration == null) { + ConfigurationException e = new MissingContextFactoryException("Context factory not set"); + e.addContextName(component.getName()); + e.addContextName(getName()); + throw e; + } + registerConfiguration(configuration); + if (component instanceof ModuleComponent) { + registerAutowire((ModuleComponent) component); + } else { + registerAutowire(component); + } + } + for (EntryPoint ep : newModule.getEntryPoints()) { + configuration = (ContextFactory) ep.getContextFactory(); + if (configuration == null) { + ConfigurationException e = new MissingContextFactoryException("Context factory not set"); + e.setIdentifier(ep.getName()); + e.addContextName(getName()); + throw e; + } + registerConfiguration(configuration); + registerAutowire(ep); + } + for (ExternalService service : newModule.getExternalServices()) { + configuration = (ContextFactory) service.getContextFactory(); + if (configuration == null) { + ConfigurationException e = new MissingContextFactoryException("Context factory not set"); + e.setIdentifier(service.getName()); + e.addContextName(getName()); + throw e; + } + registerConfiguration(configuration); + registerAutowire(service); + } + if (lifecycleState == RUNNING) { + for (Component component : newModule.getComponents()) { + ContextFactory contextFactory = (ContextFactory) component.getContextFactory(); + wireSource(contextFactory); + buildTarget(contextFactory); + contextFactory.prepare(this); + try { + if (contextFactory.getSourceWireFactories() != null) { + for (SourceWireFactory sourceWireFactory : contextFactory.getSourceWireFactories()) + { + sourceWireFactory.initialize(); + } + } + if (contextFactory.getTargetWireFactories() != null) { + for (TargetWireFactory targetWireFactory : contextFactory.getTargetWireFactories() + .values()) { + targetWireFactory.initialize(); + } + } + } catch (WireFactoryInitException e) { + ProxyConfigurationException ce = new ProxyConfigurationException(e); + ce.addContextName(getName()); + throw ce; + } + + } + for (EntryPoint ep : newModule.getEntryPoints()) { + ContextFactory contextFactory = (ContextFactory) ep.getContextFactory(); + wireSource(contextFactory); + buildTarget(contextFactory); + contextFactory.prepare(this); + try { + if (contextFactory.getSourceWireFactories() != null) { + for (SourceWireFactory sourceWireFactory : contextFactory.getSourceWireFactories()) + { + sourceWireFactory.initialize(); + } + } + if (contextFactory.getTargetWireFactories() != null) { + for (TargetWireFactory targetWireFactory : contextFactory.getTargetWireFactories() + .values()) { + targetWireFactory.initialize(); + } + } + } catch (WireFactoryInitException e) { + ProxyConfigurationException ce = new ProxyConfigurationException(e); + ce.addContextName(getName()); + throw ce; + } + + } + for (ExternalService es : newModule.getExternalServices()) { + ContextFactory contextFactory = (ContextFactory) es.getContextFactory(); + wireSource(contextFactory); + buildTarget(contextFactory); + contextFactory.prepare(this); + try { + if (contextFactory.getSourceWireFactories() != null) { + for (SourceWireFactory sourceWireFactory : contextFactory.getSourceWireFactories()) + { + sourceWireFactory.initialize(); + } + } + if (contextFactory.getTargetWireFactories() != null) { + for (WireFactory targetWireFactory : contextFactory.getTargetWireFactories() + .values()) { + targetWireFactory.initialize(); + } + } + } catch (WireFactoryInitException e) { + ProxyConfigurationException ce = new ProxyConfigurationException(e); + ce.addContextName(getName()); + throw ce; + } + + } + + } + // merge existing module component assets + module.getComponents().addAll(oldModule.getComponents()); + module.getEntryPoints().addAll(oldModule.getEntryPoints()); + module.getExternalServices().addAll(oldModule.getExternalServices()); + } else { + if (model instanceof Component) { + Component component = (Component) model; + module.getComponents().add(component); + configuration = (ContextFactory) component.getContextFactory(); + if (configuration == null) { + ConfigurationException e = new MissingContextFactoryException("Context factory not set"); + e.setIdentifier(component.getName()); + e.addContextName(getName()); + throw e; + } + registerConfiguration(configuration); + if (component instanceof ModuleComponent) { + registerAutowire((ModuleComponent) component); + } else { + registerAutowire(component); + } + } else if (model instanceof EntryPoint) { + EntryPoint ep = (EntryPoint) model; + module.getEntryPoints().add(ep); + configuration = (ContextFactory) ep.getContextFactory(); + if (configuration == null) { + ConfigurationException e = new MissingContextFactoryException("Context factory not set"); + e.setIdentifier(ep.getName()); + e.addContextName(getName()); + throw e; + } + registerConfiguration(configuration); + registerAutowire(ep); + } else if (model instanceof ExternalService) { + ExternalService service = (ExternalService) model; + module.getExternalServices().add(service); + configuration = (ContextFactory) service.getContextFactory(); + if (configuration == null) { + ConfigurationException e = new MissingContextFactoryException("Context factory not set"); + e.setIdentifier(service.getName()); + e.addContextName(getName()); + throw e; + } + registerConfiguration(configuration); + registerAutowire(service); + } else { + BuilderConfigException e = new BuilderConfigException("Unknown model type"); + e.setIdentifier(model.getClass().getName()); + e.addContextName(getName()); + throw e; + } + } + } + + protected void registerConfiguration(ContextFactory factory) throws ConfigurationException { + factory.prepare(this); + if (lifecycleState == RUNNING) { + if (scopeIndex.get(factory.getName()) != null) { + throw new DuplicateNameException(factory.getName()); + } + try { + ScopeContext scope = scopeContexts.get(factory.getScope()); + if (scope == null) { + ConfigurationException e = new MissingScopeException("Component has an unknown scope"); + e.addContextName(factory.getName()); + e.addContextName(getName()); + throw e; + } + scope.registerFactory(factory); + scopeIndex.put(factory.getName(), scope); + } catch (TuscanyRuntimeException e) { + e.addContextName(getName()); + throw e; + } + configurations.put(factory.getName(), factory); // xcv + } else { + if (configurations.get(factory.getName()) != null) { + throw new DuplicateNameException(factory.getName()); + } + configurations.put(factory.getName(), factory); + } + + } + + public void fireEvent(int eventType, Object message) throws EventException { + throw new UnsupportedOperationException(); + } + + public void publish(Event event) { + checkInit(); + if (event instanceof SessionBound) { + SessionEvent sessionEvent = ((SessionBound) event); + // update context + eventContext.setIdentifier(sessionEvent.getSessionTypeIdentifier(), sessionEvent.getId()); + } else if (event instanceof RequestEnd) { + // be very careful with pooled threads, ensuring threadlocals are cleaned up + eventContext.clearIdentifiers(); + } + super.publish(event); + } + + public Context getContext(String componentName) { + checkInit(); + assert (componentName != null) : "Name was null"; + ScopeContext scope = scopeIndex.get(componentName); + if (scope == null) { + return null; + } + return scope.getContext(componentName); + + } + + public Object getInstance(QualifiedName qName) throws TargetException { + assert (qName != null) : "Name was null "; + // use the port name to get the context since entry points ports + ScopeContext scope = scopeIndex.get(qName.getPortName()); + if (scope == null) { + return null; + } + Context ctx = scope.getContext(qName.getPortName()); + if (!(ctx instanceof EntryPointContext)) { + TargetException e = new TargetException("Target not an entry point"); + e.setIdentifier(qName.getQualifiedName()); + e.addContextName(name); + throw e; + } + return ctx.getInstance(null); + } + + public Map getScopeContexts() { + initializeScopes(); + return immutableScopeContexts; + } + + /** + * Blocks until the module context has been initialized + */ + protected void checkInit() { + if (lifecycleState == STOPPED) { + throw new IllegalStateException("Context cannot be restarted - create a new one"); + } + if (!initialized) { + try { + /* block until the module has initialized */ + boolean success = initializeLatch.await(DEFAULT_WAIT, TimeUnit.MILLISECONDS); + if (!success) { + throw new ContextInitException("Timeout waiting for module context to initialize"); + } + } catch (InterruptedException e) { // should not happen + } + } + + } + + protected void initializeScopes() { + if (scopeContexts == null) { + scopeContexts = scopeStrategy.getScopeContexts(eventContext); + immutableScopeContexts = Collections.unmodifiableMap(scopeContexts); + } + } + + /** + * Iterates through references and delegates to the configuration context to wire them to their targets + */ + protected void wireSource(ContextFactory source) { + Scope sourceScope = source.getScope(); + if (source.getSourceWireFactories() != null) { + for (SourceWireFactory sourceFactory : source.getSourceWireFactories()) { + WireConfiguration wireConfiguration = sourceFactory.getConfiguration(); + QualifiedName targetName = wireConfiguration.getTargetName(); + ContextFactory target = configurations.get(targetName.getPartName()); + if (target == null) { + ContextInitException e = new ContextInitException("Target not found"); + e.setIdentifier(targetName.getPartName()); + e.addContextName(source.getName()); + e.addContextName(name); + throw e; + } + // get the proxy chain for the target + TargetWireFactory targetFactory = target.getTargetWireFactory(targetName.getPortName()); + if (targetFactory == null) { + ContextInitException e = new ContextInitException("No proxy factory found for service"); + e.setIdentifier(wireConfiguration.getTargetName().getPortName()); + e.addContextName(target.getName()); + e.addContextName(source.getName()); + e.addContextName(name); + throw e; + } + try { + boolean downScope = scopeStrategy.downScopeReference(sourceScope, target.getScope()); + configurationContext.connect(sourceFactory, targetFactory, target.getClass(), downScope, scopeContexts + .get(target.getScope())); + } catch (BuilderConfigException e) { + e.addContextName(target.getName()); + e.addContextName(source.getName()); + e.addContextName(name); + throw e; + } + + } + } + // wire invokers when the proxy only contains the target chain + if (source.getTargetWireFactories() != null) { + for (TargetWireFactory targetFactory : source.getTargetWireFactories().values()) { + try { + configurationContext.completeTargetChain(targetFactory, source.getClass(), scopeContexts.get(sourceScope)); + } catch (BuilderConfigException e) { + e.addContextName(source.getName()); + e.addContextName(name); + throw e; + } + } + } + } + + /** + * Signals to target side of reference configurations to initialize + */ + protected void buildTarget(ContextFactory target) { + Map targetProxyFactories = target.getTargetWireFactories(); + if (targetProxyFactories != null) { + for (TargetWireFactory targetFactory : targetProxyFactories.values()) { + for (InvocationConfiguration iConfig : targetFactory + .getConfiguration().getInvocationConfigurations().values()) { + iConfig.build(); + } + } + } + } + + protected void initializeWireFactories() throws WireFactoryInitException { + for (ContextFactory config : configurations.values()) { + List sourceProxyFactories = config.getSourceWireFactories(); + if (sourceProxyFactories != null) { + for (WireFactory sourceWireFactory : sourceProxyFactories) { + sourceWireFactory.initialize(); + } + } + if (sourceProxyFactories != null) { + Map targetWireFactories = config.getTargetWireFactories(); + for (TargetWireFactory targetWireFactory : targetWireFactories.values()) { + targetWireFactory.initialize(); + } + } + } + } + + public Composite getComposite() { + return module; + } + + @Autowire + public void setAutowireContext(AutowireContext context) { + autowireContext = context; + } + + public T resolveInstance(Class instanceInterface) throws AutowireResolutionException { + if (ConfigurationContext.class.equals(instanceInterface)) { + return instanceInterface.cast(this); + } else if (AutowireContext.class.equals(instanceInterface)) { + return instanceInterface.cast(this); + } else if (AssemblyContext.class.equals(instanceInterface)) { + return instanceInterface.cast(assemblyContext); + } + + NameToScope nts = autowireInternal.get(instanceInterface); + if (nts != null) { + try { + return instanceInterface.cast(nts.getScopeContext().getInstance(nts.getName())); + } catch (TargetException e) { + AutowireResolutionException ae = new AutowireResolutionException("Autowire instance not found", e); + ae.addContextName(getName()); + throw ae; + } + } else if (autowireContext != null) { + try { + // resolve to parent + return autowireContext.resolveInstance(instanceInterface); + } catch (AutowireResolutionException e) { + e.addContextName(getName()); + throw e; + } + } else { + return null; + } + } + + public T resolveExternalInstance(Class instanceInterface) throws AutowireResolutionException { + NameToScope nts = autowireExternal.get(instanceInterface); + if (nts != null) { + try { + return instanceInterface.cast(nts.getScopeContext().getInstance(nts.getName())); + } catch (TargetException e) { + AutowireResolutionException ae = new AutowireResolutionException("Autowire instance not found", e); + ae.addContextName(getName()); + throw ae; + } + } else { + return null; + } + } + + private void registerAutowire(ExternalService service) { + } + + private void registerAutowire(ModuleComponent component) { + for (EntryPoint ep : component.getImplementation().getEntryPoints()) { + for (Binding binding : ep.getBindings()) { + if (binding instanceof SystemBinding) { + Class interfaze = ep.getConfiguredService().getPort().getServiceContract().getInterface(); + ScopeContext scope = scopeContexts.get(Scope.AGGREGATE); + String qname = component.getName() + QualifiedName.NAME_SEPARATOR + ep.getName(); + registerAutowireInternal(interfaze, qname, scope); + } + } + } + } + + private void registerAutowire(Component component) { + for (Service service : component.getImplementation().getComponentType().getServices()) { + Class interfaze = service.getServiceContract().getInterface(); + ScopeContext scopeCtx = scopeContexts.get(service.getServiceContract().getScope()); + registerAutowireInternal(interfaze, component.getName(), scopeCtx); + } + } + + protected void registerAutowireInternal(Class interfaze, String name, ScopeContext scopeContext) { + assert interfaze != null; + if (autowireInternal.containsKey(interfaze)) { + return; + } + QualifiedName qname = new QualifiedName(name); + NameToScope nts = new NameToScope(qname, scopeContext); + autowireInternal.put(interfaze, nts); + } + + private void registerAutowire(EntryPoint ep) { + for (Binding binding : ep.getBindings()) { + if (binding instanceof SystemBinding) { + Class interfaze = ep.getConfiguredService().getPort().getServiceContract().getInterface(); + ScopeContext scope = scopeContexts.get(((ContextFactory) ep.getContextFactory()).getScope()); + registerAutowireExternal(interfaze, ep.getName(), scope); + } + } + } + + protected void registerAutowireExternal(Class interfaze, String name, ScopeContext scopeContext) { + assert interfaze != null; + if (autowireExternal.containsKey(interfaze)) { + return; + } + QualifiedName qname = new QualifiedName(name); + NameToScope nts = new NameToScope(qname, scopeContext); + autowireExternal.put(interfaze, nts); + } + + protected static class NameToScope { + + private final QualifiedName qName; + + private final ScopeContext scope; + + public NameToScope(QualifiedName name, ScopeContext scope) { + this.qName = name; + this.scope = scope; + } + + public QualifiedName getName() { + return qName; + } + + public ScopeContext getScopeContext() { + return scope; + } + } + + + public void build(AssemblyObject model) throws BuilderConfigException { + if (configurationContext != null) { + try { + configurationContext.build(model); + } catch (BuilderConfigException e) { + e.addContextName(getName()); + throw e; + } + } + } + + public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, + ScopeContext targetScopeContext) throws BuilderConfigException { + if (configurationContext != null) { + try { + configurationContext.connect(sourceFactory, targetFactory, targetType, downScope, targetScopeContext); + } catch (BuilderConfigException e) { + e.addContextName(getName()); + throw e; + } + } + } + + public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) + throws BuilderConfigException { + if (configurationContext != null) { + try { + configurationContext.completeTargetChain(targetFactory, targetType, targetScopeContext); + } catch (BuilderConfigException e) { + e.addContextName(getName()); + throw e; + } + } + } + + + public void removeContext(String name){ + configurations.remove(name); + ScopeContext ctx = scopeIndex.remove(name); + if (ctx != null){ + ctx.removeContext(name); + } + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractContext.java new file mode 100644 index 0000000000..680267d53e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractContext.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.impl; + +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.RuntimeEventListener; +import org.apache.tuscany.core.context.EventFilter; +import org.apache.tuscany.core.context.event.Event; +import org.apache.tuscany.core.context.filter.TrueFilter; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Functionality common to all Context implementations + * + * @version $Rev$ $Date$ + */ +public abstract class AbstractContext extends AbstractLifecycle implements Context { + + public AbstractContext() { + } + + public AbstractContext(String name) { + super(name); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractLifecycle.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractLifecycle.java new file mode 100644 index 0000000000..ddeebe361f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/AbstractLifecycle.java @@ -0,0 +1,129 @@ +/** + * + * Copyright 2006 The Apache Software Foundation or its licensors as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.impl; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.tuscany.core.context.RuntimeEventListener; +import org.apache.tuscany.core.context.EventFilter; +import org.apache.tuscany.core.context.Lifecycle; +import org.apache.tuscany.core.context.filter.TrueFilter; +import org.apache.tuscany.core.context.event.Event; + +/** + * @version $Rev$ $Date$ + */ +public class AbstractLifecycle { + private static final EventFilter TRUE_FILTER = new TrueFilter(); + protected String name; + protected int lifecycleState = Lifecycle.UNINITIALIZED; + // Listeners for context events + private Map> listeners; + + public AbstractLifecycle(String name) { + this.name = name; + } + + public AbstractLifecycle() { + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getLifecycleState() { + return lifecycleState; + } + + public void addListener(RuntimeEventListener listener) { + addListener(TRUE_FILTER, listener); + } + + public void removeListener(RuntimeEventListener listener) { + assert (listener != null) : "Listener cannot be null"; + synchronized(getListeners()){ + for (List currentList :getListeners().values() ) { + for(RuntimeEventListener current : currentList){ + if (current == listener){ + currentList.remove(current); + return; + } + } + } + } + } + + public void addListener(EventFilter filter, RuntimeEventListener listener){ + assert (listener != null) : "Listener cannot be null"; + synchronized (getListeners()){ + List list = getListeners().get(filter); + if (list == null){ + list = new CopyOnWriteArrayList(); + listeners.put(filter,list); + } + list.add(listener); + } + } + + public void publish(Event event){ + assert(event != null): "Event object was null"; + for(Map.Entry> entry :getListeners().entrySet()){ + if(entry.getKey().match(event)){ + for(RuntimeEventListener listener : entry.getValue()){ + listener.onEvent(event); + } + } + } + } + + protected Map> getListeners(){ + if (listeners == null) { + listeners = new ConcurrentHashMap>(); + } + return listeners; + } + + public String toString() { + switch (lifecycleState) { + case (Lifecycle.CONFIG_ERROR): + return "Context [" + name + "] in state [CONFIG_ERROR]"; + case (Lifecycle.ERROR): + return "Context [" + name + "] in state [ERROR]"; + case (Lifecycle.INITIALIZING): + return "Context [" + name + "] in state [INITIALIZING]"; + case (Lifecycle.INITIALIZED): + return "Context [" + name + "] in state [INITIALIZED]"; + case (Lifecycle.RUNNING): + return "Context [" + name + "] in state [RUNNING]"; + case (Lifecycle.STOPPING): + return "Context [" + name + "] in state [STOPPING]"; + case (Lifecycle.STOPPED): + return "Context [" + name + "] in state [STOPPED]"; + case (Lifecycle.UNINITIALIZED): + return "Context [" + name + "] in state [UNINITIALIZED]"; + default: + return "Context [" + name + "] in state [UNKNOWN]"; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java new file mode 100644 index 0000000000..ec3d1bc9c0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/CompositeContextImpl.java @@ -0,0 +1,113 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.impl; + +import org.osoa.sca.ModuleContext; +import org.osoa.sca.RequestContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.ServiceUnavailableException; + +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.ConfigurationContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.ScopeStrategy; +import org.apache.tuscany.core.context.ServiceNotFoundException; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.system.annotation.Autowire; + +/** + * The standard implementation of an composite context. Autowiring is performed by delegating to the parent context. + * + * @version $Rev$ $Date$ + */ +public class CompositeContextImpl extends AbstractCompositeContext implements ModuleContext { + + @Autowire + public void setScopeStrategy(ScopeStrategy scopeStrategy) { + if (scopeStrategy != null) { + this.scopeStrategy = scopeStrategy; + } + } + + public CompositeContextImpl() { + super(); + eventContext = new EventContextImpl(); + } + + public CompositeContextImpl(String name, CompositeContext parent, ScopeStrategy strategy, EventContext ctx, + ConfigurationContext configCtx) { + super(name, parent, strategy, ctx, configCtx); + } + + public CompositeContextImpl(String name, CompositeContext parent, AutowireContext autowireContext, ScopeStrategy strategy, + EventContext ctx, ConfigurationContext configCtx) { + super(name, parent, strategy, ctx, configCtx); + setAutowireContext(autowireContext); + } + + // ---------------------------------- + // ModuleContext methods + // ---------------------------------- + + public Object locateService(String qualifiedName) throws ServiceUnavailableException { + checkInit(); + QualifiedName qName = new QualifiedName(qualifiedName); + ScopeContext scope = scopeIndex.get(qName.getPartName()); + if (scope == null) { + throw new ServiceNotFoundException(qualifiedName); + } + Context ctx = scope.getContext(qName.getPartName()); + try { + Object o = ctx.getInstance(qName); + if (o == null) { + throw new ServiceNotFoundException(qualifiedName); + } + return o; + } catch (TargetException e) { + e.addContextName(getName()); + throw new ServiceNotFoundException(e); + } + } + + public ServiceReference createServiceReference(String serviceName) { + throw new UnsupportedOperationException(); + } + + public RequestContext getRequestContext() { + throw new UnsupportedOperationException(); + } + + public ServiceReference createServiceReferenceForSession(Object self) { + throw new UnsupportedOperationException(); + } + + public ServiceReference createServiceReferenceForSession(Object self, String serviceName) { + throw new UnsupportedOperationException(); + } + + public ServiceReference newSession(String serviceName) { + throw new UnsupportedOperationException(); + } + + public ServiceReference newSession(String serviceName, Object sessionId) { + throw new UnsupportedOperationException(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EntryPointContextImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EntryPointContextImpl.java new file mode 100644 index 0000000000..d1ad7a5548 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EntryPointContextImpl.java @@ -0,0 +1,90 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.impl; + +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.context.ContextInitException; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.wire.jdk.JDKInvocationHandler; +import org.apache.tuscany.core.wire.ProxyCreationException; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.message.MessageFactory; + +import java.lang.reflect.InvocationHandler; + +/** + * The default implementation of an entry point context + * + * @version $Rev$ $Date$ + */ +public class EntryPointContextImpl extends AbstractContext implements EntryPointContext { + + private SourceWireFactory sourceWireFactory; + + + private InvocationHandler invocationHandler; + + // a proxy implementing the service exposed by the entry point backed by the invocation handler + private Object proxy; + + /** + * Creates a new entry point + * + * @param name the entry point name + * @param sourceWireFactory the proxy factory containing the invocation chains for the entry point + * @param messageFactory a factory for generating invocation messages + * @throws ContextInitException if an error occurs creating the entry point + */ + public EntryPointContextImpl(String name, SourceWireFactory sourceWireFactory, MessageFactory messageFactory) + throws ContextInitException { + super(name); + assert (sourceWireFactory != null) : "Proxy factory was null"; + assert (messageFactory != null) : "Message factory was null"; + this.sourceWireFactory = sourceWireFactory; + invocationHandler = new JDKInvocationHandler(messageFactory, sourceWireFactory.getConfiguration() + .getInvocationConfigurations()); + } + + public Object getInstance(QualifiedName qName) throws TargetException { + if (proxy == null) { + try { + proxy = sourceWireFactory.createProxy(); + } catch (ProxyCreationException e) { + TargetException te = new TargetException(e); + te.addContextName(getName()); + throw te; + } + } + return proxy; + } + + public void start() throws ContextInitException { + lifecycleState = RUNNING; + } + + public void stop() throws CoreRuntimeException { + lifecycleState = STOPPED; + } + + public Object getHandler() throws TargetException { + return invocationHandler; + } + + public Class getServiceInterface() { + return sourceWireFactory.getBusinessInterface(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java new file mode 100644 index 0000000000..6888e66f20 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/EventContextImpl.java @@ -0,0 +1,81 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.impl; + +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.ScopeIdentifier; + +import java.util.HashMap; +import java.util.Map; + +/** + * An implementation of an {@link org.apache.tuscany.core.context.EventContext} that handles event-to-thread associations using an + * InheritableThreadLocal + * + * @version $Rev$ $Date$ + */ +public class EventContextImpl implements EventContext { + + // @TODO design a proper propagation strategy for creating new threads + /* + * a map ( associated with the current thread) of scope identifiers keyed on the event context id type. the scope identifier + * may be a {@link ScopeIdentifier} or an opaque id + */ + private ThreadLocal eventContext = new InheritableThreadLocal(); + + public Object getIdentifier(Object type) { + Map map = eventContext.get(); + if (map == null) { + return null; + } + Object currentId = map.get(type); + if (currentId instanceof ScopeIdentifier) { + currentId = ((ScopeIdentifier) currentId).getIdentifier(); + // once we have accessed the id, replace the lazy wrapper + map.put(type, currentId); + } + return currentId; + } + + public void setIdentifier(Object type, Object identifier) { + Map map = eventContext.get(); + if (map == null) { + map = new HashMap(); + eventContext.set(map); + } + map.put(type, identifier); + } + + public void clearIdentifier(Object type) { + if (type == null) { + return; + } + Map map = eventContext.get(); + if (map != null) { + map.remove(type); + } + } + + public void clearIdentifiers() { + eventContext.remove(); + } + + public EventContextImpl() { + super(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/ExternalServiceContextImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/ExternalServiceContextImpl.java new file mode 100644 index 0000000000..0ab44fa8fc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/impl/ExternalServiceContextImpl.java @@ -0,0 +1,75 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.impl; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.ExternalServiceContext; +import org.apache.tuscany.core.wire.ProxyCreationException; +import org.apache.tuscany.core.wire.TargetWireFactory; + +/** + * The default implementation of an external service context + * + * @version $Rev$ $Date$ + */ +public class ExternalServiceContextImpl extends AbstractContext implements ExternalServiceContext { + + private TargetWireFactory targetWireFactory; + + private ObjectFactory targetInstanceFactory; + + /** + * Creates an external service context + * + * @param name the name of the external service + * @param targetWireFactory the factory which creates proxies implementing the configured service interface for the + * external service. There is always only one proxy factory as an external service is configured with one + * service + * @param targetInstanceFactory the object factory that creates an artifact capabile of communicating over the + * binding transport configured on the external service. The object factory may implement a caching strategy. + */ + public ExternalServiceContextImpl(String name, TargetWireFactory targetWireFactory, ObjectFactory targetInstanceFactory) { + super(name); + assert (targetInstanceFactory != null) : "Target instance factory was null"; + this.targetWireFactory = targetWireFactory; + this.targetInstanceFactory = targetInstanceFactory; + } + + public void start() throws CoreRuntimeException { + lifecycleState = RUNNING; + } + + public void stop() throws CoreRuntimeException { + lifecycleState = STOPPED; + } + + + public Object getInstance(QualifiedName qName) throws TargetException { + try { + return targetWireFactory.createProxy(); + // TODO do we cache the proxy, (assumes stateful capabilities will be provided in an interceptor) + } catch (ProxyCreationException e) { + TargetException te = new TargetException(e); + te.addContextName(getName()); + throw te; + } + } + + public Object getHandler() throws TargetException { + return targetInstanceFactory.getInstance(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeContext.java new file mode 100644 index 0000000000..7eed472101 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeContext.java @@ -0,0 +1,74 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.scope; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.impl.AbstractLifecycle; + +/** + * Implements functionality common to scope contexts. + * + * @version $Rev$ $Date$ + */ +public abstract class AbstractScopeContext extends AbstractLifecycle implements ScopeContext { + + // The collection of runtime configurations for the scope + protected Map> contextFactories = new ConcurrentHashMap>(); + + // The event context the scope container is associated with + protected EventContext eventContext; + + public AbstractScopeContext(EventContext eventContext) { + assert (eventContext != null) : "Event context was null"; + this.eventContext = eventContext; + } + + public void registerFactories(List> configurations) { + for (ContextFactory configuration : configurations) { + contextFactories.put(configuration.getName(), configuration); + } + } + + public Object getInstance(QualifiedName qName) throws TargetException { + Context context = getContext(qName.getPartName()); + if (context == null) { + TargetException e = new TargetException("Target not found"); + e.setIdentifier(qName.getQualifiedName()); + throw e; + } + return context.getInstance(qName); + } + + protected void checkInit() { + if (getLifecycleState() != RUNNING) { + throw new IllegalStateException("Scope not running [" + getLifecycleState() + "]"); + } + } + + protected EventContext getEventContext() { + return eventContext; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeStrategy.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeStrategy.java new file mode 100644 index 0000000000..f89d09196d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/AbstractScopeStrategy.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.scope; + +import org.apache.tuscany.core.context.ScopeStrategy; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Implements basic scope strategy functionality + * + * @version $Rev$ $Date$ + */ +public abstract class AbstractScopeStrategy implements ScopeStrategy { + + public AbstractScopeStrategy() { + } + + /** + * Determines legal scope references according to standard SCA scope rules + * + * @param pReferrer the scope of the component making the reference + * @param pReferee the scope of the component being referred to + */ + public boolean downScopeReference(Scope pReferrer, Scope pReferee) { + if (pReferrer == Scope.UNDEFINED || pReferee == Scope.UNDEFINED) { + return false; + } + if (pReferee == pReferrer){ + return false; + }else if(pReferrer == Scope.INSTANCE){ + return false; + }else if(pReferee == Scope.INSTANCE){ + return true; + }else if (pReferrer == Scope.REQUEST && pReferee == Scope.SESSION){ + return false; + }else if (pReferrer == Scope.REQUEST && pReferee == Scope.MODULE){ + return false; +// }else if (pReferrer == Scope.SESSION && pReferee == Scope.REQUEST){ +// return true; + }else if (pReferrer == Scope.SESSION && pReferee == Scope.MODULE){ + return false; +// }else if (pReferrer == Scope.MODULE){ +// return true; + }else{ + return true; + } + //FIXME Jim this does not work with enumerations, what does it mean to have a scope <0? +// } else if ((pReferrer < 0) || (pReferee < 0)) { +// return false; +// } +// +// return (pReferrer > pReferee); +// return pReferrer != pReferee; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java new file mode 100644 index 0000000000..7468ff9dd6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/CompositeScopeContext.java @@ -0,0 +1,156 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.scope; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.ScopeInitializationException; +import org.apache.tuscany.core.context.ScopeRuntimeException; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.event.Event; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.impl.AbstractLifecycle; + +/** + * Manages the lifecycle of composite component contexts, i.e. contexts which contain child contexts + * + * @see org.apache.tuscany.core.context.CompositeContext + * @version $Rev$ $Date$ + */ +public class CompositeScopeContext extends AbstractLifecycle implements ScopeContext { + + private List> configs = new ArrayList>(); + + // Composite component contexts in this scope keyed by name + private Map contexts = new ConcurrentHashMap(); + + // indicates if a module start event has been previously propagated so child contexts added after can be notified + private boolean moduleScopeStarted; + + public CompositeScopeContext(EventContext eventContext) { + assert (eventContext != null) : "Event context was null"; + setName("Composite Scope"); + } + + public void start() throws ScopeInitializationException { + for (ContextFactory configuration : configs) { + Context context = configuration.createContext(); + if (!(context instanceof CompositeContext)) { + ScopeInitializationException e = new ScopeInitializationException("Context not an composite type"); + e.addContextName(context.getName()); + throw e; + } + CompositeContext compositeCtx = (CompositeContext) context; + compositeCtx.start(); + contexts.put(compositeCtx.getName(), compositeCtx); + } + lifecycleState = RUNNING; + } + + public void stop() throws ScopeRuntimeException { + for (CompositeContext context : contexts.values()) { + context.stop(); + } + } + + public void registerFactories(List> configurations) { + this.configs = configurations; + } + + public void registerFactory(ContextFactory configuration) { + assert (configuration != null) : "Configuration was null"; + configs.add(configuration); + if (getLifecycleState() == RUNNING) { + Context context = configuration.createContext(); + if (!(context instanceof CompositeContext)) { + ScopeInitializationException e = new ScopeInitializationException("Context not an composite type"); + e.setIdentifier(context.getName()); + throw e; + } + CompositeContext compositeCtx = (CompositeContext) context; + compositeCtx.start(); + if (moduleScopeStarted) { + compositeCtx.publish(new ModuleStart(this)); + } + contexts.put(compositeCtx.getName(), compositeCtx); + } + } + + public boolean isCacheable() { + return false; + } + + public Object getInstance(QualifiedName qName) throws TargetException { + Context context = getContext(qName.getPartName()); + if (context == null) { + TargetException e = new TargetException("Component not found"); + e.setIdentifier(qName.getQualifiedName()); + throw e; + } + return context.getInstance(qName); + } + + public Context getContext(String ctxName) { + checkInit(); + return contexts.get(ctxName); + } + + public Context getContextByKey(String ctxName, Object key) { + return getContext(ctxName); + } + + public void removeContext(String ctxName) throws ScopeRuntimeException { + Context context = contexts.remove(ctxName); + if (context != null) { + context.stop(); + } + } + + public void removeContextByKey(String ctxName, Object key) throws ScopeRuntimeException { + throw new UnsupportedOperationException(); + } + + public void onEvent(Event event){ + if (event instanceof ModuleStart) { + // track module starting so that composite contexts registered after the event are notified properly + moduleScopeStarted = true; + } else if (event instanceof ModuleStop) { + moduleScopeStarted = false; + publish(event); + } + // propagate events to child contexts + for (CompositeContext context : contexts.values()) { + context.publish(event); + } + } + + private void checkInit() { + if (getLifecycleState()!= RUNNING) { + throw new IllegalStateException("Scope not running [" + getLifecycleState() + "]"); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategy.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategy.java new file mode 100644 index 0000000000..1f386fd35f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategy.java @@ -0,0 +1,52 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.scope; + +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.HashMap; +import java.util.Map; + +/** + * Implements a {@link org.apache.tuscany.core.context.ScopeStrategy} for the default module scopes: stateless, request, session, + * and module. + * + * @version $Rev$ $Date$ + */ +public class DefaultScopeStrategy extends AbstractScopeStrategy { + + public DefaultScopeStrategy() { + } + + public Map getScopeContexts(EventContext eventContext) { + ScopeContext moduleScope = new ModuleScopeContext(eventContext); + ScopeContext sessionScope = new SessionScopeContext(eventContext); + ScopeContext requestScope = new RequestScopeContext(eventContext); + ScopeContext statelessScope = new StatelessScopeContext(eventContext); + ScopeContext aggregrateScope = new CompositeScopeContext(eventContext); + Map scopes = new HashMap(); + scopes.put(Scope.MODULE,moduleScope); + scopes.put(Scope.SESSION,sessionScope); + scopes.put(Scope.REQUEST,requestScope); + scopes.put(Scope.INSTANCE,statelessScope); + scopes.put(Scope.AGGREGATE,aggregrateScope); + return scopes; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/ModuleScopeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/ModuleScopeContext.java new file mode 100644 index 0000000000..dbb342bb5a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/ModuleScopeContext.java @@ -0,0 +1,194 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.scope; + +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.Lifecycle; +import org.apache.tuscany.core.context.event.InstanceCreated; +import org.apache.tuscany.core.context.event.Event; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; + +import java.util.Map; +import java.util.List; +import java.util.ArrayList; +import java.util.ListIterator; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Manages contexts whose implementations are module scoped. This scope contexts eagerly starts contexts when + * a {@link ModuleStart} event is received. If a contained context has an implementation marked to eagerly initialized, + * the an instance will be created at that time as well. Contained contexts are shutdown when a {@link ModuleStop} + * event is received in reverse order to which their implementation instances were created. + * + * @version $Rev$ $Date$ + */ +public class ModuleScopeContext extends AbstractScopeContext { + + // Component contexts in this scope keyed by name + private Map contexts; + + // the queue of contexts to destroy, in the order that their instances were created + private List destroyQueue; + + public ModuleScopeContext(EventContext eventContext) { + super(eventContext); + setName("Module Scope"); + } + + public void onEvent(Event event) { + if (event instanceof ModuleStart) { + lifecycleState = RUNNING; + initComponentContexts(); + } else if (event instanceof ModuleStop) { + shutdownContexts(); + } else if (event instanceof InstanceCreated) { + checkInit(); + if (event.getSource() instanceof Context) { + Context context = (Context) event.getSource(); + // Queue the context to have its implementation instance released if destroyable + destroyQueue.add(context); + } + } + } + + public synchronized void start() { + if (lifecycleState != UNINITIALIZED) { + throw new IllegalStateException("Scope must be in UNINITIALIZED state [" + lifecycleState + "]"); + } + } + + public synchronized void stop() { + if (lifecycleState != RUNNING) { + throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]"); + } + contexts = null; + destroyQueue = null; + lifecycleState = STOPPED; + } + + public boolean isCacheable() { + return true; + } + + public void registerFactory(ContextFactory configuration) { + contextFactories.put(configuration.getName(), configuration); + if (lifecycleState == RUNNING) { + contexts.put(configuration.getName(), configuration.createContext()); + } + } + + public Context getContext(String ctxName) { + checkInit(); + initComponentContexts(); + return contexts.get(ctxName); + } + + public Context getContextByKey(String ctxName, Object key) { + checkInit(); + initComponentContexts(); + return contexts.get(ctxName); + } + + public void removeContext(String ctxName) { + checkInit(); + if (contexts == null){ + return; + } + Context context = contexts.remove(ctxName); + if (context != null) { + destroyQueue.remove(context); + } + } + + public void removeContextByKey(String ctxName, Object key){ + removeContext(ctxName); + } + + /** + * Notifies contexts of a shutdown in reverse order to which they were started + */ + private synchronized void shutdownContexts() { + if (destroyQueue == null || destroyQueue.size() == 0) { + return; + } + // shutdown destroyable instances in reverse instantiation order + ListIterator iter = destroyQueue.listIterator(destroyQueue.size()); + while(iter.hasPrevious()){ + Lifecycle context = iter.previous(); + if (context.getLifecycleState() == RUNNING) { + try { + if (context instanceof AtomicContext){ + ((AtomicContext)context).destroy(); + } + } catch (TargetException e) { + // TODO send a monitoring event + } + } + } + if (contexts == null){ + return; + } + for(Lifecycle context: contexts.values()) { + try { + if (context.getLifecycleState() == RUNNING) { + context.stop(); + } + } catch (CoreRuntimeException e){ + // TODO send monitoring event + } + } + contexts = null; + destroyQueue = null; + } + + /** + * Creates and starts components contexts in the module scope. Implementations marked to eagerly initialize will + * also be notified to do so. + * + * @throws CoreRuntimeException + */ + private synchronized void initComponentContexts() throws CoreRuntimeException { + if (contexts == null) { + contexts = new ConcurrentHashMap(); + destroyQueue = new ArrayList(); + for (ContextFactory config : contextFactories.values()) { + Context context = config.createContext(); + context.start(); + contexts.put(context.getName(), context); + } + // Initialize eager contexts. Note this cannot be done when we initially create each context since a component may + // contain a forward reference to a component which has not been instantiated + for (Context context : contexts.values()) { + if (context instanceof AtomicContext) { + AtomicContext atomic = (AtomicContext) context; + if (atomic.isEagerInit()) { + // perform silent creation and manual shutdown registration + atomic.init(); + destroyQueue.add(context); + } + } + context.addListener(this); + } + } + } +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java new file mode 100644 index 0000000000..67ce176af5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/RequestScopeContext.java @@ -0,0 +1,228 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.scope; + +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.Lifecycle; +import org.apache.tuscany.core.context.event.InstanceCreated; +import org.apache.tuscany.core.context.event.Event; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.context.event.RequestStart; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.ListIterator; +import java.util.concurrent.ConcurrentHashMap; + +/** + * An implementation of a request-scoped component container. This scope contexts eagerly starts contexts when + * a {@link org.apache.tuscany.core.context.event.RequestStart} event is received. If a contained context has an implementation marked to eagerly initialized, + * the an instance will be created at that time as well. Contained contexts are shutdown when a {@link org.apache.tuscany.core.context.event.RequestEnd} + * event is received in reverse order to which their implementation instances were created. + * + * @version $Rev$ $Date$ + */ +public class RequestScopeContext extends AbstractScopeContext { + + // A collection of service component contexts keyed by thread. Note this could have been implemented with a ThreadLocal but + // using a Map allows finer-grained concurrency. + private Map> contexts; + + // stores ordered lists of contexts to shutdown for each thread. + private Map> destroyQueues; + + public RequestScopeContext(EventContext eventContext) { + super(eventContext); + setName("Request Scope"); + } + + public void onEvent(Event event){ + if (event instanceof RequestStart){ + getContexts(); // eager load + }else if (event instanceof RequestEnd){ + checkInit(); + getEventContext().clearIdentifiers(); // clean up current context for pooled threads + shutdownContexts(); + cleanupRequestContexts(); + }else if (event instanceof InstanceCreated){ + checkInit(); + assert(event.getSource() instanceof Context): "Context must be passed on created event"; + Context context = (Context)event.getSource(); + List collection = destroyQueues.get(Thread.currentThread()); + collection.add(context); + } + } + + public synchronized void start() { + if (lifecycleState != UNINITIALIZED) { + throw new IllegalStateException("Scope must be in UNINITIALIZED state [" + lifecycleState + "]"); + } + contexts = new ConcurrentHashMap>(); + destroyQueues = new ConcurrentHashMap>(); + lifecycleState = RUNNING; + } + + public synchronized void stop() { + if (lifecycleState != RUNNING) { + throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]"); + } + contexts = null; + destroyQueues = null; + lifecycleState = STOPPED; + } + + public boolean isCacheable() { + return true; + } + + public void registerFactory(ContextFactory configuration) { + contextFactories.put(configuration.getName(), configuration); + } + + public Context getContext(String ctxName) { + checkInit(); + Map contexts = getContexts(); + Context ctx = contexts.get(ctxName); + if (ctx == null){ + // check to see if the configuration was added after the request was started + ContextFactory configuration = contextFactories.get(ctxName); + if (configuration != null) { + ctx = configuration.createContext(); + //ctx.addListener(this); + ctx.start(); + contexts.put(ctx.getName(), ctx); + } + } + return ctx; + } + + public Context getContextByKey(String ctxName, Object key) { + checkInit(); + if (key == null) { + return null; + } + Map components = contexts.get(key); + if (components == null) { + return null; + } + return components.get(ctxName); + } + + public void removeContext(String ctxName) { + removeContextByKey(ctxName, Thread.currentThread()); + } + + public void removeContextByKey(String ctxName, Object key) { + checkInit(); + if (key == null || ctxName == null) { + return; + } + Map components = contexts.get(key); + if (components == null) { + return; + } + components.remove(ctxName); + } + + + + private void cleanupRequestContexts() { + // TODO uninitialize all request-scoped components + contexts.remove(Thread.currentThread()); + destroyQueues.remove(Thread.currentThread()); + } + + /** + * Initializes ServiceComponentContexts for the current request. + *

+ * TODO This eagerly creates all component contexts, even if the component is never accessed during the request. This method + * should be profiled to determine if lazy initialization is more performant + *

+ * TODO Eager initialization is not performed for request-scoped components + */ + + private Map getContexts() throws CoreRuntimeException { + Map requestContexts = this.contexts.get(Thread.currentThread()); + if (requestContexts == null) { + requestContexts = new ConcurrentHashMap(); + List shutdownQueue = new ArrayList(); + for (ContextFactory config : contextFactories.values()) { + Context context = config.createContext(); + context.start(); + requestContexts.put(context.getName(), context); + } + // initialize eager components. Note this cannot be done when we initially create each context since a component may + // contain a forward reference to a component which has not been instantiated + for (Context context : requestContexts.values()) { + if (context instanceof AtomicContext) { + AtomicContext atomic = (AtomicContext) context; + if (atomic.isEagerInit()) { + atomic.init(); // Notify the instance + synchronized(shutdownQueue){ + shutdownQueue.add(context); + } + } + } + context.addListener(this); + } + contexts.put(Thread.currentThread(), requestContexts); + destroyQueues.put(Thread.currentThread(), shutdownQueue); + } + return requestContexts; + } + + private void shutdownContexts() { + List destroyQueue = destroyQueues.remove(Thread.currentThread()); + if (destroyQueue == null || destroyQueue.size() == 0) { + return; + } + synchronized(destroyQueue){ + // shutdown destroyable instances in reverse instantiation order + ListIterator iter = destroyQueue.listIterator(destroyQueue.size()); + while(iter.hasPrevious()){ + Lifecycle context = iter.previous(); + if (context.getLifecycleState() == RUNNING) { + try { + if (context instanceof AtomicContext){ + ((AtomicContext)context).destroy(); + } + } catch (TargetException e) { + // TODO send a monitoring event + } + } + } + } + // shutdown contexts + Map currentContexts = contexts.remove(Thread.currentThread()); + if (currentContexts == null){ + return; + } + for (Lifecycle context: currentContexts.values()){ + if (context.getLifecycleState() == RUNNING) { + context.stop(); + } + } + + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java new file mode 100644 index 0000000000..c5785d25f7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/SessionScopeContext.java @@ -0,0 +1,258 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.scope; + +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.ScopeRuntimeException; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.Lifecycle; +import org.apache.tuscany.core.context.event.Event; +import org.apache.tuscany.core.context.event.HttpSessionEvent; +import org.apache.tuscany.core.context.event.InstanceCreated; +import org.apache.tuscany.core.context.event.SessionEnd; +import org.apache.tuscany.core.context.event.SessionStart; + +import java.util.ArrayList; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * An implementation of an session-scoped component container. This scope contexts eagerly starts contexts when a + * {@link org.apache.tuscany.core.context.event.SessionStart} event is received. If a contained context has an implementation + * marked to eagerly initialized, the an instance will be created at that time as well. Contained contexts are shutdown when a + * {@link org.apache.tuscany.core.context.event.SessionEnd} event is received in reverse order to which their implementation + * instances were created. + * TODO this implementation needs to be made generic so that it supports a range of session types, i.e. not tied to HTTP + * session scope + * + * @version $Rev$ $Date$ + */ +public class SessionScopeContext extends AbstractScopeContext { + + // The collection of service component contexts keyed by session + private Map> contexts; + + // Stores ordered lists of contexts to shutdown keyed by session + private Map> destroyQueues; + + public SessionScopeContext(EventContext eventContext) { + super(eventContext); + setName("Session Scope"); + } + + public synchronized void start() { + if (lifecycleState != UNINITIALIZED) { + throw new IllegalStateException("Scope container must be in UNINITIALIZED state"); + } + contexts = new ConcurrentHashMap>(); + destroyQueues = new ConcurrentHashMap>(); + lifecycleState = RUNNING; + } + + public synchronized void stop() { + if (lifecycleState != RUNNING) { + throw new IllegalStateException("Scope container in wrong state"); + } + contexts = null; + contexts = null; + destroyQueues = null; + lifecycleState = STOPPED; + } + + public void onEvent(Event event) { + if (event instanceof SessionStart) { + checkInit(); + Object key = ((SessionEnd) event).getId(); + getSessionContexts(key); + }else if (event instanceof SessionEnd) { + checkInit(); + Object key = ((SessionEnd) event).getId(); + shutdownContexts(key); + destroyComponentContext(key); + } else if (event instanceof InstanceCreated) { + checkInit(); + Object sessionKey = getEventContext().getIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + List shutdownQueue = destroyQueues.get(sessionKey); + Context context = (Context) event.getSource(); + assert(shutdownQueue != null): "Shutdown queue not found for key"; + shutdownQueue.add(context); + } + } + + public boolean isCacheable() { + return true; + } + + public void registerFactory(ContextFactory configuration) { + contextFactories.put(configuration.getName(), configuration); + } + + public Context getContext(String ctxName) { + assert(ctxName != null): "No context name specified"; + checkInit(); + Map ctxs = getSessionContexts(); + Context context = ctxs.get(ctxName); + if (context == null) { + // the configuration was added after the session had started, so create a context now and start it + ContextFactory configuration = contextFactories.get(ctxName); + if (configuration != null) { + context = configuration.createContext(); + context.start(); + if (context instanceof AtomicContext) { + ((AtomicContext) context).init(); + } + + ctxs.put(context.getName(), context); + List shutdownQueue = destroyQueues.get(getEventContext().getIdentifier(HttpSessionEvent.HTTP_IDENTIFIER)); + synchronized (shutdownQueue) { + shutdownQueue.add(context); + } + context.addListener(this); + } + } + return context; + } + + public Context getContextByKey(String ctxName, Object key) { + checkInit(); + assert(ctxName != null): "No context name specified"; + assert(key != null): "No key specified"; + Map ctxs = contexts.get(key); + if (ctxs == null) { + return null; + } + return (Context) ctxs.get(ctxName); + } + + public void removeContext(String ctxName) { + checkInit(); + Object key = getEventContext().getIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + removeContextByKey(ctxName, key); + } + + public void removeContextByKey(String ctxName, Object key) { + checkInit(); + assert(ctxName != null): "No context name specified"; + assert(key != null): "No key specified"; + Map components = contexts.get(key); + if (components == null) { + return; + } + components.remove(ctxName); + Map definitions = contexts.get(key); + Context ctx = definitions.get(ctxName); + if (ctx != null) { + destroyQueues.get(key).remove(ctx); + } + definitions.remove(ctxName); + } + + /** + * Returns and, if necessary, creates a context for the current sesion + */ + private Map getSessionContexts() throws CoreRuntimeException { + Object key = getEventContext().getIdentifier(HttpSessionEvent.HTTP_IDENTIFIER); + return getSessionContexts(key); + } + + /** + * Returns and, if necessary, creates a context for the given session key + */ + private Map getSessionContexts(Object key) throws CoreRuntimeException { + if (key == null) { + throw new ScopeRuntimeException("Session key not set in request context"); + } + Map m = contexts.get(key); + if (m != null) { + return m; // already created, return + } + Map sessionContext = new ConcurrentHashMap(contextFactories.size()); + for (ContextFactory config : contextFactories.values()) { + Context context = config.createContext(); + context.start(); + sessionContext.put(context.getName(), context); + } + + List shutdownQueue = new ArrayList(); + contexts.put(key, sessionContext); + destroyQueues.put(key, shutdownQueue); + // initialize eager components. Note this cannot be done when we initially create each context since a component may + // contain a forward reference to a component which has not been instantiated + for (Context context : sessionContext.values()) { + if (context instanceof AtomicContext) { + AtomicContext atomic = (AtomicContext) context; + if (atomic.isEagerInit()) { + atomic.init(); // Notify the instance + synchronized (shutdownQueue) { + shutdownQueue.add(context); + } + } + } + context.addListener(this); + } + return sessionContext; + } + + /** + * Removes the components associated with an expiring context + */ + private void destroyComponentContext(Object key) { + contexts.remove(key); + destroyQueues.remove(key); + } + + + private synchronized void shutdownContexts(Object key) { + List destroyQueue = destroyQueues.remove(key); + if (destroyQueue == null || destroyQueue.size() == 0) { + return; + } + // shutdown destroyable instances in reverse instantiation order + ListIterator iter = destroyQueue.listIterator(destroyQueue.size()); + synchronized (destroyQueue) { + while (iter.hasPrevious()) { + Lifecycle context = iter.previous(); + if (context.getLifecycleState() == RUNNING) { + try { + if (context instanceof AtomicContext) { + ((AtomicContext) context).destroy(); + } + } catch (TargetException e) { + // TODO send a monitoring event + } + } + } + } + // shutdown contexts + Map currentContexts = contexts.remove(Thread.currentThread()); + if (currentContexts == null) { + return; + } + for (Lifecycle context : currentContexts.values()) { + if (context.getLifecycleState() == RUNNING) { + context.stop(); + } + } + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/StatelessScopeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/StatelessScopeContext.java new file mode 100644 index 0000000000..46bf58b548 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/context/scope/StatelessScopeContext.java @@ -0,0 +1,132 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.context.scope; + +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.Lifecycle; +import org.apache.tuscany.core.context.event.Event; +import org.apache.tuscany.core.context.event.ModuleStop; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * A container that manages stateless components. + * + * @version $Rev$ $Date$ + */ +public class StatelessScopeContext extends AbstractScopeContext { + + // Component contexts keyed by name + private Map contexts; + + public StatelessScopeContext(EventContext eventContext) { + super(eventContext); + setName("Stateless Scope"); + } + + public synchronized void start() { + if (lifecycleState != UNINITIALIZED) { + throw new IllegalStateException("Scope must be in UNINITIALIZED state [" + lifecycleState + "]"); + } + lifecycleState = RUNNING; + } + + public synchronized void stop() { + if (lifecycleState != RUNNING) { + throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]"); + } + contexts = null; + lifecycleState = STOPPED; + } + + public void registerFactory(ContextFactory configuration) { + contextFactories.put(configuration.getName(), configuration); + if (contexts != null) { + contexts.put(configuration.getName(), configuration.createContext()); + } + } + + public void onEvent(Event event){ + if (event instanceof ModuleStop) { + shutdownContexts(); + } + } + + public boolean isCacheable() { + return true; + } + + public Context getContext(String ctxName) { + prepare(); + return contexts.get(ctxName); + } + + public Context getContextByKey(String ctxName, Object key) { + return getContext(ctxName); + } + + public void removeContext(String ctxName) { + if (contexts == null){ + return; + } + contexts.remove(ctxName); + } + + public void removeContextByKey(String ctxName, Object key) { + removeContext(ctxName); + } + + private void prepare() throws CoreRuntimeException { + if (lifecycleState != RUNNING) { + throw new IllegalStateException("Scope not in INITIALIZED state [" + lifecycleState + "]"); + } + if (contexts == null) { + contexts = new ConcurrentHashMap (); + for (ContextFactory config : contextFactories.values()) { + for (int i = 0; i < contextFactories.size(); i++) { + Context context = config.createContext(); + context.start(); + contexts.put(context.getName(), context); + } + + } + } + } + + private void shutdownContexts(){ + if (contexts == null){ + return; + } + for(Lifecycle context: contexts.values()) { + try { + if (context.getLifecycleState() == RUNNING) { + context.stop(); + } + } catch (CoreRuntimeException e){ + // TODO send monitoring event + } + + } + contexts = null; + } + + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ComponentTargetInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ComponentTargetInvoker.java new file mode 100644 index 0000000000..57fcffc2b2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ComponentTargetInvoker.java @@ -0,0 +1,122 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.TargetInvoker; + +/** + * Responsible for invoking an external service + * TODO: virtualy identical to ExternalServiceTargetInvoker + * @version $Rev$ $Date$ + */ +public class ComponentTargetInvoker implements TargetInvoker { + + private QualifiedName serviceName; + + private String esName; + + private Method method; + + private ScopeContext container; + + private AtomicContext context; + + /** + * Constructs a new ExternalWebServiceTargetInvoker. + * + * @param container + */ + public ComponentTargetInvoker(QualifiedName serviceName, Method method, ScopeContext container) { + assert serviceName != null : "No service name specified"; + assert method != null : "No method specified"; + assert container != null : "No scope container specified"; + this.serviceName = serviceName; + this.esName = serviceName.getPartName(); + this.method = method; + this.container = container; + } + + public Object invokeTarget(Object payload) throws InvocationTargetException { + if (context == null) { + Context iContext = container.getContext(esName); + if (!(iContext instanceof AtomicContext)) { + TargetException te = new TargetException("Unexpected target context type"); + te.setIdentifier(iContext.getClass().getName()); + te.addContextName(iContext.getName()); + throw te; + } + context = (AtomicContext) iContext; + } + + ExternalServiceInvoker invoker = (ExternalServiceInvoker) context.getTargetInstance(); + if (payload != null) { + return doInvoke(invoker, (Object[]) payload); + } else { + return doInvoke(invoker, null); + } + } + + protected Object doInvoke(ExternalServiceInvoker invoker, Object[] args) { + return invoker.invoke(method.getName(), args); + } + + public boolean isCacheable() { + return false; + } + + public Message invoke(Message msg) { + try { + Object resp = invokeTarget(msg.getBody()); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBody(e.getCause()); + } catch (Throwable e) { + msg.setBody(e); + } + return msg; + } + + public void setNext(Interceptor next) { + throw new UnsupportedOperationException(); + } + + public Object clone() throws CloneNotSupportedException { + try { + ComponentTargetInvoker invoker = (ComponentTargetInvoker) super.clone(); + invoker.container = container; + invoker.context = this.context; + invoker.esName = this.esName; + invoker.method = this.method; + invoker.serviceName = this.serviceName; + return invoker; + } catch (CloneNotSupportedException e) { + // will not happen + return null; + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java new file mode 100644 index 0000000000..81770d49b8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java @@ -0,0 +1,174 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ConfiguredProperty; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.Implementation; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.osoa.sca.annotations.Init; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.List; + +/** + * A runtime extension point for component types. Subclasses must be genericized according to the model implementation type they + * handle, i.e. a subclass of {@link Implementation}, and implement {@link #createContextFactory}. + * + * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ + * @see org.apache.tuscany.core.builder.ContextFactory + */ +@org.osoa.sca.annotations.Scope("MODULE") +public abstract class ContextFactoryBuilderSupport implements ContextFactoryBuilder { + + protected ContextFactoryBuilderRegistry builderRegistry; + + protected WireFactoryService wireFactoryService; + + protected Class implementationClass; + + /** + * Default constructor + */ + public ContextFactoryBuilderSupport() { + // reflect the generic type of the subclass + Type type = this.getClass().getGenericSuperclass(); + if (type instanceof ParameterizedType) { + implementationClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; + } else { + throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); + } + } + + /** + * Constructs a new instance + * + * @param wireFactoryService the system service responsible for creating wire factories + */ + public ContextFactoryBuilderSupport(WireFactoryService wireFactoryService) { + this(); + this.wireFactoryService = wireFactoryService; + } + + @Init(eager = true) + public void init() { + builderRegistry.register(this); + } + + @Autowire + public void setBuilderRegistry(ContextFactoryBuilderRegistry builderRegistry) { + this.builderRegistry = builderRegistry; + } + + /** + * Sets the system service used to construct wire factories + */ + @Autowire + public void setWireFactoryService(WireFactoryService wireFactoryService) { + this.wireFactoryService = wireFactoryService; + } + + public void build(AssemblyObject modelObject) throws BuilderException { + if (!(modelObject instanceof Component)) { + return; + } + Component nonGenricComponent = (Component) modelObject; + if (!implementationClass.isAssignableFrom(nonGenricComponent.getImplementation().getClass())) { + return; + } + Component component = (Component) modelObject; + List services = component.getImplementation().getComponentType().getServices(); + Scope previous = null; + Scope scope = Scope.INSTANCE; + for (Service service : services) { + // calculate and validate the scope of the component; ensure that all service scopes are the same unless stateless + Scope current = service.getServiceContract().getScope(); + if (previous != null && current != null && current != previous + && (current != Scope.INSTANCE && previous != Scope.INSTANCE)) { + BuilderException e = new BuilderConfigException("Incompatible scopes specified for services on component"); + e.setIdentifier(component.getName()); + throw e; + } + if (scope != null && current != Scope.INSTANCE) { + scope = current; + } + } + ContextFactory contextFactory; + try { + contextFactory = createContextFactory(component.getName(), component.getImplementation(), scope); + // create target-side wire invocation chains for each service offered by the implementation + for (ConfiguredService configuredService : component.getConfiguredServices()) { + Service service = configuredService.getPort(); + TargetWireFactory wireFactory = wireFactoryService.createTargetFactory(configuredService); + contextFactory.addTargetWireFactory(service.getName(), wireFactory); + } + // handle properties + List configuredProperties = component.getConfiguredProperties(); + if (configuredProperties != null) { + for (ConfiguredProperty property : configuredProperties) { + contextFactory.addProperty(property.getName(), property.getValue()); + } + } + // handle references and source side reference chains + List configuredReferences = component.getConfiguredReferences(); + if (configuredReferences != null) { + for (ConfiguredReference reference : configuredReferences) { + if (reference.getPort().getMultiplicity() == Multiplicity.ZERO_N || reference.getPort().getMultiplicity() == Multiplicity.ZERO_ONE){ + if (reference.getTargetConfiguredServices().size() < 1 && reference.getTargets().size() <1 ){ + continue; // not required, not configured fix TUSCANY-299 + } + } + List wireFactories = wireFactoryService.createSourceFactory(reference); + String refName = reference.getPort().getName(); + Class refClass = reference.getPort().getServiceContract().getInterface(); + boolean multiplicity = reference.getPort().getMultiplicity() == Multiplicity.ONE_N + || reference.getPort().getMultiplicity() == Multiplicity.ZERO_N; + contextFactory.addSourceWireFactories(refName, refClass, wireFactories, multiplicity); + } + } + component.setContextFactory(contextFactory); + } catch (BuilderException e) { + e.addContextName(component.getName()); + throw e; + } + } + + /** + * Subclasses must implement, returning a context factory appropriate to the component implementation + * + * @param componentName the name of the component + * @param implementation the component implementation + * @param scope the component implementation scope + */ + protected abstract ContextFactory createContextFactory(String componentName, T implementation, Scope scope); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java new file mode 100644 index 0000000000..58d7a626a6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java @@ -0,0 +1,111 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Service; +import org.osoa.sca.annotations.Init; + +/** + * A base class for a {@link ContextFactoryBuilder} that creates {@link org.apache.tuscany.core.context.EntryPointContext}s + * + * @version $$Rev$$ $$Date$$ + */ +public abstract class EntryPointBuilderSupport implements ContextFactoryBuilder { + + protected ContextFactoryBuilderRegistry builderRegistry; + protected WireFactoryService wireService; + protected MessageFactory messageFactory; + protected Class bindingClass; + + public EntryPointBuilderSupport() { + // reflect the generic type of the subclass + Type type = this.getClass().getGenericSuperclass(); + if (type instanceof ParameterizedType) { + bindingClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; + } else { + throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); + } + } + + @Init(eager = true) + public void init() throws Exception { + builderRegistry.register(this); + } + + @Autowire + public void setBuilderRegistry(ContextFactoryBuilderRegistry registry) { + builderRegistry = registry; + } + + @Autowire + public void setWireService(WireFactoryService wireService) { + this.wireService = wireService; + } + + /** + * Sets the factory used to construct wire messages + * + * @param msgFactory + */ + @Autowire + public void setMessageFactory(MessageFactory msgFactory) { + this.messageFactory = msgFactory; + } + + public void build(AssemblyObject object) throws BuilderException { + if (!(object instanceof EntryPoint)) { + return; + } + EntryPoint entryPoint = (EntryPoint) object; + if (entryPoint.getBindings().size() < 1) { + return; + } + if (!bindingClass.isAssignableFrom(entryPoint.getBindings().get(0).getClass())) { + return; + } + + EntryPointContextFactory contextFactory = createEntryPointContextFactory(entryPoint, messageFactory); + ConfiguredService configuredService = entryPoint.getConfiguredService(); + Service service = configuredService.getPort(); + SourceWireFactory wireFactory = wireService.createSourceFactory(entryPoint.getConfiguredReference()).get(0); + contextFactory.addSourceWireFactory(service.getName(), wireFactory); + entryPoint.setContextFactory(contextFactory); + } + + /** + * Callback to create the specific ContextFactory type associated with the extending + * implementation + * + * @param entryPoint the entry point being processed + * @param msgFactory the message factory to be used by EntryPointContext when flowing + * invocations + */ + protected abstract EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory); + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointContextFactory.java new file mode 100644 index 0000000000..bb4d1207d4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointContextFactory.java @@ -0,0 +1,111 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.context.impl.EntryPointContextImpl; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Default factory for contexts that represent entry points. + * + * @version $Rev$ $Date$ + */ +public abstract class EntryPointContextFactory implements ContextFactory { + + private String name; + + private SourceWireFactory sourceWireFactory; + + private MessageFactory msgFactory; + + private List sourceProxyFactories; + + public EntryPointContextFactory(String name, MessageFactory msgFactory) { + assert (name != null) : "Entry point name was null"; + assert (msgFactory != null) : "Message factory was null"; + this.name = name; + this.msgFactory = msgFactory; + } + + public EntryPointContext createContext() throws ContextCreationException { + return new EntryPointContextImpl(name, sourceWireFactory, msgFactory); + } + + public Scope getScope() { + return Scope.MODULE; + } + + public String getName() { + return name; + } + + public void prepare() { + } + + public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { + // no wires to an entry point from within a composite + } + + public TargetWireFactory getTargetWireFactory(String serviceName) { + // no wires to an entry point from within a composite + return null; + } + + public Map getTargetWireFactories() { + // no wires to an entry point from within a composite + return Collections.emptyMap(); + } + + public void addSourceWireFactory(String refName, SourceWireFactory factory) { + assert (refName != null) : "No reference name specified"; + assert (factory != null) : "Proxy factory was null"; + this.sourceWireFactory = factory; + } + + public List getSourceWireFactories() { + if (sourceProxyFactories == null) { + sourceProxyFactories = new ArrayList(1); + sourceProxyFactories.add(sourceWireFactory); + } + return sourceProxyFactories; + } + + public void addProperty(String propertyName, Object value) { + throw new UnsupportedOperationException(); + } + + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factories, boolean multiplicity) { + if (factories.size() >1){ + throw new UnsupportedOperationException("Multiple wires for an entry point not allowed"); + }else if(factories.size() <1){ + throw new AssertionError("Empty wire factory list"); + } + this.sourceWireFactory = factories.get(0); + } + + public void prepare(CompositeContext parent) { + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java new file mode 100644 index 0000000000..7c030324f1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java @@ -0,0 +1,112 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.service.WireFactoryService; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Service; +import org.osoa.sca.annotations.Init; + +/** + * A base class for a {@link ContextFactoryBuilder} that creates {@link org.apache.tuscany.core.context.ExternalServiceContext}s + * + * @version $$Rev$$ $$Date$$ + */ +public abstract class ExternalServiceBuilderSupport implements ContextFactoryBuilder { + + private ContextFactoryBuilderRegistry builderRegistry; + private WireFactoryService wireService; + protected Class bindingClass; + + public ExternalServiceBuilderSupport() { + // reflect the generic type of the subclass + Type type = this.getClass().getGenericSuperclass(); + if (type instanceof ParameterizedType) { + bindingClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; + } else { + throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); + } + } + + public ExternalServiceBuilderSupport(WireFactoryService wireService) { + this(); + this.wireService = wireService; + } + + @Init(eager = true) + public void init() throws Exception { + builderRegistry.register(this); + } + + @Autowire + public void setBuilderRegistry(ContextFactoryBuilderRegistry registry) { + builderRegistry = registry; + } + + @Autowire + public void setWireService(WireFactoryService wireService) { + this.wireService = wireService; + } + + public void build(AssemblyObject object) throws BuilderException { + if (!(object instanceof ExternalService)) { + return; + } + ExternalService externalService = (ExternalService) object; + if (externalService.getBindings().size() < 1) { + // || !(handlesBindingType(externalService.getBindings().get(0)))) { + return; + } + if (!bindingClass.isAssignableFrom(externalService.getBindings().get(0).getClass())) { + return; + } + + ExternalServiceContextFactory contextFactory + = createExternalServiceContextFactory(externalService); + + ConfiguredService configuredService = externalService.getConfiguredService(); + Service service = configuredService.getPort(); + TargetWireFactory wireFactory = wireService.createTargetFactory(configuredService); + contextFactory.addTargetWireFactory(service.getName(), wireFactory); + externalService.setContextFactory(contextFactory); + } + + /** + * Returns true if an extending implementation can process the given binding element + */ + //protected abstract boolean handlesBindingType(Binding binding); + + /** + * Callback to create the specific ContextFactory type associated with the extending + * implementation + * + * @param externalService the external service being processed + */ + protected abstract ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceContextFactory.java new file mode 100644 index 0000000000..396da3d39e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceContextFactory.java @@ -0,0 +1,121 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.ExternalServiceContext; +import org.apache.tuscany.core.context.impl.ExternalServiceContextImpl; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * A template implementation that creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} + * configured with the appropriate wire chains and bindings. This class is intended to be subclassed when + * contributing new bindings to the runtime. The subclass serves as a marker so the binding {@link org.apache.tuscany.core.builder.WireBuilder + * + * + * + * } + * responsible for setting the proper {@link org.apache.tuscany.core.wire.TargetInvoker} on the wire chains + * can be notified. + * + * @version $Rev$ $Date$ + */ +public abstract class ExternalServiceContextFactory implements ContextFactory { + + private String name; + + private TargetWireFactory targetWireFactory; + + private ObjectFactory objectFactory; + + private String targetServiceName; + + private Map targetProxyFactories; + + public ExternalServiceContextFactory(String name, ObjectFactory objectFactory) { + assert (name != null) : "Name was null"; + assert (objectFactory != null) : "Object factory was null"; + this.name = name; + this.objectFactory = objectFactory; + } + + public ExternalServiceContext createContext() throws ContextCreationException { + return new ExternalServiceContextImpl(name, targetWireFactory, objectFactory); + } + + public Scope getScope() { + return Scope.MODULE; + } + + public String getName() { + return name; + } + + public void prepare() { + } + + public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { + assert (serviceName != null) : "No service name specified"; + assert (factory != null) : "Proxy factory was null"; + this.targetServiceName = serviceName; // external services are configured with only one service + this.targetWireFactory = factory; + } + + public TargetWireFactory getTargetWireFactory(String serviceName) { + if (this.targetServiceName.equals(serviceName)) { + return targetWireFactory; + } else { + return null; + } + } + + public Map getTargetWireFactories() { + if (targetProxyFactories == null) { + targetProxyFactories = new HashMap (1); + targetProxyFactories.put(targetServiceName, targetWireFactory); + } + return targetProxyFactories; + } + + public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { + throw new UnsupportedOperationException(); + } + + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) { + + } + + public List getSourceWireFactories() { + return Collections.emptyList(); + } + + public void addProperty(String propertyName, Object value) { + throw new UnsupportedOperationException(); + } + + public void prepare(CompositeContext parent) { + //parentContext = parent; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceInvoker.java new file mode 100644 index 0000000000..0424bf5de6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceInvoker.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension; + +public interface ExternalServiceInvoker { + + public Object invoke(String methodName, Object[] args); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceTargetInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceTargetInvoker.java new file mode 100644 index 0000000000..0d664e0207 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceTargetInvoker.java @@ -0,0 +1,122 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.ExternalServiceContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.TargetInvoker; + +/** + * Responsible for invoking an external service + * + * @version $Rev$ $Date$ + */ +public class ExternalServiceTargetInvoker implements TargetInvoker { + + private QualifiedName serviceName; + + private String esName; + + private Method method; + + private ScopeContext container; + + private ExternalServiceContext context; + + /** + * Constructs a new ExternalWebServiceTargetInvoker. + * + * @param container + */ + public ExternalServiceTargetInvoker(QualifiedName serviceName, Method method, ScopeContext container) { + assert serviceName != null : "No service name specified"; + assert method != null : "No method specified"; + assert container != null : "No scope container specified"; + this.serviceName = serviceName; + this.esName = serviceName.getPartName(); + this.method = method; + this.container = container; + } + + public Object invokeTarget(Object payload) throws InvocationTargetException { + if (context == null) { + Context iContext = container.getContext(esName); + if (!(iContext instanceof ExternalServiceContext)) { + TargetException te = new TargetException("Unexpected target context type"); + te.setIdentifier(iContext.getClass().getName()); + te.addContextName(iContext.getName()); + throw te; + } + context = (ExternalServiceContext) iContext; + } + + ExternalServiceInvoker invoker = (ExternalServiceInvoker) context.getHandler(); + if (payload != null) { + return doInvoke(invoker, (Object[]) payload); + } else { + return doInvoke(invoker, null); + } + } + + protected Object doInvoke(ExternalServiceInvoker invoker, Object[] args) { + return invoker.invoke(method.getName(), args); + } + + public boolean isCacheable() { + return false; + } + + public Message invoke(Message msg) { + try { + Object resp = invokeTarget(msg.getBody()); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBody(e.getCause()); + } catch (Throwable e) { + msg.setBody(e); + } + return msg; + } + + public void setNext(Interceptor next) { + throw new UnsupportedOperationException(); + } + + public Object clone() throws CloneNotSupportedException { + try { + ExternalServiceTargetInvoker invoker = (ExternalServiceTargetInvoker) super.clone(); + invoker.container = container; + invoker.context = this.context; + invoker.esName = this.esName; + invoker.method = this.method; + invoker.serviceName = this.serviceName; + return invoker; + } catch (CloneNotSupportedException e) { + // will not happen + return null; + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java new file mode 100644 index 0000000000..5b2d9de0e3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java @@ -0,0 +1,102 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.WireBuilder; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.osoa.sca.annotations.Init; + +/** + * A base class for {@link WireBuilder} implementations + * + * @version $$Rev$$ $$Date$$ + */ +public abstract class WireBuilderSupport> implements WireBuilder { + + protected RuntimeContext runtimeContext; + protected Class targetClass; + + @Autowire + public void setRuntimeContext(RuntimeContext context) { + runtimeContext = context; + } + + public WireBuilderSupport() { + // reflect the generic type of the subclass + Type type = this.getClass().getGenericSuperclass(); + if (type instanceof ParameterizedType) { + targetClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; + } else { + throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); + } + } + + @Init(eager = true) + public void init() throws Exception { + runtimeContext.addBuilder(this); + } + + public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, + ScopeContext targetScopeContext) throws BuilderConfigException { + if (!targetClass.isAssignableFrom(targetType)) { + return; + } + + for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration().getInvocationConfigurations() + .values()) { + TargetInvoker invoker = createInvoker(sourceFactory.getConfiguration() + .getTargetName(), sourceInvocationConfig.getMethod(), targetScopeContext, downScope); + sourceInvocationConfig.setTargetInvoker(invoker); + } + } + + public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) + throws BuilderConfigException { + + if (!targetClass.isAssignableFrom(targetType)) { + return; + } + for (TargetInvocationConfiguration targetInvocationConfig : targetFactory.getConfiguration().getInvocationConfigurations() + .values()) { + Method method = targetInvocationConfig.getMethod(); + TargetInvoker invoker = createInvoker(targetFactory.getConfiguration().getTargetName(), method, targetScopeContext, false); + targetInvocationConfig.setTargetInvoker(invoker); + } + } + + /** + * Callback to create the specific TargetInvoker type for dispatching to the target type + * + * @param targetName the fully qualified name of the wire target + * @param operation the operation the invoker will be associated with + * @param context the scope context that manages the target context + * @param downScope whether the wire source scope is "longer" than the target + */ + protected abstract TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/ImplementationProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/ImplementationProcessor.java new file mode 100644 index 0000000000..b464a7f00f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/ImplementationProcessor.java @@ -0,0 +1,65 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.extension.config; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.core.config.ConfigurationLoadException; + +/** + * Implementations process a Java class and contribute to a {@link org.apache.tuscany.model.assembly.ComponentType} + * or provide some validation function. Implementations may contribute to defined ComponentType + * metadata, a general ComponentType extensibility element, or a more specific Java extensibility + * element, which is associated with {@link org.apache.tuscany.core.extension.config.JavaExtensibilityElement} and + * stored in the ComponentType's extensibility collection. Processors will typically use {@link + * JavaExtensibilityHelper#getExtensibilityElement(org.apache.tuscany.model.assembly.Extensible)}, which + * provides methods for retrieving the Java extensibility element. + *

+ * In the runtime, a {@link org.apache.tuscany.core.config.ComponentTypeIntrospector} system service introspects component implementation + * types when an assembly is loaded, calling out to registered processors in the order defined by {@link + * ComponentTypeIntrospector#introspect(Class)}. Generally, processors are also system services which + * register themeselves with a ComponentTypeIntrospector. For convenience, a processor + * implementation can extend <@link org.apache.tuscany.core.config.processor.ImplementationProcessorSupport}, + * which provides mechanisms for doing this. + *

+ * There are a series of bootsrap, or primordial, processors configured in the runtime, and they serve as + * examples of how an ImplementationProcessor can be implemented. + * + * @see org.apache.tuscany.core.config.processor.PropertyProcessor + * @see org.apache.tuscany.core.config.processor.ReferenceProcessor + * @see org.apache.tuscany.core.config.processor.InitProcessor + * @see org.apache.tuscany.core.config.processor.DestroyProcessor + * @see org.apache.tuscany.core.config.processor.ComponentNameProcessor + * + * @version $$Rev$$ $$Date$$ + * @see org.apache.tuscany.core.config.processor.ImplementationProcessorSupport + */ +public interface ImplementationProcessor { + + public void visitClass(Class clazz, ComponentType type) throws ConfigurationLoadException; + + public void visitSuperClass(Class clazz, ComponentType type) throws ConfigurationLoadException; + + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException; + + public void visitConstructor(Constructor constructor, ComponentType type) throws ConfigurationLoadException; + + public void visitField(Field field, ComponentType type) throws ConfigurationLoadException; + + public void visitEnd(Class clazz, ComponentType type) throws ConfigurationLoadException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/InjectorExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/InjectorExtensibilityElement.java new file mode 100644 index 0000000000..50818d1ac0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/InjectorExtensibilityElement.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.extension.config; + +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.injection.Injector; + +/** + * An extensiblity element which provides {@link Injector}s based on component type metadata + * + * @version $$Rev$$ $$Date$$ + */ +public interface InjectorExtensibilityElement extends JavaExtensibilityElement { + + /** + * Creates an injector + * @param resolver that returns the current composite context + */ + public Injector getInjector(ContextResolver resolver); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/JavaExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/JavaExtensibilityElement.java new file mode 100644 index 0000000000..fba57d8254 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/JavaExtensibilityElement.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.extension.config; + +/** + * Serves as a marker for a metadata extensibility point. For example, {@link ImplementationProcessor}s may + * create extensibility elements which are responsible for implementing injection functionality prescribed by + * a Java source annotation. + * + * @version $$Rev$$ $$Date$$ + */ +public interface JavaExtensibilityElement { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ComponentNameExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ComponentNameExtensibilityElement.java new file mode 100644 index 0000000000..e04ca34da6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ComponentNameExtensibilityElement.java @@ -0,0 +1,52 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension.config.extensibility; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.MethodInjector; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.core.injection.FieldInjector; +import org.apache.tuscany.core.extension.config.JavaExtensibilityElement; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class ComponentNameExtensibilityElement implements JavaExtensibilityElement { + + private Method method; + private Field field; + + public ComponentNameExtensibilityElement(Method m) { + method = m; + } + + public ComponentNameExtensibilityElement(Field f) { + field = f; + } + + public Injector getEventInvoker(String name) { + if (method != null) { + return new MethodInjector(method, new SingletonObjectFactory(name)); + }else{ + return new FieldInjector(field, new SingletonObjectFactory(name)); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ContextExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ContextExtensibilityElement.java new file mode 100644 index 0000000000..9099132e36 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ContextExtensibilityElement.java @@ -0,0 +1,52 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension.config.extensibility; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.extension.config.JavaExtensibilityElement; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.MethodInjector; +import org.apache.tuscany.core.injection.FieldInjector; +import org.apache.tuscany.core.injection.ContextObjectFactory; +import org.apache.tuscany.core.builder.ContextResolver; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class ContextExtensibilityElement implements JavaExtensibilityElement { + + private Method method; + private Field field; + + public ContextExtensibilityElement(Method m) { + method = m; + } + + public ContextExtensibilityElement(Field f) { + field = f; + } + + public Injector getInjector(ContextResolver resolver) { + if (method != null) { + return new MethodInjector(method, new ContextObjectFactory(resolver)); + } else { + return new FieldInjector(field, new ContextObjectFactory(resolver)); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/DestroyInvokerExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/DestroyInvokerExtensibilityElement.java new file mode 100644 index 0000000000..9952f507b2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/DestroyInvokerExtensibilityElement.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension.config.extensibility; + +import java.lang.reflect.Method; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class DestroyInvokerExtensibilityElement extends InvokerExtensibilityElement{ + + public DestroyInvokerExtensibilityElement(Method m) { + super(m); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InitInvokerExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InitInvokerExtensibilityElement.java new file mode 100644 index 0000000000..4c542b4b5d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InitInvokerExtensibilityElement.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension.config.extensibility; + +import java.lang.reflect.Method; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class InitInvokerExtensibilityElement extends InvokerExtensibilityElement{ + + private boolean eager; + + public InitInvokerExtensibilityElement(Method m, boolean eager) { + super(m); + this.eager = eager; + } + + public boolean isEager() { + return eager; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InvokerExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InvokerExtensibilityElement.java new file mode 100644 index 0000000000..a87acd16cc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InvokerExtensibilityElement.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension.config.extensibility; + +import java.lang.reflect.Method; + +import org.apache.tuscany.core.extension.config.JavaExtensibilityElement; +import org.apache.tuscany.core.injection.MethodEventInvoker; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class InvokerExtensibilityElement implements JavaExtensibilityElement { + + private Method method; + private MethodEventInvoker invoker; + + public InvokerExtensibilityElement(Method m) { + method = m; + } + + public MethodEventInvoker getEventInvoker() { + if (invoker == null) { + invoker = new MethodEventInvoker(method); + } + return invoker; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ContextObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ContextObjectFactory.java new file mode 100644 index 0000000000..6facd25e59 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ContextObjectFactory.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.CompositeContext; + +/** + * An implementation of ObjectFactory that resolves the current parent context + * + * @version $Rev: 380903 $ $Date: 2006-02-25 00:53:26 -0800 (Sat, 25 Feb 2006) $ + */ +public class ContextObjectFactory implements ObjectFactory { + + private final ContextResolver resolver; + + public ContextObjectFactory(ContextResolver resolver) { + assert (resolver != null) : "Resolver cannot be null"; + this.resolver = resolver; + } + + public CompositeContext getInstance() { + return resolver.getCurrentContext(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java new file mode 100644 index 0000000000..6f5de43b96 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/EventInvoker.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +/** + * Performs an wire on an instance + * + * @version $Rev$ $Date$ + * @see MethodEventInvoker + */ +public interface EventInvoker { + + /** + * Performs the wire on a given instance + * + * @throws ObjectCallbackException + */ + void invokeEvent(T instance) throws ObjectCallbackException; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FactoryInitException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FactoryInitException.java new file mode 100644 index 0000000000..589ae796ac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FactoryInitException.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +/** + * Denotes an exception initializing an object factory + * + * @version $Rev$ $Date$ + */ +public class FactoryInitException extends InjectionRuntimeException { + + public FactoryInitException(String message, Throwable cause) { + super(message, cause); + } + + public FactoryInitException(String message) { + super(message); + } + + public FactoryInitException(Throwable cause) { + super(cause); + } + + public FactoryInitException() { + super(); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java new file mode 100644 index 0000000000..7be73462d3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/FieldInjector.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +import org.apache.tuscany.core.builder.ObjectFactory; + +import java.lang.reflect.Field; + +/** + * Injects a value created by an {@link ObjectFactory} on a given field + * + * @version $Rev$ $Date$ + */ +public class FieldInjector implements Injector { + + private final Field field; + + private final ObjectFactory objectFactory; + + /** + * Create an injector and have it use the given ObjectFactory + * to inject a value on the instance using the reflected Field + */ + public FieldInjector(Field field, ObjectFactory objectFactory) { + this.field = field; + this.objectFactory = objectFactory; + } + + /** + * Inject a new value on the given isntance + */ + public void inject(T instance) throws ObjectCreationException { + try { + field.set(instance, objectFactory.getInstance()); + } catch (IllegalAccessException e) { + throw new AssertionError("Field is not accessible [" + field + "]"); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java new file mode 100644 index 0000000000..2c26f3c4b1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InjectionRuntimeException.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +import org.apache.tuscany.common.TuscanyRuntimeException; + +/** + * Root unchecked exception for the injection package + * + * @version $Rev$ $Date$ + */ +public abstract class InjectionRuntimeException extends TuscanyRuntimeException { + + public InjectionRuntimeException() { + super(); + } + + public InjectionRuntimeException(String message) { + super(message); + } + + public InjectionRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public InjectionRuntimeException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/Injector.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/Injector.java new file mode 100644 index 0000000000..306dab3e98 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/Injector.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +/** + * Implementations inject a pre-configured value on an instance + * + * @version $Rev$ $Date$ + * @see MethodInjector + * @see FieldInjector + */ +public interface Injector { + + /** + * Inject a value on the given instance + */ + void inject(T instance) throws ObjectCreationException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InterCompositeReferenceFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InterCompositeReferenceFactory.java new file mode 100644 index 0000000000..55d8a88790 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/InterCompositeReferenceFactory.java @@ -0,0 +1,75 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.injection; + +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.TargetException; + +/** + * Returns a direct reference to a target service exposed in another composite, i.e. the factory avoids creating proxies + * and returns the actual target instance + * + * @version $Rev: 384135 $ $Date: 2006-03-07 22:53:58 -0800 (Tue, 07 Mar 2006) $ + */ +public class InterCompositeReferenceFactory implements ObjectFactory { + + private ContextResolver resolver; + + private QualifiedName targetQualifiedName; + + /** + * Reference source is an external service, target is in another module + * + * @param targetName the name of the target service + */ + public InterCompositeReferenceFactory(String targetName) { + targetQualifiedName = new QualifiedName(targetName); + } + + public void setContextResolver(ContextResolver resolver){ + this.resolver = resolver; + } + + public T getInstance() throws ObjectCreationException { + // only return entry points since this is an inter-module wire + Object o = resolver.getCurrentContext().getInstance(targetQualifiedName); + if (o != null) { + return (T) o; + } else { + // walk up the hierarchy of composite contexts + CompositeContext ctx = resolver.getCurrentContext(); + do { + if (ctx == null) { + break; // reached top of context hierarchy + } + Context compContext = ctx.getContext(targetQualifiedName.getPartName()); + if (compContext != null) { + o = compContext.getInstance(targetQualifiedName); + if (o != null) { + return (T) o; + } + } + ctx = ctx.getParent(); + } while (ctx != null); + TargetException e = new TargetException("Target reference not found"); + e.setIdentifier(targetQualifiedName.getQualifiedName()); + throw e; + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java new file mode 100644 index 0000000000..bed7db887a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/JNDIObjectFactory.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +import javax.naming.Context; +import javax.naming.NamingException; + +import org.apache.tuscany.core.builder.ObjectFactory; + +/** + * An implementation of ObjectFactory that creates instances + * by looking them up in a JNDI context. + * + * @version $Rev$ $Date$ + */ +public class JNDIObjectFactory implements ObjectFactory { + private final Context context; + private final String name; + + public JNDIObjectFactory(Context context, String name) { + this.context = context; + this.name = name; + } + + public T getInstance() throws ObjectCreationException { + try { + return (T) context.lookup(name); + } catch (NamingException e) { + throw new ObjectCreationException(e); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java new file mode 100644 index 0000000000..69c7670c03 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodEventInvoker.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * Performs an wire on a method of a given instance + * + * @version $Rev$ $Date$ + */ +public class MethodEventInvoker implements EventInvoker { + private final Method method; + + /** + * Intantiates an invoker for the given method + */ + public MethodEventInvoker(Method method) { + this.method = method; + } + + public void invokeEvent(T instance) throws ObjectCallbackException { + try { + method.invoke(instance, (Object[]) null); + } catch (IllegalAccessException e) { + throw new AssertionError("Method is not accessible [" + method + "]"); + } catch (InvocationTargetException e) { + throw new ObjectCallbackException("Exception thrown by callback method [" + method + "]", e); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java new file mode 100644 index 0000000000..6095061872 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/MethodInjector.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +import org.apache.tuscany.core.builder.ObjectFactory; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * Injects a value created by an {@link ObjectFactory} using a given method + * @version $Rev$ $Date$ + */ +public class MethodInjector implements Injector { + private final Method method; + private final ObjectFactory objectFactory; + + public MethodInjector(Method method, ObjectFactory objectFactory) { + this.method = method; + this.objectFactory = objectFactory; + } + + public void inject(T instance) throws ObjectCreationException { + try { + method.invoke(instance, objectFactory.getInstance()); + } catch (IllegalAccessException e) { + throw new AssertionError("Method is not accessible [" + method + "]"); + } catch (InvocationTargetException e) { + ObjectCreationException oce= new ObjectCreationException("Exception thrown by setter", e); + oce.setIdentifier(method.getName()); + throw oce; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NonProxiedTargetFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NonProxiedTargetFactory.java new file mode 100644 index 0000000000..7f7a307433 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NonProxiedTargetFactory.java @@ -0,0 +1,54 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.injection; + +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.model.assembly.ConfiguredService; + +/** + * Returns a direct reference to a target within the same composite, i.e. the factory avoids creating proxies and + * returns the actual target instance + * + * @version $Rev$ $Date$ + */ +public class NonProxiedTargetFactory implements ObjectFactory { + + private ContextResolver resolver; + + // the name of the target component/service for this reference + private QualifiedName targetName; + private QualifiedName qualifiedServiceName; + + /** + * Constructs a reference object factory from a configured reference on a type + * + * @throws FactoryInitException + */ + public NonProxiedTargetFactory(ConfiguredService targetService, ContextResolver resolver) throws FactoryInitException { + assert (targetService != null) : "Target service was null"; + assert (resolver != null) : "Context resolver was null"; + + this.resolver = resolver; + targetName = new QualifiedName(targetService.getPart().getName()); + qualifiedServiceName = new QualifiedName("./"+targetName.getPortName()); + } + + public T getInstance() throws ObjectCreationException { + return (T) resolver.getCurrentContext().getContext(targetName.getPartName()).getInstance(qualifiedServiceName); //locateInstance(targetName); //locateInstance(targetName); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NullEventInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NullEventInvoker.java new file mode 100644 index 0000000000..e8f109f2d8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/NullEventInvoker.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +/** + * A no-op invoker + * + * @version $Rev$ $Date$ + */ +public final class NullEventInvoker implements EventInvoker { + public static final EventInvoker NULL_INVOKER = new NullEventInvoker(); + + public void invokeEvent(T instance) { + // does nothing + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java new file mode 100644 index 0000000000..44edee43eb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCallbackException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +/** + * Denotes an error when invoking on an object + * + * @version $Rev$ $Date$ + */ +public class ObjectCallbackException extends InjectionRuntimeException { + + public ObjectCallbackException() { + super(); + } + + public ObjectCallbackException(String message) { + super(message); + } + + public ObjectCallbackException(String message, Throwable cause) { + super(message, cause); + } + + public ObjectCallbackException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCreationException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCreationException.java new file mode 100644 index 0000000000..875eda3680 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/ObjectCreationException.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +/** + * Denotes an error creating a new object instance + * + * @version $Rev$ $Date$ + */ +public class ObjectCreationException extends InjectionRuntimeException { + + public ObjectCreationException() { + super(); + } + + public ObjectCreationException(String message) { + super(message); + } + + public ObjectCreationException(String message, Throwable cause) { + super(message, cause); + } + + public ObjectCreationException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java new file mode 100644 index 0000000000..fac8248b0c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/PojoObjectFactory.java @@ -0,0 +1,76 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +import org.apache.tuscany.core.builder.ObjectFactory; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.Collections; +import java.util.List; + +/** + * Creates new instances of a Java class, calling a given set of injectors to configure the instance + * + * @version $Rev$ $Date$ + * @see Injector + */ +public class PojoObjectFactory implements ObjectFactory { + + private static final ObjectFactory[] NO_INIT_PARAM = {}; + + private static final List NO_SETTER_PARAM = Collections.emptyList(); + + private final Constructor ctr; + + private final ObjectFactory[] initParamsArray; + + private final List setters; + + public PojoObjectFactory(Constructor ctr, List initParams, List setters) { + this.ctr = ctr; + if (initParams != null && initParams.size() > 0) { + initParamsArray = initParams.toArray(new ObjectFactory[initParams.size()]); + } else { + initParamsArray = NO_INIT_PARAM; + } + this.setters = setters != null ? setters : NO_SETTER_PARAM; + } + + public T getInstance() throws ObjectCreationException { + Object[] initargs = new Object[initParamsArray.length]; + // create the constructor arg array + for (int i = 0; i < initParamsArray.length; i++) { + ObjectFactory objectFactory = initParamsArray[i]; + initargs[i] = objectFactory.getInstance(); + } + try { + T instance = ctr.newInstance(initargs); + // interate through the injectors and inject the instance + for (Injector setter : setters) { + setter.inject(instance); + } + return instance; + } catch (InstantiationException e) { + throw new AssertionError("Class is not instantiable [" + ctr.getDeclaringClass().getName() + "]"); + } catch (IllegalAccessException e) { + throw new AssertionError("Constructor is not accessible [" + ctr + "]"); + } catch (InvocationTargetException e) { + throw new ObjectCreationException("Exception thrown by constructor [" + ctr + "]", e); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java new file mode 100644 index 0000000000..8a7e0bf782 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/injection/SingletonObjectFactory.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.injection; + +import org.apache.tuscany.core.builder.ObjectFactory; + +/** + * Implementation of ObjectFactory that returns a single instance, typically an immutable type. + * + * @version $Rev$ $Date$ + */ +public class SingletonObjectFactory implements ObjectFactory { + private final T instance; + + public SingletonObjectFactory(T instance) { + this.instance = instance; + } + + public T getInstance() { + return instance; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/InvalidPropertyFactoryException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/InvalidPropertyFactoryException.java new file mode 100644 index 0000000000..9ccbbb3a7a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/InvalidPropertyFactoryException.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import org.apache.tuscany.core.config.ConfigurationLoadException; + +/** + * Exception raised if there is a problem configuring a PropertyFactory. + * + * @version $Rev$ $Date$ + */ +public class InvalidPropertyFactoryException extends ConfigurationLoadException { + private static final long serialVersionUID = 5017976138519117474L; + + /** + * Constructor indicating the cause why the property factory could not be created. + * + * @param className the name of the class that is intended to be the PropertyFactory + * @param cause the Throwable that prevented the PropertyFactory from being created + */ + public InvalidPropertyFactoryException(String className, Throwable cause) { + super(className, cause); + } + + /** + * Returns the name of the property factory implementation class. + * @return the name of the property factory implementation class + */ + public String getClassName() { + return getMessage(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/LoaderContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/LoaderContext.java new file mode 100644 index 0000000000..cef7353bbf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/LoaderContext.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2006 The Apache Software Foundation or its licensors as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import org.apache.tuscany.common.resource.ResourceLoader; + +/** + * Context holder that can be used during the load process to store information + * that is not part of the logical model. This should be regarded as transient + * and references to this context should not be stored inside the model. + * + * @version $Rev$ $Date$ + */ +public class LoaderContext { + private final ResourceLoader resourceLoader; + + /** + * Constructor specifying the loader for application resources. + * + * @param resourceLoader the loader for application resources + */ + public LoaderContext(ResourceLoader resourceLoader) { + this.resourceLoader = resourceLoader; + } + + /** + * Returns a resource loader that can be used to load application resources. + * @return a resource loader that can be used to load application resources + */ + public ResourceLoader getResourceLoader() { + return resourceLoader; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXElementLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXElementLoader.java new file mode 100644 index 0000000000..e1a9f55ca4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXElementLoader.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.AssemblyObject; + +/** + * A loader that creates a model object from a StAX input stream. + * + * @version $Rev$ $Date$ + */ +public interface StAXElementLoader { + /** + * Build the model object for an element in an XML stream. + * When this method returns the stream will be positioned on the corresponding END_ELEMENT. + * + * @param reader the XML stream reader positioned on the applicable START_ELEMENT + * @param loaderContext the context for the load operation + * @return the model object for that element + */ + T load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXLoaderRegistry.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXLoaderRegistry.java new file mode 100644 index 0000000000..a38d388815 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXLoaderRegistry.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyObject; + +/** + * Registry for XML loaders that can parse a StAX input stream and return model objects. + *

+ * Loaders will typically be contributed to the system by any extension that needs to + * handle extension specific information contained in some XML configuration file. + * The loader can be contributed as a system component with an autowire reference + * to this registry which is used during initialization to actually register. + *

+ * This registry can also be used to parse an input stream, dispatching to the + * appropriate loader for each element accepted. Loaders can call back to the + * registry to load sub-elements that they are not able to handle directly. + * + * @version $Rev$ $Date$ + */ +public interface StAXLoaderRegistry { + /** + * Register a loader. This operation will typically be called by a loader + * during its initialization. + * + * @param element the element that should be delegated to the contibuted loader + * @param loader a loader that is being contributed to the system + */ + void registerLoader(QName element, StAXElementLoader loader); + + /** + * Unregister a loader. This will typically be called by a loader as it is being destroyed. + * + * @param element the element that was being delegated to the contibuted loader + * @param loader a loader that should no longer be used + */ + void unregisterLoader(QName element, StAXElementLoader loader); + + /** + * Parse the supplied XML stream dispatching to the appropriate registered loader + * for each element encountered in the stream. + *

+ * This method must be called with the XML cursor positioned on a START_ELEMENT event. + * When this method returns, the stream will be positioned on the corresponding + * END_ELEMENT event. + * + * @param reader the XML stream to parse + * @param loaderContext + * @return the model object obtained by parsing the current element on the stream + * @throws XMLStreamException if there was a problem reading the stream + */ + AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException; + + /** + * Hack to allow loaders to initialize model objects on the fly. + * Remove when initialization has been moved from the model implementation to the loader. + * + * @return the model context for this load operation + */ + @Deprecated + AssemblyContext getContext(); + + /** + * Hack to allow loaders to initialize model objects on the fly. + * Remove when initialization has been moved from the model implementation to the loader. + * + * @param context the model context for this load operation + */ + @Deprecated + void setContext(AssemblyContext context); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXPropertyFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXPropertyFactory.java new file mode 100644 index 0000000000..a05597b51b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXPropertyFactory.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.Property; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +/** + * A factory that will create an ObjectFactory for a property by parsing a StAX XMLStreamReader. + * + * @version $Rev$ $Date$ + */ +public interface StAXPropertyFactory { + /** + * Return an ObjectFactory for instances of a property defined in an XML stream. + * + * @param reader the reader to use to access the XML stream + * @param property the Property definition that the resulting ObjectFactory must be able to assign to + * @return an ObjectFactory that can produce instances that can be assigned to the supplied Property + * @throws XMLStreamException if there is a problem reading the stream + * @throws ConfigurationLoadException if there is a problem creating the ObjectFactory + */ + ObjectFactory createObjectFactory(XMLStreamReader reader, Property property) throws XMLStreamException, ConfigurationLoadException; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java new file mode 100644 index 0000000000..f9ac2b0559 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java @@ -0,0 +1,160 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector; +import org.apache.tuscany.core.config.processor.ProcessorUtils; +import org.apache.tuscany.core.loader.assembly.ComponentLoader; +import org.apache.tuscany.core.loader.assembly.EntryPointLoader; +import org.apache.tuscany.core.loader.assembly.InterfaceJavaLoader; +import org.apache.tuscany.core.loader.assembly.ModuleFragmentLoader; +import org.apache.tuscany.core.loader.assembly.ModuleLoader; +import org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl; +import org.apache.tuscany.core.loader.impl.StringParserPropertyFactory; +import org.apache.tuscany.core.loader.system.SystemBindingLoader; +import org.apache.tuscany.core.loader.system.SystemImplementationLoader; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.SystemImplementation; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.OverrideOption; +import org.apache.tuscany.model.assembly.Scope; + +/** + * @version $Rev$ $Date$ + */ +public final class StAXUtil { + private static final Map MULTIPLICITY = new HashMap(4); + private static final Map OVERRIDE_OPTIONS = new HashMap(3); + + static { + MULTIPLICITY.put("0..1", Multiplicity.ZERO_ONE); + MULTIPLICITY.put("1..1", Multiplicity.ONE_ONE); + MULTIPLICITY.put("0..n", Multiplicity.ZERO_N); + MULTIPLICITY.put("1..n", Multiplicity.ONE_N); + + OVERRIDE_OPTIONS.put("no", OverrideOption.NO); + OVERRIDE_OPTIONS.put("may", OverrideOption.MAY); + OVERRIDE_OPTIONS.put("must", OverrideOption.MUST); + } + + private StAXUtil() { + } + + public static void skipToEndElement(XMLStreamReader reader) throws XMLStreamException { + int depth = 0; + while (true) { + int event = reader.next(); + if (event == XMLStreamConstants.START_ELEMENT) { + depth++; + } else if (event == XMLStreamConstants.END_ELEMENT) { + if (depth == 0) { + return; + } + depth--; + } + } + } + + public static Multiplicity multiplicity(String multiplicity, Multiplicity def) { + return multiplicity == null ? def : MULTIPLICITY.get(multiplicity); + } + + public static OverrideOption overrideOption(String overrideOption, OverrideOption def) { + return overrideOption == null ? def : OVERRIDE_OPTIONS.get(overrideOption); + } + + public static ModuleComponent bootstrapLoader(String name, AssemblyContext context) throws ConfigurationLoadException { + SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl(); + ComponentTypeIntrospector introspector = ProcessorUtils.createCoreIntrospector(factory); + Module module = factory.createModule(); + module.setName("org.apache.tuscany.core.system.loader"); + + List components = module.getComponents(); + + // bootstrap the minimal set of loaders needed to read the system module files + // all others should be defined in the system.module file + components.add(bootstrapLoader(factory, introspector, ModuleLoader.class)); + components.add(bootstrapLoader(factory, introspector, ModuleFragmentLoader.class)); + Component propFactory = factory.createSystemComponent("org.apache.tuscany.core.system.loader.DefaultPropertyFactory", StAXPropertyFactory.class, StringParserPropertyFactory.class, Scope.MODULE); + introspector.introspect(StAXPropertyFactory.class); + components.add(propFactory); + components.add(bootstrapLoader(factory, introspector, ComponentLoader.class)); + components.add(bootstrapLoader(factory, introspector, EntryPointLoader.class)); + components.add(bootstrapLoader(factory, introspector, InterfaceJavaLoader.class)); + components.add(bootstrapLoader(factory, introspector, SystemImplementationLoader.class)); + components.add(bootstrapLoader(factory, introspector, SystemBindingLoader.class)); + // do not add additional loaders above - they should be in the system.module file + + // bootstrap the registries needed by the bootstrap loaders above + bootstrapService(factory, introspector, module, StAXLoaderRegistry.class, StAXLoaderRegistryImpl.class); + bootstrapService(factory, introspector, module, SystemAssemblyFactory.class, SystemAssemblyFactoryImpl.class); + bootstrapService(factory, introspector, module, ComponentTypeIntrospector.class, Java5ComponentTypeIntrospector.class); + + ModuleComponent mc = factory.createModuleComponent(); + mc.setName(name); + mc.setImplementation(module); + mc.initialize(context); + return mc; + } + + private static Component bootstrapLoader(SystemAssemblyFactory factory, ComponentTypeIntrospector introspector, Class loaderClass) { + SystemImplementation implementation = factory.createSystemImplementation(); + implementation.setImplementationClass(loaderClass); + try { + implementation.setComponentType(introspector.introspect(loaderClass)); + } catch (ConfigurationException e) { + throw (AssertionError) new AssertionError("Invalid bootstrap loader").initCause(e); + } + Component component = factory.createSimpleComponent(); + component.setName(loaderClass.getName()); + component.setImplementation(implementation); + return component; + } + + private static void bootstrapService(SystemAssemblyFactory factory, ComponentTypeIntrospector introspector, Module module, Class service, Class impl) { + String epName = service.getName(); + String compName = impl.getName(); + + Component component = factory.createSystemComponent(compName, service, impl, Scope.MODULE); + try { + component.getImplementation().setComponentType(introspector.introspect(impl)); + } catch (ConfigurationException e) { + throw (AssertionError) new AssertionError("Invalid bootstrap loader").initCause(e); + } + + EntryPoint entryPoint = factory.createSystemEntryPoint(epName, service, compName); + + module.getComponents().add(component); + module.getEntryPoints().add(entryPoint); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java new file mode 100644 index 0000000000..f88e0f0b35 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/WSDLDefinitionRegistry.java @@ -0,0 +1,95 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import java.net.URL; +import java.util.List; +import java.io.IOException; +import javax.wsdl.Definition; +import javax.wsdl.PortType; +import javax.wsdl.Service; +import javax.wsdl.WSDLException; +import javax.wsdl.extensions.ExtensionRegistry; +import javax.xml.namespace.QName; + +import org.apache.tuscany.common.resource.ResourceLoader; + +/** + * @version $Rev$ $Date$ + */ +public interface WSDLDefinitionRegistry { + /** + * Loads and registers a WSDL Definition. + * + * @param namespace the expected namespace, or null if any namespace should be allowed + * @param location the location to load the definition from + * @param resourceLoader the application resource loader + * @return the loaded Definition + * @throws IOException if there was a problem reading the document + * @throws WSDLException if there was a problem parsing the definition + */ + Definition loadDefinition(String namespace, URL location, ResourceLoader resourceLoader) throws IOException, WSDLException; + + /** + * Load and register a WSDL definition as specified in a WSDL2.0 wsdlLocation attribute. + * + * @param wsdlLocation the value of the wsdlLocation attribute + * @param resourceLoader application resource loader used to support relative locations + * @return the loaded Definition + * @throws IOException if there was a problem reading the document + * @throws WSDLException if there was a problem parsing the definition + */ + Definition loadDefinition(String wsdlLocation, ResourceLoader resourceLoader) throws IOException, WSDLException; + + /** + * Returns the PortType with the supplied qualified name, or null if no such port has been defined. + * + * @param name the qualified name of the WSDL portType + * @param resourceLoader the application resource loader + * @return the PortType for the supplied name, or null if none has been defined + */ + PortType getPortType(QName name, ResourceLoader resourceLoader); + + /** + * Returns the Service with the supplied qualified name, or null if no such service has been defined. + * + * @param name the qualified name of the WSDL service + * @param resourceLoader the application resource loader + * @return the Service for the supplied name, or null if none has been defined + */ + Service getService(QName name, ResourceLoader resourceLoader); + + + /** + * Returns a list of definitions that have been loaded for the given namespace, or null if + * no WSDL documents have been loaded for the given namespace + * + * @param namespace the namespace to lookup + * @param resourceLoader the application resource loader + * @return The list of definitions that have been loaded for the given namespace, or null + */ + List getDefinitionsForNamespace(String namespace, ResourceLoader resourceLoader); + + + /** + * Returns the ExtensionRegistry that is used when parsing WSDL documents during the + * loadDefinition call. + * + * @return the ExtensionRegistry that is used when parsing WSDL documents. + */ + ExtensionRegistry getExtensionRegistry(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AbstractLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AbstractLoader.java new file mode 100644 index 0000000000..fce343df4b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AbstractLoader.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.core.loader.StAXElementLoader; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; + +/** + * @version $Rev$ $Date$ + */ +public abstract class AbstractLoader implements StAXElementLoader { + protected SystemAssemblyFactory factory; + protected StAXLoaderRegistry registry; + + @Autowire + public void setFactory(SystemAssemblyFactory factory) { + this.factory = factory; + } + + @Autowire + public void setRegistry(StAXLoaderRegistry registry) { + this.registry = registry; + } + + @Init(eager = true) + public void start() { + registry.registerLoader(getXMLType(), this); + } + + @Destroy + public void stop() { + registry.unregisterLoader(getXMLType(), this); + } + + /** + * Returns the QName of the element that this implementation handles. + * @return the QName of the element that this implementation handles + */ + protected abstract QName getXMLType(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AssemblyConstants.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AssemblyConstants.java new file mode 100644 index 0000000000..73ef4119f8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/AssemblyConstants.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import javax.xml.namespace.QName; + +/** + * @version $Rev$ $Date$ + */ +public final class AssemblyConstants { + public static final String SCA_NAMESPACE = "http://www.osoa.org/xmlns/sca/0.9"; + + public static final QName COMPONENT = new QName(SCA_NAMESPACE, "component"); + public static final QName COMPONENT_TYPE = new QName(SCA_NAMESPACE, "componentType"); + public static final QName ENTRY_POINT = new QName(SCA_NAMESPACE, "entryPoint"); + public static final QName EXTERNAL_SERVICE = new QName(SCA_NAMESPACE, "externalService"); + public static final QName IMPORT_WSDL = new QName(SCA_NAMESPACE, "import.wsdl"); + public static final QName INTERFACE_JAVA = new QName(SCA_NAMESPACE, "interface.java"); + public static final QName INTERFACE_WSDL = new QName(SCA_NAMESPACE, "interface.wsdl"); + public static final QName MODULE = new QName(SCA_NAMESPACE, "module"); + public static final QName MODULE_FRAGMENT = new QName(SCA_NAMESPACE, "moduleFragment"); + public static final QName PROPERTY = new QName(SCA_NAMESPACE, "property"); + public static final QName PROPERTIES = new QName(SCA_NAMESPACE, "properties"); + public static final QName REFERENCE = new QName(SCA_NAMESPACE, "reference"); + public static final QName REFERENCES = new QName(SCA_NAMESPACE, "references"); + public static final QName SERVICE = new QName(SCA_NAMESPACE, "service"); + public static final QName WIRE = new QName(SCA_NAMESPACE, "wire"); + public static final QName WIRE_SOURCE = new QName(SCA_NAMESPACE, "source.uri"); + public static final QName WIRE_TARGET = new QName(SCA_NAMESPACE, "target.uri"); + + private AssemblyConstants() { + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentLoader.java new file mode 100644 index 0000000000..0fa3e7ddeb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentLoader.java @@ -0,0 +1,189 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import java.util.List; +import javax.xml.namespace.QName; +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.InvalidPropertyFactoryException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.StAXPropertyFactory; +import org.apache.tuscany.core.loader.StAXUtil; +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.*; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.ConfiguredProperty; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.Implementation; +import org.apache.tuscany.model.assembly.OverrideOption; +import org.apache.tuscany.model.assembly.Property; +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ComponentLoader extends AbstractLoader { + private StAXPropertyFactory defaultPropertyFactory; + + @Autowire + public void setDefaultPropertyFactory(StAXPropertyFactory defaultPropertyFactory) { + this.defaultPropertyFactory = defaultPropertyFactory; + } + + public QName getXMLType() { + return COMPONENT; + } + + public Component load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert COMPONENT.equals(reader.getName()); + + Component component = factory.createSimpleComponent(); + component.setName(reader.getAttributeValue(null, "name")); + + while (true) { + switch (reader.next()) { + case START_ELEMENT: + QName name = reader.getName(); + if (PROPERTIES.equals(name)) { + loadProperties(reader, loaderContext.getResourceLoader(), component); + } else if (REFERENCES.equals(name)) { + loadReferences(reader, component); + } else { + AssemblyObject o = registry.load(reader, loaderContext); + if (o instanceof Implementation) { + Implementation impl = (Implementation) o; + impl.initialize(registry.getContext()); + component.setImplementation(impl); + } + } + reader.next(); + break; + case END_ELEMENT: + List props = component.getImplementation().getComponentType().getProperties(); + for (Property property : props) { + if (property.isRequired()) { + if (component.getConfiguredProperty(property.getName()) == null) { + ConfigurationLoadException e = new ConfigurationLoadException("Required property not configured"); + e.setIdentifier(property.getName()); + throw e; + } + } + } + return component; + } + } + } + + protected void loadProperties(XMLStreamReader reader, ResourceLoader resourceLoader, Component component) throws XMLStreamException, ConfigurationLoadException { + ComponentType componentType = component.getImplementation().getComponentType(); + List configuredProperties = component.getConfiguredProperties(); + + while (true) { + switch (reader.next()) { + case START_ELEMENT: + String name = reader.getLocalName(); + Property property = componentType.getProperty(name); + if (property == null) { + throw new ConfigurationLoadException(name); + } + OverrideOption override = StAXUtil.overrideOption(reader.getAttributeValue(null, "override"), OverrideOption.NO); + +// get a factory for the property + StAXPropertyFactory propertyFactory; + String factoryName = reader.getAttributeValue(null, "factory"); + if (factoryName == null) { + propertyFactory = defaultPropertyFactory; + } else { + propertyFactory = getPropertyFactory(factoryName, resourceLoader); + } + + // create the property value + // FIXME to support complex types we probably should store the factory in the ConfiguredProperty + // FIXME instead of the value as the value may be mutable and should not be shared between instances + ObjectFactory objectFactory = propertyFactory.createObjectFactory(reader, property); + Object value = objectFactory.getInstance(); + + // create the configured property definition + ConfiguredProperty configuredProperty = factory.createConfiguredProperty(); + configuredProperty.setName(name); + configuredProperty.setValue(value); + configuredProperty.setOverrideOption(override); + configuredProperties.add(configuredProperty); + break; + case END_ELEMENT: + return; + } + } + } + + protected StAXPropertyFactory getPropertyFactory(String factoryName, ResourceLoader resourceLoader) throws InvalidPropertyFactoryException { + Class impl; + try { + // try to load factory from application classloader + impl = resourceLoader.loadClass(factoryName); + } catch (ClassNotFoundException e) { + try { + // try to load factory from container classloader + impl = Class.forName(factoryName); + } catch (ClassNotFoundException e1) { + throw new InvalidPropertyFactoryException(factoryName, e); + } + } + try { + return (StAXPropertyFactory) impl.newInstance(); + } catch (InstantiationException e) { + throw new InvalidPropertyFactoryException(factoryName, e); + } catch (IllegalAccessException e) { + throw new InvalidPropertyFactoryException(factoryName, e); + } catch (ClassCastException e) { + throw new InvalidPropertyFactoryException(factoryName, e); + } + } + + protected void loadReferences(XMLStreamReader reader, Component component) throws XMLStreamException { + List configuredReferences = component.getConfiguredReferences(); + while (true) { + switch (reader.next()) { + case START_ELEMENT: + String name = reader.getLocalName(); + String uri = reader.getElementText(); + + ConfiguredReference configuredReference = component.getConfiguredReference(name); + if (configuredReference == null) { + configuredReference = factory.createConfiguredReference(); + configuredReference.setName(name); + configuredReferences.add(configuredReference); + } + + configuredReference.getTargets().add(uri); + break; + case END_ELEMENT: + return; + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoader.java new file mode 100644 index 0000000000..fdb8893830 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoader.java @@ -0,0 +1,65 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.COMPONENT_TYPE; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Property; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Service; +import org.osoa.sca.annotations.Scope; + +import javax.xml.namespace.QName; +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ComponentTypeLoader extends AbstractLoader { + public QName getXMLType() { + return COMPONENT_TYPE; + } + + public ComponentType load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert COMPONENT_TYPE.equals(reader.getName()); + ComponentType componentType = factory.createComponentType(); + + while (true) { + switch (reader.next()) { + case START_ELEMENT: + AssemblyObject o = registry.load(reader, loaderContext); + if (o instanceof Service) { + componentType.getServices().add((Service) o); + } else if (o instanceof Reference) { + componentType.getReferences().add((Reference) o); + } else if (o instanceof Property) { + componentType.getProperties().add((Property) o); + } + break; + case END_ELEMENT: + return componentType; + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/CompositeLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/CompositeLoader.java new file mode 100644 index 0000000000..9b22a24784 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/CompositeLoader.java @@ -0,0 +1,62 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.Composite; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.ImportWSDL; +import org.apache.tuscany.model.assembly.Wire; + +/** + * @version $Rev$ $Date$ + */ +public abstract class CompositeLoader extends AbstractLoader { + public void loadComposite(XMLStreamReader reader, Composite composite, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + composite.setName(reader.getAttributeValue(null, "name")); + while (true) { + switch (reader.next()) { + case START_ELEMENT: + AssemblyObject o = registry.load(reader, loaderContext); + if (o instanceof EntryPoint) { + composite.getEntryPoints().add((EntryPoint) o); + } else if (o instanceof ExternalService) { + composite.getExternalServices().add((ExternalService) o); + } else if (o instanceof Component) { + composite.getComponents().add((Component) o); + } else if (o instanceof Wire) { + composite.getWires().add((Wire) o); + } else if (o instanceof ImportWSDL) { + composite.getWSDLImports().add((ImportWSDL) o); + } + reader.next(); + break; + case END_ELEMENT: + return; + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/EntryPointLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/EntryPointLoader.java new file mode 100644 index 0000000000..14b60964d5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/EntryPointLoader.java @@ -0,0 +1,90 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.StAXUtil; +import org.apache.tuscany.core.loader.LoaderContext; +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.ENTRY_POINT; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.osoa.sca.annotations.Scope; + +import javax.xml.namespace.QName; +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class EntryPointLoader extends AbstractLoader { + public QName getXMLType() { + return ENTRY_POINT; + } + + public EntryPoint load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert ENTRY_POINT.equals(reader.getName()); + EntryPoint entryPoint = factory.createEntryPoint(); + String name = reader.getAttributeValue(null, "name"); + entryPoint.setName(name); + + Service service = factory.createService(); + service.setName(name); + ConfiguredService configuredService = factory.createConfiguredService(); + configuredService.setPort(service); + entryPoint.setConfiguredService(configuredService); + + Reference reference = factory.createReference(); + reference.setMultiplicity(StAXUtil.multiplicity(reader.getAttributeValue(null, "multiplicity"), Multiplicity.ONE_ONE)); + ConfiguredReference configuredReference = factory.createConfiguredReference(); + configuredReference.setPort(reference); + entryPoint.setConfiguredReference(configuredReference); + + while (true) { + switch (reader.next()) { + case START_ELEMENT: + QName qname = reader.getName(); + if (AssemblyConstants.REFERENCE.equals(qname)) { + String uri = reader.getElementText(); + configuredReference.getTargets().add(uri); + } else { + AssemblyObject o = registry.load(reader, loaderContext); + if (o instanceof Binding) { + entryPoint.getBindings().add((Binding) o); + } else if (o instanceof ServiceContract) { + service.setServiceContract((ServiceContract) o); + reference.setServiceContract((ServiceContract) o); + } + } + reader.next(); + break; + case END_ELEMENT: + return entryPoint; + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoader.java new file mode 100644 index 0000000000..4910c016d8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoader.java @@ -0,0 +1,75 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.StAXUtil; +import org.apache.tuscany.core.loader.LoaderContext; +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.EXTERNAL_SERVICE; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.OverrideOption; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.osoa.sca.annotations.Scope; + +import javax.xml.namespace.QName; +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ExternalServiceLoader extends AbstractLoader { + public QName getXMLType() { + return EXTERNAL_SERVICE; + } + + public ExternalService load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert EXTERNAL_SERVICE.equals(reader.getName()); + String name = reader.getAttributeValue(null, "name"); + ExternalService externalService = factory.createExternalService(); + externalService.setName(name); + externalService.setOverrideOption(StAXUtil.overrideOption(reader.getAttributeValue(null, "overridable"), OverrideOption.NO)); + + while (true) { + switch (reader.next()) { + case START_ELEMENT: + AssemblyObject o = registry.load(reader, loaderContext); + if (o instanceof ServiceContract) { + Service service = factory.createService(); + service.setName(name); + service.setServiceContract((ServiceContract) o); + ConfiguredService configuredService = factory.createConfiguredService(); + configuredService.setPort(service); + externalService.setConfiguredService(configuredService); + } else if (o instanceof Binding) { + externalService.getBindings().add((Binding) o); + } + reader.next(); + break; + case END_ELEMENT: + return externalService; + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java new file mode 100644 index 0000000000..6981f05372 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ImportWSDLLoader.java @@ -0,0 +1,95 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.IMPORT_WSDL; + +import java.io.IOException; +import java.net.URL; + +import javax.wsdl.Definition; +import javax.wsdl.WSDLException; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.MissingResourceException; +import org.apache.tuscany.core.config.SidefileLoadException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.StAXUtil; +import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.model.assembly.ImportWSDL; +import org.osoa.sca.annotations.Scope; + +/** + * Loader that handles <import.wsdl> elements. + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ImportWSDLLoader extends AbstractLoader { + private WSDLDefinitionRegistry wsdlRegistry; + + @Autowire + public void setWsdlRegistry(WSDLDefinitionRegistry wsdlRegistry) { + this.wsdlRegistry = wsdlRegistry; + } + + public QName getXMLType() { + return IMPORT_WSDL; + } + + public ImportWSDL load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert AssemblyConstants.IMPORT_WSDL.equals(reader.getName()); + String namespace = reader.getAttributeValue(null, "namespace"); + String location = reader.getAttributeValue(null, "location"); + if (location == null) + location = reader.getAttributeValue(null, "wsdlLocation"); + ImportWSDL importWSDL = factory.createImportWSDL(location, namespace); + + Definition definition = loadDefinition(namespace, location, loaderContext.getResourceLoader()); +// importWSDL.setDefinition(definition); + + StAXUtil.skipToEndElement(reader); + return importWSDL; + } + + protected Definition loadDefinition(String namespace, String location, ResourceLoader resourceLoader) throws MissingResourceException, SidefileLoadException { + Definition definition; + URL wsdlURL = resourceLoader.getResource(location); + if (wsdlURL == null) { + throw new MissingResourceException(location); + } + + try { + definition = wsdlRegistry.loadDefinition(namespace, wsdlURL, resourceLoader); + } catch (IOException e) { + SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); + sfe.setResourceURI(location); + throw sfe; + } catch (WSDLException e) { + SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); + sfe.setResourceURI(location); + throw sfe; + } + + return definition; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceJavaLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceJavaLoader.java new file mode 100644 index 0000000000..602cf2cc0a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceJavaLoader.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +/** + * @version $Rev$ $Date$ + */ +@org.osoa.sca.annotations.Scope("MODULE") +public class InterfaceJavaLoader extends AbstractLoader { + public QName getXMLType() { + return AssemblyConstants.INTERFACE_JAVA; + } + + public JavaServiceContract load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert AssemblyConstants.INTERFACE_JAVA.equals(reader.getName()); + JavaServiceContract serviceContract = factory.createJavaServiceContract(); + serviceContract.setScope(Scope.INSTANCE); + serviceContract.setInterfaceName(reader.getAttributeValue(null, "interface")); + serviceContract.setCallbackInterfaceName(reader.getAttributeValue(null, "callbackInterface")); + return serviceContract; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoader.java new file mode 100644 index 0000000000..9617cf805f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoader.java @@ -0,0 +1,110 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import java.io.IOException; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.MissingInterfaceException; +import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; +import org.apache.tuscany.core.loader.StAXUtil; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.wsdl.PortType; +import javax.wsdl.WSDLException; + +/** + * @version $Rev$ $Date$ + */ +@org.osoa.sca.annotations.Scope("MODULE") +public class InterfaceWSDLLoader extends AbstractLoader { + private static final String WSDLI = "http://www.w3.org/2006/01/wsdl-instance"; + private static final String WSDLI_LOCATION = "wsdlLocation"; + + private WSDLDefinitionRegistry wsdlRegistry; + + @Autowire + public void setWsdlRegistry(WSDLDefinitionRegistry wsdlRegistry) { + this.wsdlRegistry = wsdlRegistry; + } + + public QName getXMLType() { + return AssemblyConstants.INTERFACE_WSDL; + } + + public WSDLServiceContract load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert AssemblyConstants.INTERFACE_WSDL.equals(reader.getName()); + WSDLServiceContract serviceContract = factory.createWSDLServiceContract(); + serviceContract.setScope(Scope.INSTANCE); + + ResourceLoader resourceLoader = loaderContext.getResourceLoader(); + + String location = reader.getAttributeValue(WSDLI, WSDLI_LOCATION); + if (location != null) { + try { + wsdlRegistry.loadDefinition(location, resourceLoader); + } catch (IOException e) { + throw new MissingInterfaceException(e); + } catch (WSDLException e) { + throw new MissingInterfaceException(e); + } + } + + String portTypeURI = reader.getAttributeValue(null, "interface"); + if (portTypeURI != null) { + serviceContract.setPortType(getPortType(portTypeURI, resourceLoader)); + } + + portTypeURI = reader.getAttributeValue(null, "callbackInterface"); + if (portTypeURI != null) { + serviceContract.setCallbackPortType(getPortType(portTypeURI, resourceLoader)); + } + StAXUtil.skipToEndElement(reader); + return serviceContract; + } + + protected PortType getPortType(String uri, ResourceLoader resourceLoader) throws MissingInterfaceException { + + // We currently support two syntaxes for specifying a WSDL portType: + // namespace#portTypeName, this is what we supported in the initial contribution, we will + // deprecate this after M1 + // namespace#wsdl.interface(portTypeName), this is the WSDL 2.0 syntax + + int index = uri.indexOf('#'); + String namespace = uri.substring(0, index); + String fragment = uri.substring(index + 1); + String localName; + if (fragment.startsWith("wsdl.interface(") && fragment.endsWith(")")) { + localName = fragment.substring(15, fragment.length()-1); + } else { + localName = fragment; + } + QName qname = new QName(namespace, localName); + PortType portType = wsdlRegistry.getPortType(qname, resourceLoader); + if (portType == null) { + throw new MissingInterfaceException(uri); + } + return portType; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleFragmentLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleFragmentLoader.java new file mode 100644 index 0000000000..4b3e96cfab --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleFragmentLoader.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.model.assembly.ModuleFragment; +import org.osoa.sca.annotations.Scope; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ModuleFragmentLoader extends CompositeLoader { + public QName getXMLType() { + return AssemblyConstants.MODULE_FRAGMENT; + } + + public ModuleFragment load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + ModuleFragment fragment = factory.createModuleFragment(); + loadComposite(reader, fragment, loaderContext); + return fragment; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java new file mode 100644 index 0000000000..08ab23b3a6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java @@ -0,0 +1,50 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; +import org.apache.tuscany.model.assembly.Module; +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ModuleLoader extends CompositeLoader { + public QName getXMLType() { + return AssemblyConstants.MODULE; + } + + public Module load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + Module module = factory.createModule(); + loadComposite(reader, module, loaderContext); + // JFM Hack until recursive model in place + if (module.getName().startsWith("org.apache.tuscany.core.system")) { + module.setImplementationClass(SystemCompositeContextImpl.class); + } else { + module.setImplementationClass(CompositeContextImpl.class); + } + return module; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/PropertyLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/PropertyLoader.java new file mode 100644 index 0000000000..cbf1ca00df --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/PropertyLoader.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.StAXUtil; +import org.apache.tuscany.core.loader.LoaderContext; +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.PROPERTY; +import org.apache.tuscany.model.assembly.Property; +import org.osoa.sca.annotations.Scope; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import java.util.HashMap; +import java.util.Map; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class PropertyLoader extends AbstractLoader { + private static final String XSD = "http://www.w3.org/2001/XMLSchema"; + + private static final Map> TYPE_MAP; + static { + // todo support more XSD types, or remove if we store the QName + TYPE_MAP = new HashMap>(17); + TYPE_MAP.put(new QName(XSD, "string"), String.class); + } + + public QName getXMLType() { + return PROPERTY; + } + + public Property load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert PROPERTY.equals(reader.getName()); + Property property = factory.createProperty(); + property.setName(reader.getAttributeValue(null, "name")); + String typeName = reader.getAttributeValue(null, "type"); + // support XSD type or Java class name + // todo perhaps we should just store the QName for the PropertyFactory to use + int index = typeName.indexOf(':'); + if (index != -1) { + String prefix = typeName.substring(0, index); + String namespaceURI = reader.getNamespaceURI(prefix); + QName qname = new QName(namespaceURI, typeName.substring(index+1)); + property.setType(TYPE_MAP.get(qname)); + } else { + try { + Class type = loaderContext.getResourceLoader().loadClass(typeName); + property.setType(type); + } catch (ClassNotFoundException e) { + throw new ConfigurationLoadException(e); + } + } + property.setMany(Boolean.parseBoolean(reader.getAttributeValue(null, "many"))); + property.setDefaultValue(reader.getAttributeValue(null, "default")); + String required = reader.getAttributeValue(null, "required"); + property.setRequired(required != null && Boolean.valueOf(required)); + + StAXUtil.skipToEndElement(reader); + return property; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ReferenceLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ReferenceLoader.java new file mode 100644 index 0000000000..aa95210757 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ReferenceLoader.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.StAXUtil; +import org.apache.tuscany.core.loader.LoaderContext; +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.REFERENCE; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.osoa.sca.annotations.Scope; + +import javax.xml.namespace.QName; +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ReferenceLoader extends AbstractLoader { + public QName getXMLType() { + return REFERENCE; + } + + public Reference load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert REFERENCE.equals(reader.getName()); + Reference reference = factory.createReference(); + reference.setName(reader.getAttributeValue(null, "name")); + reference.setMultiplicity(StAXUtil.multiplicity(reader.getAttributeValue(null, "multiplicity"), Multiplicity.ONE_ONE)); + + while (true) { + switch (reader.next()) { + case START_ELEMENT: + AssemblyObject o = registry.load(reader, loaderContext); + if (o instanceof ServiceContract) { + reference.setServiceContract((ServiceContract) o); + } + reader.next(); + break; + case END_ELEMENT: + return reference; + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ServiceLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ServiceLoader.java new file mode 100644 index 0000000000..9cb31b55ff --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ServiceLoader.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.SERVICE; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.osoa.sca.annotations.Scope; + +import javax.xml.namespace.QName; +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ServiceLoader extends AbstractLoader { + public QName getXMLType() { + return SERVICE; + } + + public Service load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert SERVICE.equals(reader.getName()); + Service service = factory.createService(); + service.setName(reader.getAttributeValue(null, "name")); + + while (true) { + switch (reader.next()) { + case START_ELEMENT: + AssemblyObject o = registry.load(reader, loaderContext); + if (o instanceof ServiceContract) { + service.setServiceContract((ServiceContract) o); + } + reader.next(); + break; + case END_ELEMENT: + return service; + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/WireLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/WireLoader.java new file mode 100644 index 0000000000..0ae3c4405d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/WireLoader.java @@ -0,0 +1,84 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import java.util.HashMap; +import java.util.Map; +import javax.xml.namespace.QName; +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; +import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.model.assembly.Wire; +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class WireLoader extends AbstractLoader { + private static final String XSD = "http://www.w3.org/2001/XMLSchema"; + + private static final Map> TYPE_MAP; + + static { + // todo support more XSD types, or remove if we store the QName + TYPE_MAP = new HashMap>(17); + TYPE_MAP.put(new QName(XSD, "string"), String.class); + } + + public QName getXMLType() { + return AssemblyConstants.WIRE; + } + + public Wire load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert AssemblyConstants.WIRE.equals(reader.getName()); + Wire wire = factory.createWire(); + while (true) { + switch (reader.next()) { + case START_ELEMENT: + QName qname = reader.getName(); + if (AssemblyConstants.WIRE_SOURCE.equals(qname)) { + String uri = reader.getElementText(); + int pos = uri.indexOf('/'); + if (pos < 1) { + throw new ConfigurationLoadException("Invalid source wire"); + } + String partName = uri.substring(0, pos); + String portName = uri.substring(pos + 1); + wire.setSource(factory.createServiceURI(null, partName, portName)); + } else if (AssemblyConstants.WIRE_TARGET.equals(qname)) { + String uri = reader.getElementText(); + int pos = uri.indexOf('/'); + if (pos < 1) { + wire.setTarget(factory.createServiceURI(null, uri)); + }else{ + String partName = uri.substring(0, pos); + String portName = uri.substring(pos + 1); + wire.setTarget(factory.createServiceURI(null, partName, portName)); + } + } + break; + case END_ELEMENT: + return wire; + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/JNDIPropertyFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/JNDIPropertyFactory.java new file mode 100644 index 0000000000..763c88295c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/JNDIPropertyFactory.java @@ -0,0 +1,62 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.impl; + +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamException; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import org.apache.tuscany.core.loader.StAXPropertyFactory; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.injection.JNDIObjectFactory; +import org.apache.tuscany.model.assembly.Property; + +/** + * A StAXPropertyFactory that creates property values by looking them + * up in the default JNDI InitialContext. + * + * This can be used to locate resources in a J2EE environment and inject + * them as configuration properties. For example, to access a database + * a component could write: + * + * &at;Property DataSource myDB; + * + * and configure with + * + * <properties> + * <v:myDb>java:comp/env/jdbc/MyDatabase</v:myDB> + * </properties> + * + * + * @version $Rev$ $Date$ + */ +public class JNDIPropertyFactory implements StAXPropertyFactory { + public ObjectFactory createObjectFactory(XMLStreamReader reader, Property property) throws XMLStreamException, ConfigurationLoadException { + Class type = property.getType(); + assert type != null : "property type is null"; + String text = reader.getElementText(); + try { + Context context = new InitialContext(); + return new JNDIObjectFactory(context, text); + } catch (NamingException e) { + throw new ConfigurationLoadException(e); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java new file mode 100644 index 0000000000..1e9e8ec8fb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java @@ -0,0 +1,105 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.impl; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.StAXElementLoader; +import org.apache.tuscany.core.loader.StAXLoaderRegistry; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.osoa.sca.annotations.Scope; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import java.util.HashMap; +import java.util.Map; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class StAXLoaderRegistryImpl implements StAXLoaderRegistry { + private final Map> loaders = new HashMap>(); + + private Monitor monitor; + + @org.apache.tuscany.core.system.annotation.Monitor + public void setMonitor(Monitor monitor) { + this.monitor = monitor; + } + + public void registerLoader(QName element, StAXElementLoader loader) { + monitor.registeringLoader(element); + loaders.put(element, loader); + } + + public void unregisterLoader(QName element, StAXElementLoader loader) { + monitor.unregisteringLoader(element); + loaders.remove(element); + } + + public AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + QName name = reader.getName(); + monitor.elementLoad(name); + StAXElementLoader loader = loaders.get(name); + if (loader == null) { + ConfigurationLoadException e = new ConfigurationLoadException("Unrecognized element"); + e.setIdentifier(name.toString()); + throw e; + } else { + return loader.load(reader, loaderContext); + } + } + + + private final ThreadLocal modelContext = new ThreadLocal(); + + @Deprecated + public AssemblyContext getContext() { + return modelContext.get(); + } + + @Deprecated + public void setContext(AssemblyContext context) { + modelContext.set(context); + } + + public static interface Monitor { + /** + * Event emitted when a StAX element loader is registered. + * + * @param xmlType the QName of the element the loader will handle + */ + void registeringLoader(QName xmlType); + + /** + * Event emitted when a StAX element loader is unregistered. + * + * @param xmlType the QName of the element the loader will handle + */ + void unregisteringLoader(QName xmlType); + + /** + * Event emitted when a request is made to load an element. + * + * @param xmlType the QName of the element that should be loaded + */ + void elementLoad(QName xmlType); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StringParserPropertyFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StringParserPropertyFactory.java new file mode 100644 index 0000000000..2ed33f895c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StringParserPropertyFactory.java @@ -0,0 +1,110 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.impl; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.core.loader.StAXPropertyFactory; +import org.apache.tuscany.model.assembly.Property; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import java.beans.PropertyEditor; +import java.beans.PropertyEditorManager; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +@Service(interfaces = {StAXPropertyFactory.class}) +public class StringParserPropertyFactory implements StAXPropertyFactory { + public ObjectFactory createObjectFactory(XMLStreamReader reader, Property property) throws XMLStreamException, ConfigurationLoadException { + Class type = property.getType(); + assert type != null : "property type is null"; + String text = reader.getElementText(); + + // degenerate case where we are returning a String + if (String.class.equals(type)) { + return new SingletonObjectFactory(text); + } + + // special handler to convert hexBinary to a byte[] + if (byte[].class.equals(type)) { + byte[] instance = new byte[text.length() >> 1]; + for (int i = 0; i < instance.length; i++) { + instance[i] = (byte) (Character.digit(text.charAt(i << 1), 16) << 4 | Character.digit(text.charAt((i << 1) + 1), 16)); + } + return new SingletonObjectFactory(instance); + } + + // does this type have a static valueOf(String) method? + try { + Method valueOf = type.getMethod("valueOf", String.class); + if (Modifier.isStatic(valueOf.getModifiers())) { + try { + return new SingletonObjectFactory(valueOf.invoke(null, text)); + } catch (IllegalAccessException e) { + throw new AssertionError("getMethod returned an inaccessible method"); + } catch (InvocationTargetException e) { + // FIXME we should throw something better + throw new ConfigurationLoadException(e.getCause()); + } + } + } catch (NoSuchMethodException e) { + // try something else + } + + // does this type have a constructor that takes a String? + try { + Constructor ctr = type.getConstructor(String.class); + return new SingletonObjectFactory(ctr.newInstance(text)); + } catch (NoSuchMethodException e) { + // try something else + } catch (IllegalAccessException e) { + throw new AssertionError("getConstructor returned an inaccessible method"); + } catch (InstantiationException e) { + throw new ConfigurationLoadException("Property type cannot be instantiated: " + type.getName()); + } catch (InvocationTargetException e) { + // FIXME we should throw something better + throw new ConfigurationLoadException(e.getCause()); + } + + // do we have a property editor for it? + PropertyEditor editor = PropertyEditorManager.findEditor(type); + if (editor != null) { + try { + editor.setAsText(text); + return new SingletonObjectFactory(editor.getValue()); + } catch (IllegalArgumentException e) { + // FIXME we should throw something better + throw new ConfigurationLoadException(e); + + } + } + + // FIXME we should throw something better + throw new ConfigurationLoadException("Do not have a way to parse a String into a " + type.getName()); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java new file mode 100644 index 0000000000..1063dec3fc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/WSDLDefinitionRegistryImpl.java @@ -0,0 +1,202 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.impl; + +import java.io.IOException; +import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +import javax.wsdl.Definition; +import javax.wsdl.PortType; +import javax.wsdl.Service; +import javax.wsdl.WSDLException; +import javax.wsdl.extensions.ExtensionRegistry; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.core.loader.WSDLDefinitionRegistry; +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@org.osoa.sca.annotations.Service(interfaces = {WSDLDefinitionRegistry.class}) +@Scope("MODULE") +public class WSDLDefinitionRegistryImpl implements WSDLDefinitionRegistry { + private final WSDLFactory wsdlFactory; + private final ExtensionRegistry registry; + + private final Map> definitionsByLocationByLoader = new WeakHashMap>(); + private final Map>> definitionsByNamespaceByLoader = new WeakHashMap>>(); + + private Monitor monitor; + + public WSDLDefinitionRegistryImpl() throws WSDLException { + wsdlFactory = WSDLFactory.newInstance(); + registry = wsdlFactory.newPopulatedExtensionRegistry(); + } + + @org.apache.tuscany.core.system.annotation.Monitor + public void setMonitor(Monitor monitor) { + this.monitor = monitor; + } + + public ExtensionRegistry getExtensionRegistry() { + return registry; + } + + public Definition loadDefinition(String wsdlLocation, ResourceLoader resourceLoader) throws IOException, WSDLException { + int index = wsdlLocation.indexOf(' '); + if (index == -1) { + throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Invalid wsdlLocation: " + wsdlLocation); + } + String namespace = wsdlLocation.substring(0, index).trim(); + URL url; + URI uri; + try { + uri = new URI(wsdlLocation.substring(index + 1).trim()); + } catch (URISyntaxException e) { + throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Invalid wsdlLocation: " + wsdlLocation); + } + if (uri.isAbsolute()) { + url = uri.toURL(); + } else { + url = resourceLoader.getResource(uri.toString()); + if (url == null) { + throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Resource not found: " + uri); + } + } + return loadDefinition(namespace, url, resourceLoader); + } + + public Definition loadDefinition(String namespace, URL location, ResourceLoader resourceLoader) throws IOException, WSDLException { + Map definitionsByLocation = getDefinitionsByLocation(resourceLoader); + Map> definitionsByNamespace = getDefinitionsByNamespace(resourceLoader); + + Definition definition = definitionsByLocation.get(location); + if (definition != null) { + // return cached copy + return definition; + } + + monitor.readingWSDL(namespace, location); + WSDLReader reader = wsdlFactory.newWSDLReader(); + reader.setFeature("javax.wsdl.verbose", false); + reader.setExtensionRegistry(registry); + + definition = reader.readWSDL(location.toString()); + String definitionNamespace = definition.getTargetNamespace(); + if (namespace != null && !namespace.equals(definitionNamespace)) { + throw new WSDLException(WSDLException.CONFIGURATION_ERROR, namespace + " != " + definition.getTargetNamespace()); + } + + monitor.cachingDefinition(definitionNamespace, location); + definitionsByLocation.put(location, definition); + List definitions = definitionsByNamespace.get(definitionNamespace); + if (definitions == null) { + definitions = new ArrayList(); + definitionsByNamespace.put(definitionNamespace, definitions); + } + definitions.add(definition); + + return definition; + } + + public List getDefinitionsForNamespace(String namespace, ResourceLoader resourceLoader) { + Map> definitionsByNamespace = getDefinitionsByNamespace(resourceLoader); + return definitionsByNamespace.get(namespace); + } + + public PortType getPortType(QName name, ResourceLoader resourceLoader) { + Map> definitionsByNamespace = getDefinitionsByNamespace(resourceLoader); + String namespace = name.getNamespaceURI(); + List definitions = definitionsByNamespace.get(namespace); + if (definitions == null) { + return null; + } + for (Definition definition : definitions) { + PortType portType = definition.getPortType(name); + if (portType != null) { + return portType; + } + } + return null; + } + + public Service getService(QName name, ResourceLoader resourceLoader) { + Map> definitionsByNamespace = getDefinitionsByNamespace(resourceLoader); + String namespace = name.getNamespaceURI(); + List definitions = definitionsByNamespace.get(namespace); + if (definitions == null) { + return null; + } + for (Definition definition : definitions) { + Service service = definition.getService(name); + if (service != null) { + return service; + } + } + return null; + } + + private Map> getDefinitionsByNamespace(ResourceLoader resourceLoader) { + Map> map = definitionsByNamespaceByLoader.get(resourceLoader); + if (map == null) { + map = new HashMap>(); + definitionsByNamespaceByLoader.put(resourceLoader, map); + } + return map; + } + + private Map getDefinitionsByLocation(ResourceLoader resourceLoader) { + Map map = definitionsByLocationByLoader.get(resourceLoader); + if (map == null) { + map = new HashMap(); + definitionsByLocationByLoader.put(resourceLoader, map); + } + return map; + } + + public static interface Monitor { + /** + * Monitor event emitted immediately before an attempt is made to + * read WSDL for the supplied namespace from the supplied location. + * + * @param namespace the target namespace expected in the WSDL; may be null + * @param location the location where we will attempt to read the WSDL definition from + */ + void readingWSDL(String namespace, URL location); + + /** + * Monitor event emitted immediately before registering a WSDL definition + * in the cache. + * + * @param namespace the target namespace for the WSDL + * @param location the location where the WSDL definition was read from + */ + void cachingDefinition(String namespace, URL location); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemBindingLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemBindingLoader.java new file mode 100644 index 0000000000..d75f25a232 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemBindingLoader.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.system; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.StAXUtil; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.assembly.AbstractLoader; +import org.apache.tuscany.core.system.assembly.SystemBinding; +import org.osoa.sca.annotations.Scope; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class SystemBindingLoader extends AbstractLoader { + public static final QName SYSTEM_BINDING = new QName("http://org.apache.tuscany/xmlns/system/0.9", "binding.system"); + + protected QName getXMLType() { + return SYSTEM_BINDING; + } + + public SystemBinding load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert SystemBindingLoader.SYSTEM_BINDING.equals(reader.getName()); + SystemBinding binding = factory.createSystemBinding(); + StAXUtil.skipToEndElement(reader); + return binding; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemImplementationLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemImplementationLoader.java new file mode 100644 index 0000000000..b9f35d8656 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/loader/system/SystemImplementationLoader.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.system; + +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.StAXUtil; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.assembly.AbstractLoader; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.system.assembly.SystemImplementation; +import org.osoa.sca.annotations.Scope; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class SystemImplementationLoader extends AbstractLoader { + public static final QName SYSTEM_IMPLEMENTATION = new QName("http://org.apache.tuscany/xmlns/system/0.9", "implementation.system"); + + private ComponentTypeIntrospector introspector; + + @Autowire + public void setIntrospector(ComponentTypeIntrospector introspector) { + this.introspector = introspector; + } + + protected QName getXMLType() { + return SYSTEM_IMPLEMENTATION; + } + + public SystemImplementation load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert SYSTEM_IMPLEMENTATION.equals(reader.getName()); + SystemImplementation implementation = factory.createSystemImplementation(); + String implClass = reader.getAttributeValue(null, "class"); + Class implementationClass; + try { + implementationClass = loaderContext.getResourceLoader().loadClass(implClass); + implementation.setImplementationClass(implementationClass); + } catch (ClassNotFoundException e) { + throw new ConfigurationLoadException(e); + } + + // todo we should allow componentType sidefiles for system implementations + implementation.setComponentType(introspector.introspect(implementationClass)); + + StAXUtil.skipToEndElement(reader); + return implementation; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java new file mode 100644 index 0000000000..dc623af1fc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/Message.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.message; + +import org.apache.tuscany.core.wire.MessageChannel; +import org.apache.tuscany.core.wire.TargetInvoker; + +/** + * Represents a request, response, or exception flowing through a wire + * + * @version $Rev $Date + */ +public interface Message { + + /** + * Returns the body of the message, which will be the payload or parameters associated with the wire + */ + Object getBody(); + + /** + * Sets the body of the message. + */ + void setBody(Object body); + + /** + * Sets the target invoker to dispatch to when the message passes through the request side of the invocation chain + */ + public void setTargetInvoker(TargetInvoker invoker); + + /** + * Sets the target invoker to dispatch to when the message passes through the request side of the invocation chain + */ + public TargetInvoker getTargetInvoker(); + + /** + * Returns the callback channel + */ + public MessageChannel getCallbackChannel(); + + /** + * + */ + public Message getRelatedCallbackMessage(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java new file mode 100644 index 0000000000..265e4ba601 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/MessageFactory.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.message; + +/** + * A factory for creating messages flowed through a wire during an invocation + */ +public interface MessageFactory { + + /** + * Returns a new message. + */ + Message createMessage(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java new file mode 100644 index 0000000000..a30f17a938 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageFactoryImpl.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.message.impl; + +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.message.MessageFactory; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Init; + +/** + * The default message factory + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class MessageFactoryImpl implements MessageFactory { + + public MessageFactoryImpl() { + super(); + } + + @Init(eager = true) + public void init(){ + } + + public Message createMessage() { + return new MessageImpl(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java new file mode 100644 index 0000000000..f7f365952c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/message/impl/MessageImpl.java @@ -0,0 +1,86 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.message.impl; + +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.wire.MessageChannel; +import org.apache.tuscany.core.wire.TargetInvoker; + +/** + * The default implementation of a message flowed through a wire during an invocation + * + * @version $Rev $Date + */ +public class MessageImpl implements Message, MessageChannel { + + private Object body; + private Message relatedCallbackMessage; + private TargetInvoker invoker; + + protected MessageImpl() { + super(); + } + + /** + * @see org.apache.tuscany.core.message.Message#getBody() + */ + public Object getBody() { + return body; + } + + /** + * @see org.apache.tuscany.core.message.Message#setBody(java.lang.Object) + */ + public void setBody(Object body) { + this.body = body; + } + + /** + * @see org.apache.tuscany.core.message.Message#getCallbackChannel() + */ + public MessageChannel getCallbackChannel() { + return this; + } + + /** + * @see org.apache.tuscany.core.wire.MessageChannel#send(org.apache.tuscany.core.message.Message) + */ + public void send(Message message) { + relatedCallbackMessage = message; + } + + /** + * @see org.apache.tuscany.core.message.Message#getRelatedCallbackMessage() + */ + public Message getRelatedCallbackMessage() { + return relatedCallbackMessage; + } + + /** + * @see org.apache.tuscany.core.message.Message#setTargetInvoker(org.apache.tuscany.core.wire.TargetInvoker) + */ + public void setTargetInvoker(TargetInvoker invoker) { + this.invoker = invoker; + } + + /** + * @see org.apache.tuscany.core.message.Message#getTargetInvoker() + */ + public TargetInvoker getTargetInvoker() { + return invoker; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContext.java new file mode 100644 index 0000000000..16e1fc6483 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContext.java @@ -0,0 +1,62 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.runtime; + +import org.apache.tuscany.core.builder.WireBuilder; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.ConfigurationContext; +import org.apache.tuscany.core.context.SystemCompositeContext; + +/** + * Represents a top-level component context in the runtime, that is the bootstrap context. + * This context serves as the ultimate root of the context hierarchy. Under it are two + * separate trees: the rootContext for user components and the systemContext for + * system components (those that comprise the runtime itself). + * + * @version $Rev$ $Date$ + */ +public interface RuntimeContext extends AutowireContext, ConfigurationContext { + + /* the symbolic name of the runtime bootstrap context */ + public static final String RUNTIME = "tuscany.runtime"; + + /* the symbolic name of the composite context containing all system components in the runtime */ + public static final String SYSTEM = "tuscany.system"; + + /* the symbolic name of the composite context containing all user components in the runtime */ + public static final String ROOT = "tuscany.root"; + + /** + * Returns the context that forms the root of the user component tree. + * All user components will managed by contexts that are children of this root. + * @return the root of the user component tree + */ + public CompositeContext getRootContext(); + + /** + * Returns the context that forms the root of the system component tree. + * All system components, components that provide system services needed by the + * Tuscany runtime itself, will be managed by contexts that are children of this root. + * @return the root of the system component tree + */ + public SystemCompositeContext getSystemContext(); + + /** + * Adds a wire builder to the runtime + */ + @Deprecated + public void addBuilder(WireBuilder builder); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContextImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContextImpl.java new file mode 100644 index 0000000000..0ebc063b90 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeContextImpl.java @@ -0,0 +1,221 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.runtime; + +import java.util.List; + +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.HierarchicalWireBuilder; +import org.apache.tuscany.core.builder.WireBuilder; +import org.apache.tuscany.core.builder.impl.AssemblyVisitorImpl; +import org.apache.tuscany.core.builder.impl.ContextFactoryBuilderRegistryImpl; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.AutowireResolutionException; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.ConfigurationContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.EventException; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.impl.AbstractContext; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; +import org.apache.tuscany.core.system.context.SystemScopeStrategy; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Composite; +import org.apache.tuscany.model.assembly.Extensible; + +/** + * Implementation of a RuntimeContext that forms the foundation for a Tuscany environment. + * + * @version $Rev$ $Date$ + */ +public class RuntimeContextImpl extends AbstractContext implements RuntimeContext { + + // the top-level wire builder in the runtime + private final HierarchicalWireBuilder wireBuilder; + + //private final List listeners = new ArrayList(1); + + private final CompositeContext rootContext; + + private final SystemCompositeContext systemContext; + + private final MonitorFactory monitorFactory; + + private final ContextFactoryBuilderRegistryImpl builderRegistry; + + public RuntimeContextImpl(MonitorFactory monitorFactory, ContextFactoryBuilderRegistry builderRegistry, HierarchicalWireBuilder wireBuilder) { + super(RUNTIME); + this.monitorFactory = monitorFactory; + this.builderRegistry = (ContextFactoryBuilderRegistryImpl) builderRegistry; + this.wireBuilder = wireBuilder; + + rootContext = new CompositeContextImpl(ROOT, this, this, new RuntimeScopeStrategy(), new EventContextImpl(), this); + systemContext = new SystemCompositeContextImpl(SYSTEM, this, this, new SystemScopeStrategy(), new EventContextImpl(), this); + } + + public void start() throws CoreRuntimeException { + if (lifecycleState == RUNNING) { + return; + } + systemContext.start(); + + rootContext.start(); + lifecycleState = RUNNING; + } + + public void stop() throws CoreRuntimeException { + if (lifecycleState == STOPPED) { + return; + } + rootContext.stop(); + systemContext.stop(); + lifecycleState = STOPPED; + } + + public void addBuilder(WireBuilder builder) { + assert (builder != null) : "Builder was null"; + wireBuilder.addWireBuilder(builder); + } + + public Context getContext(String ctxName) { + checkRunning(); + if (ROOT.equals(ctxName)) { + return rootContext; + } else if (SYSTEM.equals(ctxName)) { + return systemContext; + } + return rootContext.getContext(ctxName); + } + + public CompositeContext getRootContext() { + checkRunning(); + return rootContext; + } + + public SystemCompositeContext getSystemContext() { + checkRunning(); + return systemContext; + } + + public void registerModelObject(Extensible model) throws ConfigurationException { + assert (model != null) : "Model was null"; + // note do not configure or buildSource model object since the root context will perform a call back + rootContext.registerModelObject(model); + } + + public void registerModelObjects(List models) throws ConfigurationException { + for (Extensible model : models) { + registerModelObject(model); + } + } + + public CompositeContext getParent() { + return null; // there is no parent + } + + public void setParent(CompositeContext parent) { + throw new UnsupportedOperationException(); + } + + public String getURI() { + return null; + } + + public void setURI(String uri) { + } + + public void setAssemblyContext(AssemblyContext context) { + + } + + //TODO remove + public void fireEvent(int pEventType, Object pMessage) throws EventException { + throw new UnsupportedOperationException(); + } + + public Object locateService(QualifiedName serviceName) { + return null; + } + + public Object locateInstance(QualifiedName serviceName) { + return null; + } + + public Object getInstance(QualifiedName qName) throws TargetException { + return getSystemContext().getInstance(qName); + } + + public synchronized void build(AssemblyObject model) throws BuilderConfigException { + AssemblyVisitorImpl visitor = new AssemblyVisitorImpl(builderRegistry.getBuilders()); + visitor.start(model); + } + + public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, + ScopeContext targetScopeContext) throws BuilderConfigException { + wireBuilder.connect(sourceFactory, targetFactory, targetType, downScope, targetScopeContext); + } + + public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) + throws BuilderConfigException { + wireBuilder.completeTargetChain(targetFactory, targetType, targetScopeContext); + } + + public T resolveInstance(Class instanceInterface) throws AutowireResolutionException { + if (MonitorFactory.class.equals(instanceInterface)) { + return instanceInterface.cast(monitorFactory); + } else if (ConfigurationContext.class.equals(instanceInterface)) { + return instanceInterface.cast(this); + } else if (AutowireContext.class.equals(instanceInterface)) { + return instanceInterface.cast(this); + } else if (RuntimeContext.class.equals(instanceInterface)) { + return instanceInterface.cast(this); + } else if (ContextFactoryBuilderRegistry.class.equals(instanceInterface)) { + return instanceInterface.cast(builderRegistry); + } else { + // autowire to system components + return instanceInterface.cast(getSystemContext().resolveExternalInstance(instanceInterface)); + } + } + + public T resolveExternalInstance(Class instanceInterface) throws AutowireResolutionException { + return systemContext.resolveExternalInstance(instanceInterface); + } + + public Composite getComposite() { + return systemContext.getComposite(); + } + + public void removeContext(String name) { + + } + + private void checkRunning() { + if (lifecycleState != RUNNING) { + throw new IllegalStateException("Context must be in RUNNING state"); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeMonitor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeMonitor.java new file mode 100644 index 0000000000..c1b87d6a13 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeMonitor.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.runtime; + +import org.apache.tuscany.common.TuscanyException; +import org.apache.tuscany.common.TuscanyRuntimeException; + + +/** + * Serves as a top-level error logging monitor + * + * @version $Rev$ $Date$ + */ +public interface RuntimeMonitor { + + public void log(TuscanyRuntimeException e); + + public void log(TuscanyException e); + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeScopeStrategy.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeScopeStrategy.java new file mode 100644 index 0000000000..5051c2674d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeScopeStrategy.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.runtime; + +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.scope.AbstractScopeStrategy; +import org.apache.tuscany.core.context.scope.CompositeScopeContext; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.HashMap; +import java.util.Map; + +/** + * Implements a {@link org.apache.tuscany.core.context.ScopeStrategy} for a runtime context. Specifically, a runtime + * context has only one scope, {@link org.apache.tuscany.model.assembly.Scope#AGGREGATE} + * + * @version $Rev$ $Date$ + */ +public class RuntimeScopeStrategy extends AbstractScopeStrategy { + + public RuntimeScopeStrategy() { + } + + public Map getScopeContexts(EventContext eventContext) { + ScopeContext aggregrateScope = new CompositeScopeContext(eventContext); + Map scopes = new HashMap(); + scopes.put(Scope.AGGREGATE, aggregrateScope); + return scopes; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java new file mode 100644 index 0000000000..6b35115e1f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.sdo; + +import commonj.sdo.helper.DataFactory; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.injection.ObjectCreationException; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.sdo.util.SDOUtil; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class DataFactoryObjectFactory implements ObjectFactory { + + private ContextResolver resolver; + + /** + * @throws org.apache.tuscany.core.injection.FactoryInitException + * + */ + public DataFactoryObjectFactory(ContextResolver resolver) { + this.resolver = resolver; + } + + + public DataFactory getInstance() throws ObjectCreationException { + CompositeContext parent = resolver.getCurrentContext(); + if (parent == null) { + return null;// FIXME semantic here means required is not followed + } + if (!(parent instanceof AutowireContext)) { + ObjectCreationException e = new ObjectCreationException("Parent does not implement " + + AutowireContext.class.getName()); + e.setIdentifier(parent.getName()); + throw e; + } + AutowireContext ctx = (AutowireContext) parent; + AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class); + return SDOUtil.createDataFactory(assemblyContext.getTypeHelper()); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java new file mode 100644 index 0000000000..d345e7be95 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.sdo; + +import commonj.sdo.helper.TypeHelper; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.injection.ObjectCreationException; +import org.apache.tuscany.model.assembly.AssemblyContext; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class TypeHelperObjectFactory implements ObjectFactory { + + + private ContextResolver resolver; + + /** + * @throws org.apache.tuscany.core.injection.FactoryInitException + * + */ + public TypeHelperObjectFactory(ContextResolver resolver) { + this.resolver = resolver; + } + + + public TypeHelper getInstance() throws ObjectCreationException { + CompositeContext parent = resolver.getCurrentContext(); + if (parent == null) { + return null;// FIXME semantic here means required is not followed + } + if (!(parent instanceof AutowireContext)) { + ObjectCreationException e = new ObjectCreationException("Parent does not implement " + + AutowireContext.class.getName()); + e.setIdentifier(parent.getName()); + throw e; + } + AutowireContext ctx = (AutowireContext) parent; + AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class); + return assemblyContext.getTypeHelper(); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java new file mode 100644 index 0000000000..04773f9770 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.sdo; + +import commonj.sdo.helper.XMLHelper; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.injection.ObjectCreationException; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.sdo.util.SDOUtil; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class XMLHelperObjectFactory implements ObjectFactory { + + + private ContextResolver resolver; + + /** + * @throws org.apache.tuscany.core.injection.FactoryInitException + * + */ + public XMLHelperObjectFactory(ContextResolver resolver) { + this.resolver = resolver; + } + + + public XMLHelper getInstance() throws ObjectCreationException { + CompositeContext parent = resolver.getCurrentContext(); + if (parent == null) { + return null;// FIXME semantic here means required is not followed + } + if (!(parent instanceof AutowireContext)) { + ObjectCreationException e = new ObjectCreationException("Parent does not implement " + + AutowireContext.class.getName()); + e.setIdentifier(parent.getName()); + throw e; + } + AutowireContext ctx = (AutowireContext) parent; + AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class); + return SDOUtil.createXMLHelper(assemblyContext.getTypeHelper()); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java new file mode 100644 index 0000000000..eaddf15cb2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java @@ -0,0 +1,62 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.sdo; + +import commonj.sdo.helper.XSDHelper; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.injection.ObjectCreationException; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.sdo.util.SDOUtil; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class XSDHelperObjectFactory implements ObjectFactory { + + + private ContextResolver resolver; + + /** + * @throws org.apache.tuscany.core.injection.FactoryInitException + * + */ + public XSDHelperObjectFactory(ContextResolver resolver) { + this.resolver = resolver; + } + + + public XSDHelper getInstance() throws ObjectCreationException { + CompositeContext parent = resolver.getCurrentContext(); + if (parent == null) { + return null;// FIXME semantic here means required is not followed + } + if (!(parent instanceof AutowireContext)) { + ObjectCreationException e = new ObjectCreationException("Parent does not implement " + + AutowireContext.class.getName()); + e.setIdentifier(parent.getName()); + throw e; + } + AutowireContext ctx = (AutowireContext) parent; + AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class); + return SDOUtil.createXSDHelper(assemblyContext.getTypeHelper()); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java new file mode 100644 index 0000000000..a804fc51b4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.sdo.helper; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a field or method that is used to inject an SDO helper. + * + * The following helpers are supported: + * commonj.sdo.helper.TypeHelper + * commonj.sdo.helper.DataFactory + * commonj.sdo.helper.XSDHelper + * commonj.sdo.helper.XMLHelper + * + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface SDOHelper { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java new file mode 100644 index 0000000000..c6f84fa485 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java @@ -0,0 +1,80 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.sdo.helper; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.extension.config.InjectorExtensibilityElement; +import org.apache.tuscany.core.injection.FieldInjector; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.MethodInjector; +import org.apache.tuscany.core.injection.ObjectCreationException; +import org.apache.tuscany.core.sdo.DataFactoryObjectFactory; +import org.apache.tuscany.core.sdo.TypeHelperObjectFactory; +import org.apache.tuscany.core.sdo.XMLHelperObjectFactory; +import org.apache.tuscany.core.sdo.XSDHelperObjectFactory; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class SDOHelperExtensibilityElement implements InjectorExtensibilityElement { + + private Method method; + private Field field; + private Class type; + + public SDOHelperExtensibilityElement(Method m) { + method = m; + assert(method != null); + assert(method.getParameterTypes().length == 1); + type = method.getParameterTypes()[0]; + } + + public SDOHelperExtensibilityElement(Field field) { + assert (field != null); + this.field = field; + this.type = field.getType(); + } + + public Injector getInjector(ContextResolver resolver) { + ObjectFactory factory; + if (TypeHelper.class.equals(type)) { + factory = new TypeHelperObjectFactory(resolver); + } else if (DataFactory.class.equals(type)) { + factory = new DataFactoryObjectFactory(resolver); + } else if (XSDHelper.class.equals(type)) { + factory = new XSDHelperObjectFactory(resolver); + } else if (XMLHelper.class.equals(type)) { + factory = new XMLHelperObjectFactory(resolver); + } else { + ObjectCreationException e = new ObjectCreationException("Unknown type"); + e.setIdentifier(type.getName()); + throw e; + } + if (method != null) { + return new MethodInjector(method, factory); + } + return new FieldInjector(field, factory); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java new file mode 100644 index 0000000000..dc8d97779f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java @@ -0,0 +1,78 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.sdo.helper; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.InvalidSetterException; +import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport; +import org.apache.tuscany.model.assembly.ComponentType; +import org.osoa.sca.annotations.Scope; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Scope("Module") +public class SDOHelperProcessor extends ImplementationProcessorSupport { + + @Override + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + if (method.getDeclaringClass().equals(Object.class)) { + return; + } + SDOHelper annotation = method.getAnnotation(SDOHelper.class); + if (annotation != null) { + if (!Modifier.isPublic(method.getModifiers())) { + InvalidSetterException e = new InvalidSetterException("SDO setter method is not public"); + e.setIdentifier(method.toString()); + throw e; + } + Class[] params = method.getParameterTypes(); + if (params.length != 1) { + InvalidSetterException e = new InvalidSetterException("SDO setter method must have one parameter"); + e.setIdentifier(method.toString()); + throw e; + } + type.getExtensibilityElements().add(new SDOHelperExtensibilityElement(method)); + + } + + + } + + @Override + public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { + if (field.getDeclaringClass().equals(Object.class)) { + return; + } + int modifiers = field.getModifiers(); + SDOHelper annotation = field.getAnnotation(SDOHelper.class); + if (annotation != null) { + if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { + InvalidSetterException e = new InvalidSetterException("Property field is not public or protected"); + e.setIdentifier(field.getName()); + throw e; + } + type.getExtensibilityElements().add(new SDOHelperExtensibilityElement(field)); + } + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Autowire.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Autowire.java new file mode 100644 index 0000000000..5eb1f6b926 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Autowire.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.annotation; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * A system annotation to inject an autowired instance + * + * @version $Rev$ $Date$ + */ +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface Autowire { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Monitor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Monitor.java new file mode 100644 index 0000000000..aa552b8e0d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/Monitor.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.annotation; + +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import java.lang.annotation.ElementType; +import java.lang.annotation.RetentionPolicy; + +/** + * A system annotation to inject a monitor + * + * @version $Rev: 392146 $ $Date: 2006-04-06 18:11:28 -0700 (Thu, 06 Apr 2006) $ + */ +@Target( { ElementType.METHOD, ElementType.FIELD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface Monitor { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/ParentContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/ParentContext.java new file mode 100644 index 0000000000..a9d07dbb5f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/annotation/ParentContext.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.annotation; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * A system annotation to inject the parent context + * + * @version $Rev$ $Date$ + */ + +@Target( { METHOD, FIELD }) +@Retention(RUNTIME) +public @interface ParentContext { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemAssemblyFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemAssemblyFactory.java new file mode 100644 index 0000000000..fea8d24ba6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemAssemblyFactory.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.assembly; + +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Scope; + +/** + * A factory for building system assembly model artifacts + * + * @version $Rev$ $Date$ + */ +public interface SystemAssemblyFactory extends AssemblyFactory { + + /** + * Returns an assembly model artifact representing a system component implementation + */ + SystemImplementation createSystemImplementation(); + + /** + * Returns an assembly model artifact representing a system module + */ + SystemModule createSystemModule(); + + /** + * Returns an assembly model artifact representing a system binding + */ + SystemBinding createSystemBinding(); + + /** + * Helper method for creating a typical system component. + * + * @param name the name of the component + * @param service the service that the component provides + * @param impl the component implementation + * @param scope the component's scope + * @return a Component model object with the appropriate system implementation + */ + Component createSystemComponent(String name, Class service, Class impl, Scope scope); + + /** + * Helper method for creating a system entry point wired to a component. + * + * @param entryPointName the name of the entry point + * @param serviceContract the service contract exposed + * @param targetName the component to wire the entry point to + * @return a EntryPoint model object that exposes the service contract and is wired to the named component + */ + EntryPoint createSystemEntryPoint(String entryPointName, Class serviceContract, String targetName); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemBinding.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemBinding.java new file mode 100644 index 0000000000..edc7c87c85 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemBinding.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.assembly; + +import org.apache.tuscany.model.assembly.Binding; + +/** + * Represents a system binding + * + * @version $Rev$ $Date$ + */ +public interface SystemBinding extends Binding { + + /** + * Returns the qualified name of the wire target the binding is associated with in component/service form + */ + public String getTargetName(); + + /** + * Sets the qualified name of the wire target the binding is associated with in component/service form + */ + public void setTargetName(String name); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemImplementation.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemImplementation.java new file mode 100644 index 0000000000..a6a024ceca --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemImplementation.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.assembly; + +import org.apache.tuscany.model.assembly.AtomicImplementation; + +/** + * Represents a system component implementation + * + * @version $Rev$ $Date$ + */ +public interface SystemImplementation extends AtomicImplementation { + + /** + * Returns the implementation class of the system component + */ + Class getImplementationClass(); + + /** + * Sets the implementation class of the system component + */ + void setImplementationClass(Class value); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemModule.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemModule.java new file mode 100644 index 0000000000..a43aca67a2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/SystemModule.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.assembly; + +/** + * + */ +import org.apache.tuscany.model.assembly.Module; + +public interface SystemModule extends Module { + + /** + * Returns the implementation class of the system component + */ + Class getImplementationClass(); + + /** + * Sets the implementation class of the system component + */ + void setImplementationClass(Class value); + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java new file mode 100644 index 0000000000..c0d97c9a35 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java @@ -0,0 +1,84 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.assembly.impl; + +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.SystemBinding; +import org.apache.tuscany.core.system.assembly.SystemImplementation; +import org.apache.tuscany.core.system.assembly.SystemModule; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +/** + * The default implementation of the system assembly factory + * + * @version $Rev$ $Date$ + */ +public class SystemAssemblyFactoryImpl extends AssemblyFactoryImpl implements SystemAssemblyFactory { + + public SystemAssemblyFactoryImpl() { + } + + public SystemImplementation createSystemImplementation() { + return new SystemImplementationImpl(); + } + + public SystemBinding createSystemBinding() { + return new SystemBindingImpl(); + } + + public Component createSystemComponent(String name, Class service, Class impl, Scope scope) { + JavaServiceContract jsc = createJavaServiceContract(); + jsc.setInterface(service); + jsc.setScope(scope); + Service s = createService(); + s.setServiceContract(jsc); + + ComponentType componentType = createComponentType(); + componentType.getServices().add(s); + + SystemImplementation sysImpl = createSystemImplementation(); + sysImpl.setImplementationClass(impl); + sysImpl.setComponentType(componentType); + + Component sc = createSimpleComponent(); + sc.setName(name); + sc.setImplementation(sysImpl); + return sc; + } + + public EntryPoint createSystemEntryPoint(String entryPointName, Class serviceContract, String targetName) { + // create the system binding + SystemBinding systemBinding = createSystemBinding(); + + // define the EP's service contract + JavaServiceContract javaServiceContract = createJavaServiceContract(); + javaServiceContract.setInterface(serviceContract); + + return createEntryPoint(entryPointName, javaServiceContract, systemBinding, targetName); + } + + public SystemModule createSystemModule() { + return new SystemModuleImpl(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemBindingImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemBindingImpl.java new file mode 100644 index 0000000000..a9996065e2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemBindingImpl.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.assembly.impl; + +import org.apache.tuscany.core.system.assembly.SystemBinding; +import org.apache.tuscany.model.assembly.impl.BindingImpl; + +/** + * The default implementation of the system binding assembly artifact + * + * @version $Rev$ $Date$ + */ +public class SystemBindingImpl extends BindingImpl implements SystemBinding { + + protected SystemBindingImpl() { + } + + private String name; + + public String getTargetName() { + return name; + } + + public void setTargetName(String name) { + this.name = name; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemImplementationImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemImplementationImpl.java new file mode 100644 index 0000000000..cca3aef1bb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemImplementationImpl.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.assembly.impl; + +import org.apache.tuscany.core.system.assembly.SystemImplementation; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.impl.AtomicImplementationImpl; + +/** + * The default implementation of the system implementation assembly artifact + * + * @version $Rev$ $Date$ + */ +public class SystemImplementationImpl extends AtomicImplementationImpl implements SystemImplementation { + + private Class implementationClass; + + private AssemblyContext modelContext; + + protected SystemImplementationImpl() { + } + + public Class getImplementationClass() { + return implementationClass; + } + + public void setImplementationClass(Class value) { + checkNotFrozen(); + implementationClass = value; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java new file mode 100644 index 0000000000..98198cba85 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java @@ -0,0 +1,174 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.assembly.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.core.system.assembly.SystemModule; +import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.ConfiguredProperty; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Implementation; +import org.apache.tuscany.model.assembly.ModuleFragment; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.OverrideOption; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.apache.tuscany.model.assembly.ServiceURI; +import org.apache.tuscany.model.assembly.Wire; +import org.apache.tuscany.model.assembly.impl.CompositeImpl; + +/** + * An implementation of Module. + */ +public class SystemModuleImpl extends CompositeImpl implements SystemModule { + + private List moduleFragments = new ArrayList(); + private Map moduleFragmentsMap; + private ComponentType componentType; + private Object contextFactory; + + /** + * Constructor + */ + protected SystemModuleImpl() { + } + + /** + * @see org.apache.tuscany.model.assembly.Implementation#getComponentType() + */ + public ComponentType getComponentType() { + return componentType; + } + + /** + * @see org.apache.tuscany.model.assembly.Implementation#setComponentType(org.apache.tuscany.model.assembly.ComponentType) + */ + public void setComponentType(ComponentType componentType) { + checkNotFrozen(); + this.componentType = componentType; + } + + /** + * @see org.apache.tuscany.model.assembly.Module#getModuleFragments() + */ + public List getModuleFragments() { + return moduleFragments; + } + + /** + * @see org.apache.tuscany.model.assembly.Module#getModuleFragment(java.lang.String) + */ + public ModuleFragment getModuleFragment(String name) { + checkInitialized(); + return moduleFragmentsMap.get(name); + } + + /** + * @see org.apache.tuscany.model.assembly.AssemblyObject#initialize(org.apache.tuscany.model.assembly.AssemblyContext) + */ + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + + // Initialize module fragments + for (ModuleFragment moduleFragment : moduleFragments) { + + // Add all WSDL imports, components, entry points and external services from the module fragments + getWSDLImports().addAll(moduleFragment.getWSDLImports()); + getComponents().addAll(moduleFragment.getComponents()); + getEntryPoints().addAll(moduleFragment.getEntryPoints()); + getExternalServices().addAll(moduleFragment.getExternalServices()); + + // Add all the wires from the module fragments + getWires().addAll(moduleFragment.getWires()); + + moduleFragment.initialize(modelContext); + } + + // Initialize the composite + super.initialize(modelContext); + } + + /** + * @see org.apache.tuscany.model.assembly.AssemblyObject#freeze() + */ + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + // Freeze component type and module fragments + if (componentType != null) + componentType.freeze(); + moduleFragments = Collections.unmodifiableList(moduleFragments); + freeze(moduleFragments); + } + + /** + * @see org.apache.tuscany.model.assembly.ContextFactoryHolder#getContextFactory() + */ + public Object getContextFactory() { + return contextFactory; + } + + /** + * @see org.apache.tuscany.model.assembly.ContextFactoryHolder#setContextFactory(java.lang.Object) + */ + public void setContextFactory(Object configuration) { + checkNotFrozen(); + this.contextFactory = configuration; + } + + /** + * @see org.apache.tuscany.model.assembly.impl.CompositeImpl#accept(org.apache.tuscany.model.assembly.AssemblyVisitor) + */ + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (componentType != null) { + if (!componentType.accept(visitor)) + return false; + } + + return accept(moduleFragments, visitor); + + } + + public Class getImplementationClass() { + return SystemCompositeContextImpl.class; // FIXME hack + } + + public void setImplementationClass(Class clazz) { + // do nothing + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java new file mode 100644 index 0000000000..835324c392 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java @@ -0,0 +1,343 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.builder; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.NoAccessorException; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.builder.UnknownTypeException; +import org.apache.tuscany.core.builder.impl.ArrayMultiplicityObjectFactory; +import org.apache.tuscany.core.builder.impl.ListMultiplicityObjectFactory; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.extension.config.InjectorExtensibilityElement; +import org.apache.tuscany.core.extension.config.extensibility.ComponentNameExtensibilityElement; +import org.apache.tuscany.core.extension.config.extensibility.ContextExtensibilityElement; +import org.apache.tuscany.core.extension.config.extensibility.DestroyInvokerExtensibilityElement; +import org.apache.tuscany.core.extension.config.extensibility.InitInvokerExtensibilityElement; +import org.apache.tuscany.core.injection.EventInvoker; +import org.apache.tuscany.core.injection.FactoryInitException; +import org.apache.tuscany.core.injection.FieldInjector; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.MethodInjector; +import org.apache.tuscany.core.injection.NonProxiedTargetFactory; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.core.system.assembly.SystemImplementation; +import org.apache.tuscany.core.system.assembly.SystemModule; +import org.apache.tuscany.core.system.config.SystemContextFactory; +import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement; +import org.apache.tuscany.core.system.config.extensibility.MonitorExtensibilityElement; +import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.Composite; +import org.apache.tuscany.model.assembly.ConfiguredProperty; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.Implementation; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; + +/** + * Decorates components whose implementation type is a {@link org.apache.tuscany.core.system.assembly.SystemImplementation} + * with the appropriate runtime configuration. This builder handles both system composite components as well + * as system leaf or "simple" components. Consequently, both simple and composite component types may be + * injected and autowired. + *

+ * Note that system component references are not proxied. + * + * @version $Rev$ $Date$ + */ +public class SystemContextFactoryBuilder implements ContextFactoryBuilder { + + private final MonitorFactory monitorFactory; + + public SystemContextFactoryBuilder(MonitorFactory monitorFactory) { + this.monitorFactory = monitorFactory; + } + + @SuppressWarnings("unchecked") + public void build(AssemblyObject modelObject) throws BuilderException { + if (!(modelObject instanceof Component)) { + return; + } + Component component = (Component) modelObject; + + Class implClass; + Scope scope; + // Get the component implementation + Implementation componentImplementation = component.getImplementation(); + if (componentImplementation instanceof SystemImplementation + && component.getContextFactory() == null) { + + // The component is a system component, implemented by a Java class + SystemImplementation implementation = (SystemImplementation) componentImplementation; + if (componentImplementation.getComponentType().getServices() == null + || componentImplementation.getComponentType().getServices().size() < 1) { + BuilderConfigException e = new BuilderConfigException("No service configured on component type"); + e.setIdentifier(component.getName()); + throw e; + } + implClass = implementation.getImplementationClass(); + Scope previous = null; + scope = Scope.MODULE; + List services = component.getImplementation().getComponentType().getServices(); + for (Service service : services) { + // calculate and validate the scope of the component; ensure that all service scopes are the same unless + // a scope is stateless + Scope current = service.getServiceContract().getScope(); + if (previous != null && current != null && current != previous + && (current != Scope.INSTANCE && previous != Scope.INSTANCE)) { + BuilderException e = new BuilderConfigException("Incompatible scopes specified for services on component"); + e.setIdentifier(component.getName()); + throw e; + } + if (current != null && current != Scope.MODULE) { + scope = current; + } + } + + } else if (componentImplementation instanceof Composite) { + implClass = ((Composite) componentImplementation).getImplementationClass(); + if (implClass == null) { + // FIXME this is a hack + if (((Module) componentImplementation).getName().startsWith("org.apache.tuscany.core.system")) + { + // The component is a system module component, fix the implementation class to our implementation + // of system module component context + implClass = SystemCompositeContextImpl.class; + } else if (componentImplementation instanceof SystemModule) { + implClass = SystemCompositeContextImpl.class; + } else { + // The component is an app module component, fix the implementation class to our implementation + // of app module component context + //FIXME this should be extensible, i.e. the model should specify the impl class of the module + implClass = CompositeContextImpl.class; + } + //END hack + } + scope = Scope.AGGREGATE; + } else { + return; + } + Set fields; + Set methods; + SystemContextFactory contextFactory; + try { + fields = JavaIntrospectionHelper.getAllFields(implClass); + methods = JavaIntrospectionHelper.getAllUniqueMethods(implClass); + String name = component.getName(); + if (componentImplementation instanceof Module) { + Module module = (Module) componentImplementation; + contextFactory = new SystemContextFactory(name, module, JavaIntrospectionHelper.getDefaultConstructor(implClass), scope); + + } else { + contextFactory = new SystemContextFactory(name, JavaIntrospectionHelper.getDefaultConstructor(implClass), scope); + } + + //ContextObjectFactory contextObjectFactory = new ContextObjectFactory(contextFactory); + + List injectors = new ArrayList(); + + // handle properties + List configuredProperties = component.getConfiguredProperties(); + if (configuredProperties != null) { + for (ConfiguredProperty property : configuredProperties) { + Injector injector = createPropertyInjector(property, fields, methods); + injectors.add(injector); + } + } + + // FIXME do not inject references on an application module yet + if (implClass != CompositeContextImpl.class) { + // handle references + List configuredReferences = component.getConfiguredReferences(); + if (configuredReferences != null) { + for (ConfiguredReference reference : configuredReferences) { + Injector injector = createReferenceInjector(reference, fields, methods, contextFactory); + injectors.add(injector); + } + } + } + List elements = componentImplementation.getComponentType().getExtensibilityElements(); + for (Object element : elements) { + if (element instanceof InitInvokerExtensibilityElement) { + InitInvokerExtensibilityElement invokerElement = (InitInvokerExtensibilityElement) element; + EventInvoker initInvoker = invokerElement.getEventInvoker(); + boolean eagerInit = invokerElement.isEager(); + contextFactory.setEagerInit(eagerInit); + contextFactory.setInitInvoker(initInvoker); + } else if (element instanceof DestroyInvokerExtensibilityElement) { + DestroyInvokerExtensibilityElement invokerElement = (DestroyInvokerExtensibilityElement) element; + EventInvoker destroyInvoker = invokerElement.getEventInvoker(); + contextFactory.setDestroyInvoker(destroyInvoker); + } else if (element instanceof ComponentNameExtensibilityElement) { + ComponentNameExtensibilityElement nameElement = (ComponentNameExtensibilityElement) element; + injectors.add(nameElement.getEventInvoker(name)); + } else if (element instanceof ContextExtensibilityElement) { + ContextExtensibilityElement contextElement = (ContextExtensibilityElement) element; + injectors.add(contextElement.getInjector(contextFactory)); + } else if (element instanceof InjectorExtensibilityElement) { + InjectorExtensibilityElement injectorElement = (InjectorExtensibilityElement) element; + injectors.add(injectorElement.getInjector(contextFactory)); + } else if (element instanceof SystemInjectorExtensibilityElement) { + SystemInjectorExtensibilityElement injectorElement = (SystemInjectorExtensibilityElement) element; + injectors.add(injectorElement.getInjector(contextFactory)); + } else if (element instanceof MonitorExtensibilityElement) { + MonitorExtensibilityElement monitorElement = (MonitorExtensibilityElement) element; + injectors.add(monitorElement.getInjector(monitorFactory)); + } + } + contextFactory.setSetters(injectors); + // decorate the logical model + component.setContextFactory(contextFactory); + } catch (BuilderConfigException e) { + e.addContextName(component.getName()); + throw e; + } catch (NoSuchMethodException e) { + BuilderConfigException ce = new BuilderConfigException("Class does not have a no-arg constructor", e); + ce.setIdentifier(implClass.getName()); + throw ce; + } catch (FactoryInitException e) { + BuilderConfigException ce = new BuilderConfigException("Error building component", e); + ce.addContextName(component.getName()); + throw ce; + } + } + + /** + * Creates an Injector for component properties + */ + private Injector createPropertyInjector(ConfiguredProperty property, Set fields, Set methods) + throws NoAccessorException { + Object value = property.getValue(); + String propName = property.getProperty().getName(); + // @FIXME is this how to get property type of object + Class type = value.getClass(); + + // There is no efficient way to do this + Method method = null; + Field field = JavaIntrospectionHelper.findClosestMatchingField(propName, type, fields); + if (field == null) { + method = JavaIntrospectionHelper.findClosestMatchingMethod(propName, new Class[]{type}, methods); + if (method == null) { + throw new NoAccessorException(propName); + } + } + Injector injector; + // FIXME support types other than String + if (JavaIntrospectionHelper.isImmutable(type)) { + if (field != null) { + injector = new FieldInjector(field, new SingletonObjectFactory(value)); + } else { + injector = new MethodInjector(method, new SingletonObjectFactory(value)); + } + } else { + if (field != null) { + throw new UnknownTypeException(field.getName()); + } else { + throw new UnknownTypeException(method.getName()); + } + } + return injector; + + } + + /** + * Creates object factories that resolve target(s) of a reference and an Injector responsible + * for injecting them into the reference + */ + private Injector createReferenceInjector(ConfiguredReference reference, Set fields, Set methods, + ContextResolver resolver) { + + List objectFactories = new ArrayList(); + String refName = reference.getPort().getName(); + Class refClass = reference.getPort().getServiceContract().getInterface(); + for (ConfiguredService configuredService : reference.getTargetConfiguredServices()) { + objectFactories.add(new NonProxiedTargetFactory(configuredService, resolver)); + } + boolean multiplicity = reference.getPort().getMultiplicity() == Multiplicity.ONE_N + || reference.getPort().getMultiplicity() == Multiplicity.ZERO_N; + return createInjector(refName, refClass, multiplicity, objectFactories, fields, methods); + + } + + /** + * Creates an Injector for an object factories associated with a reference. + */ + private Injector createInjector(String refName, Class refClass, boolean multiplicity, List objectFactories, + Set fields, Set methods) throws NoAccessorException, BuilderConfigException { + Field field; + Method method = null; + if (multiplicity) { + // since this is a multiplicity, we cannot match on business interface type, so scan through the fields, + // matching on name and List or Array + field = JavaIntrospectionHelper.findMultiplicityFieldByName(refName, fields); + if (field == null) { + // No fields found. Again, since this is a multiplicity, we cannot match on interface type, so + // scan through the fields, matching on name and List or Array + method = JavaIntrospectionHelper.findMultiplicityMethodByName(refName, methods); + if (method == null) { + throw new NoAccessorException(refName); + } + } + Injector injector; + if (field != null) { + // for multiplicities, we need to inject the target or targets using an object factory + // which first delegates to create the proxies and then returns them in the appropriate List or array + // type + if (field.getType().isArray()) { + injector = new FieldInjector(field, new ArrayMultiplicityObjectFactory(refClass, objectFactories)); + } else { + injector = new FieldInjector(field, new ListMultiplicityObjectFactory(objectFactories)); + } + } else { + if (method.getParameterTypes()[0].isArray()) { + injector = new MethodInjector(method, new ArrayMultiplicityObjectFactory(refClass, objectFactories)); + } else { + injector = new MethodInjector(method, new ListMultiplicityObjectFactory(objectFactories)); + } + } + return injector; + } else { + field = JavaIntrospectionHelper.findClosestMatchingField(refName, refClass, fields); + if (field == null) { + method = JavaIntrospectionHelper.findClosestMatchingMethod(refName, new Class[]{refClass}, methods); + if (method == null) { + throw new NoAccessorException(refName); + } + } + Injector injector; + if (field != null) { + injector = new FieldInjector(field, objectFactories.get(0)); + } else { + injector = new MethodInjector(method, objectFactories.get(0)); + } + return injector; + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemEntryPointBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemEntryPointBuilder.java new file mode 100644 index 0000000000..c366da53d6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemEntryPointBuilder.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.builder; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.BuilderInitException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.injection.FactoryInitException; +import org.apache.tuscany.core.system.assembly.SystemBinding; +import org.apache.tuscany.core.system.config.SystemEntryPointContextFactory; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; + +/** + * Decorates the logical model with entry point context configuration builders + * + * @version $Rev: 385747 $ $Date: 2006-03-13 22:12:53 -0800 (Mon, 13 Mar 2006) $ + */ +public class SystemEntryPointBuilder implements ContextFactoryBuilder { + + public SystemEntryPointBuilder() { + } + + public void build(AssemblyObject modelObject) throws BuilderException { + if (!(modelObject instanceof EntryPoint)) { + return; + } + EntryPoint entryPoint = (EntryPoint) modelObject; + if (!(entryPoint.getBindings().get(0) instanceof SystemBinding) + || entryPoint.getContextFactory() != null) { + return; + } + try { + String targetName; + ConfiguredService targetService = entryPoint.getConfiguredReference().getTargetConfiguredServices().get(0); + Class serviceInterface = entryPoint.getConfiguredReference().getPort().getServiceContract().getInterface(); + if (targetService.getPart() == null) { + // FIXME not correct + if (targetService.getPort() == null) { + BuilderInitException e = new BuilderInitException("No target service specified on "); + e.setIdentifier(entryPoint.getName()); + } + targetName = targetService.getPort().getName(); + } else { + targetName = targetService.getPart().getName(); + } + SystemEntryPointContextFactory contextFactory = new SystemEntryPointContextFactory(entryPoint.getName(), + targetName, serviceInterface); + entryPoint.setContextFactory(contextFactory); + } catch (FactoryInitException e) { + e.addContextName(entryPoint.getName()); + throw e; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemExternalServiceBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemExternalServiceBuilder.java new file mode 100644 index 0000000000..a568e9aa2f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemExternalServiceBuilder.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.builder; + +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.injection.InterCompositeReferenceFactory; +import org.apache.tuscany.core.system.assembly.SystemBinding; +import org.apache.tuscany.core.system.config.SystemExternalServiceContextFactory; +import org.apache.tuscany.core.system.injection.AutowireObjectFactory; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.ExternalService; + +/** + * Creates runtime configurations for system type external services + * + * @version $Rev$ $Date$ + */ +public class SystemExternalServiceBuilder implements ContextFactoryBuilder { + + public SystemExternalServiceBuilder() { + } + + public void build(AssemblyObject modelObject) throws BuilderException { + if (!(modelObject instanceof ExternalService)) { + return; + } + ExternalService externalService = (ExternalService) modelObject; + if (externalService.getConfiguredService() != null + && externalService.getContextFactory() != null) { + return; + } else if (externalService.getBindings() == null || externalService.getBindings().size() < 1 + || !(externalService.getBindings().get(0) instanceof SystemBinding)) { + return; + } + SystemBinding binding = (SystemBinding)externalService.getBindings().get(0); + if (binding.getTargetName() != null) { + SystemExternalServiceContextFactory contextFactory = new SystemExternalServiceContextFactory(externalService + .getName(), new InterCompositeReferenceFactory(binding.getTargetName())); + externalService.setContextFactory(contextFactory); + } else if (externalService.getConfiguredService().getPort().getServiceContract().getInterface() != null) { + // autowire + Class claz = externalService.getConfiguredService().getPort().getServiceContract().getInterface(); + if (claz == null) { + BuilderException e = new BuilderConfigException("Interface type not specified"); + e.setIdentifier(externalService.getName()); + e.addContextName(externalService.getName()); + throw e; + } + SystemExternalServiceContextFactory config = new SystemExternalServiceContextFactory(externalService + .getName(), new AutowireObjectFactory(claz)); + externalService.setContextFactory(config); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java new file mode 100644 index 0000000000..2e4a2916ce --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java @@ -0,0 +1,208 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.config; + +import org.apache.tuscany.common.TuscanyRuntimeException; +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.injection.EventInvoker; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.PojoObjectFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.system.context.SystemAtomicContext; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.Scope; + +import java.lang.reflect.Constructor; +import java.util.List; +import java.util.Map; + +/** + * A ContextFactory that handles system component implementation types, which may be either simple, leaf + * types or an composites. + *

+ * For composite types, this factory delegates to an {@link org.apache.tuscany.core.builder.ObjectFactory} to create an + * instance of the composite implementation and perform injection of configuration and references. Once an composite + * instance is created, the factory will register the composite's children. This process may be done recursively in a + * lazy fashion, descending down an composite hierarchy as a child composite is instantiated. + * + * @version $Rev$ $Date$ + */ +public class SystemContextFactory implements ContextFactory, ContextResolver { + + // the component name as configured in the hosting module + private String name; + + // if this factory produces composites, the module will be the logical model associated with its children + private Module module; + + private CompositeContext parentContext; + + // the implementation type constructor + private Constructor ctr; + + // injectors for properties, references and other metadata values such as @Context + private List setters; + + // an invoker for a method decorated with @Init + private EventInvoker init; + + // whether the component should be eagerly initialized when its scope starts + private boolean eagerInit; + + // an invoker for a method decorated with @Destroy + private EventInvoker destroy; + + // the scope of the implementation instance + private Scope scope; + + // if the component implementation scope is stateless + private boolean stateless; + + // if the component implementation is an composite context + private boolean isComposite; + + /** + * Creates the runtime configuration + * + * @param name the SCDL name of the component the context refers to + * @param ctr the implementation type constructor + * @param scope the scope of the component implementation type + */ + public SystemContextFactory(String name, Constructor ctr, Scope scope) { + this(name, null, ctr, scope); + } + + /** + * Creates the runtime configuration + * + * @param name the SCDL name of the component the context refers to + * @param module if this factory produces aggregagtes, the logical model associated with its children; otherwise + * null + * @param ctr the implementation type constructor + * @param scope the scope of the component implementation type + */ + public SystemContextFactory(String name, Module module, Constructor ctr, Scope scope) { + assert (name != null) : "Name was null"; + assert (ctr != null) : "Constructor was null"; + this.name = name; + this.module = module; + this.ctr = ctr; + this.isComposite = CompositeContext.class.isAssignableFrom(ctr.getDeclaringClass()); + this.scope = scope; + if (isComposite) { + scope = Scope.AGGREGATE; + } else { + stateless = (scope == Scope.INSTANCE); + } + } + + public String getName() { + return name; + } + + public void addProperty(String propertyName, Object value) { + + } + + public Scope getScope() { + return scope; + } + + public Context createContext() throws ContextCreationException { + if (isComposite) { + try { + // composite context types are themselves an instance context + PojoObjectFactory objectFactory = new PojoObjectFactory(ctr, null, setters); + CompositeContext ctx = objectFactory.getInstance(); + ctx.setName(name); + // the composite has been created, now register its children + if (module != null) { + try { + ctx.registerModelObject(module); + } catch (ConfigurationException e) { + ContextCreationException cce = new ContextCreationException("Error creating context", e); + cce.setIdentifier(getName()); + throw cce; + } + + } + return ctx; + } catch (TuscanyRuntimeException e) { + e.addContextName(name); + throw e; + } + } else { + PojoObjectFactory objectFactory = new PojoObjectFactory(ctr, null, setters); + return new SystemAtomicContext(name, objectFactory, eagerInit, init, destroy, stateless); + } + } + + public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { + throw new UnsupportedOperationException(); + } + + public TargetWireFactory getTargetWireFactory(String serviceName) { + return null; + } + + public Map getTargetWireFactories() { + return null; + } + + public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { + throw new UnsupportedOperationException(); + } + + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) { + + } + + public List getSourceWireFactories() { + return null; + } + + public void setSetters(List setters) { + this.setters = setters; + } + + public void setEagerInit(boolean val) { + eagerInit = val; + } + + public void setInitInvoker(EventInvoker invoker) { + init = invoker; + } + + public void setDestroyInvoker(EventInvoker invoker) { + destroy = invoker; + } + + public void prepare(CompositeContext parent) { + parentContext = parent; + } + + public CompositeContext getCurrentContext() { + return parentContext; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java new file mode 100644 index 0000000000..c9cfeccd6b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java @@ -0,0 +1,99 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.config; + +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.system.context.SystemEntryPointContext; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.List; +import java.util.Map; + +/** + * Creates {@link SystemEntryPointContext} instances based on an entry point configuration in an assembly model + * + * @version $Rev$ $Date$ + */ +public class SystemEntryPointContextFactory implements ContextFactory, ContextResolver { + + // the name of the entry point + private String name; + + private CompositeContext parentContext; + + private String targetName; + + private Class serviceInterface; + + public SystemEntryPointContextFactory(String name, String targetName, Class serviceInterface) { + this.name = name; + this.targetName = targetName; + this.serviceInterface = serviceInterface; + } + + public EntryPointContext createContext() throws ContextCreationException { + return new SystemEntryPointContext(name, targetName, serviceInterface, this); + } + + public Scope getScope() { + return Scope.MODULE; + } + + public String getName() { + return name; + } + + + public void addTargetWireFactory(String serviceName, TargetWireFactory pFactory) { + throw new UnsupportedOperationException(); + } + + public TargetWireFactory getTargetWireFactory(String serviceName) { + return null; + } + + public Map getTargetWireFactories() { + return null; + } + + public void addSourceWireFactory(String referenceName, SourceWireFactory pFactory) { + throw new UnsupportedOperationException(); + } + + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) { + throw new UnsupportedOperationException(); + } + public void addProperty(String propertyName, Object value) { + + } + + public List getSourceWireFactories() { + return null; + } + + public void prepare(CompositeContext parent) { + this.parentContext = parent; + } + + public CompositeContext getCurrentContext() { + return parentContext; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.java new file mode 100644 index 0000000000..14655c2393 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.config; + +/** + * Base marker for system metadata extensions + * + * @version $$Rev$$ $$Date$$ + */ +public interface SystemExtensibilityElement { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java new file mode 100644 index 0000000000..d62afa4425 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java @@ -0,0 +1,110 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.config; + +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.ExternalServiceContext; +import org.apache.tuscany.core.injection.InterCompositeReferenceFactory; +import org.apache.tuscany.core.system.context.SystemExternalServiceContext; +import org.apache.tuscany.core.system.injection.AutowireObjectFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.List; +import java.util.Map; + +/** + * Creates system type external service contexts + * + * @version $Rev$ $Date$ + * @see org.apache.tuscany.core.context.ExternalServiceContext + * @see org.apache.tuscany.core.system.context.SystemExternalServiceContext + */ +public class SystemExternalServiceContextFactory implements ContextFactory, ContextResolver { + + // the name of the external service + private String name; + + // the factory for returning a reference to the implementation instance of the component represented by the external + // service + private ObjectFactory factory; + + private CompositeContext parentContext; + + public SystemExternalServiceContextFactory(String name, ObjectFactory factory) { + assert (name != null) : "Name was null"; + assert (factory != null) : "Object factory was null"; + this.name = name; + this.factory = factory; + } + + public Scope getScope() { + return Scope.MODULE; + } + + public String getName() { + return name; + } + + public void addProperty(String propertyName, Object value) { + throw new UnsupportedOperationException(); + } + + public ExternalServiceContext createContext() throws ContextCreationException { + return new SystemExternalServiceContext(name, factory); + } + + public void addTargetWireFactory(String serviceName, TargetWireFactory pFactory) { + throw new UnsupportedOperationException(); + } + + public TargetWireFactory getTargetWireFactory(String serviceName) { + return null; + } + + public Map getTargetWireFactories() { + return null; + } + + public void addSourceWireFactory(String referenceName, SourceWireFactory pFactory) { + throw new UnsupportedOperationException(); + } + + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) { + + } + + public List getSourceWireFactories() { + return null; + } + + public void prepare(CompositeContext parent) { + parentContext = parent; + if (factory instanceof InterCompositeReferenceFactory) { + ((InterCompositeReferenceFactory) factory).setContextResolver(this); + } else if (factory instanceof AutowireObjectFactory) { + ((AutowireObjectFactory) factory).setContextResolver(this); + } + } + + public CompositeContext getCurrentContext() { + return parentContext; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java new file mode 100644 index 0000000000..7fca219399 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.config; + +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.injection.Injector; + +/** + * An extensiblity element which provides {@link org.apache.tuscany.core.injection.Injector}s based on + * component type metadata specific to system services + * + * @version $$Rev$$ $$Date$$ + */ +public interface SystemInjectorExtensibilityElement { + /** + * Creates an injector + * + * @param resolver that returns the current composite context + */ + public Injector getInjector(ContextResolver resolver); + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemObjectContextFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemObjectContextFactory.java new file mode 100644 index 0000000000..d4a21dd427 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemObjectContextFactory.java @@ -0,0 +1,98 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.config; + +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.core.wire.WireFactory; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.system.context.SystemAtomicContext; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.List; +import java.util.Map; + +/** + * A ContextFactory that contains the configuration needed to convert a simple + * Java Object into a component. The object is assumed to be fully initialized and + * will always be added with MODULE scope. + * + * @version $Rev$ $Date$ + */ +public class SystemObjectContextFactory implements ContextFactory { + private final String name; + private final ObjectFactory objectFactory; + + /** + * Construct a ContextFactory for the supplied Java Object. + * + * @param name the name to be assigned to the resulting component + * @param instance the Java Object that provides the implementation + */ + public SystemObjectContextFactory(String name, Object instance) { + this.name = name; + objectFactory = new SingletonObjectFactory(instance); + } + + public Context createContext() throws ContextCreationException { + return new SystemAtomicContext(name, objectFactory, false, null, null, false); + } + + public Scope getScope() { + return Scope.MODULE; + } + + public String getName() { + return name; + } + + public void addProperty(String propertyName, Object value) { + + } + + public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { + throw new UnsupportedOperationException(); + } + + public TargetWireFactory getTargetWireFactory(String serviceName) { + throw new UnsupportedOperationException(); + } + + public Map getTargetWireFactories() { + throw new UnsupportedOperationException(); + } + + public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { + throw new UnsupportedOperationException(); + } + + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) { + + } + + public List getSourceWireFactories() { + throw new UnsupportedOperationException(); + } + + public void prepare(CompositeContext parent) { + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java new file mode 100644 index 0000000000..42d3151c78 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.config.extensibility; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.injection.FieldInjector; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.MethodInjector; +import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement; +import org.apache.tuscany.core.system.injection.AutowireObjectFactory; + +/** + * A metadata extensbility element for autowires; creates injectors which return the target of an autowire + * + * @version $$Rev$$ $$Date$$ + */ +public class AutowireExtensibilityElement implements SystemInjectorExtensibilityElement { + + private Method method; + private Field field; + + public AutowireExtensibilityElement(Method m) { + assert(m == null || m.getParameterTypes().length == 1): "Illegal number of parameters"; + method = m; + } + + public AutowireExtensibilityElement(Field f) { + field = f; + } + + @SuppressWarnings("unchecked") + public Injector getInjector(ContextResolver resolver) { + if (method != null) { + return new MethodInjector(method, new AutowireObjectFactory(method.getParameterTypes()[0], resolver)); + } else { + return new FieldInjector(field, new AutowireObjectFactory(field.getType(), resolver)); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java new file mode 100644 index 0000000000..61c89d991b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.config.extensibility; + +import java.lang.reflect.Method; +import java.lang.reflect.Field; + +import org.apache.tuscany.core.system.config.SystemExtensibilityElement; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.MethodInjector; +import org.apache.tuscany.core.injection.ContextObjectFactory; +import org.apache.tuscany.core.injection.FieldInjector; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.common.monitor.MonitorFactory; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class MonitorExtensibilityElement implements SystemExtensibilityElement { + + private Method method; + private Field field; + + public MonitorExtensibilityElement(Method m) { + assert(m.getParameterTypes().length == 1): "Illegal number of parameters"; + method = m; + } + + public MonitorExtensibilityElement(Field f) { + field = f; + } + + public Injector getInjector(MonitorFactory factory) { + if (method != null) { + Object monitor = factory.getMonitor(method.getParameterTypes()[0]); + return new MethodInjector(method, new SingletonObjectFactory(monitor)); + } else { + Object monitor = factory.getMonitor(field.getType()); + return new FieldInjector(field, new SingletonObjectFactory(monitor)); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java new file mode 100644 index 0000000000..b95b87c8de --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java @@ -0,0 +1,54 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.config.extensibility; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.injection.ContextObjectFactory; +import org.apache.tuscany.core.injection.FieldInjector; +import org.apache.tuscany.core.injection.Injector; +import org.apache.tuscany.core.injection.MethodInjector; +import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class ParentContextExtensibilityElement implements SystemInjectorExtensibilityElement { + + private Method method; + private Field field; + + public ParentContextExtensibilityElement(Method m) { + assert(m.getParameterTypes().length == 1): "Illegal number of parameters"; + method = m; + } + + public ParentContextExtensibilityElement(Field f) { + field = f; + } + + public Injector getInjector(ContextResolver resolver) { + if (method != null) { + return new MethodInjector(method, new ContextObjectFactory(resolver)); + } else { + return new FieldInjector(field, new ContextObjectFactory(resolver)); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java new file mode 100644 index 0000000000..1885a5eaaa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java @@ -0,0 +1,90 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.config.processor; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.InvalidSetterException; +import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.system.config.extensibility.AutowireExtensibilityElement; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.ConfigurationContext; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.common.monitor.MonitorFactory; + +/** + * Processes {@link Autowire} annotations + * + * @version $$Rev$$ $$Date$$ + */ +public class AutowireProcessor extends ImplementationProcessorSupport { + + @Override + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + Autowire annotation = method.getAnnotation(Autowire.class); + if (annotation != null) { + if (!Modifier.isPublic(method.getModifiers())) { + InvalidSetterException e = new InvalidSetterException("Autowire setter method is not public"); + e.setIdentifier(method.toString()); + throw e; + } + if (method.getParameterTypes().length != 1){ + InvalidSetterException e = new InvalidSetterException("Autowire setter method must have one parameter"); + e.setIdentifier(method.toString()); + throw e; + } + checkAutowireType(method.getParameterTypes()[0],method.getDeclaringClass()); + type.getExtensibilityElements().add(new AutowireExtensibilityElement(method)); + } + } + + @Override + public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { + checkAutowireType(field.getType(),field.getDeclaringClass()); + int modifiers = field.getModifiers(); + Autowire annotation = field.getAnnotation(Autowire.class); + if (annotation != null) { + if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { + InvalidSetterException e = new InvalidSetterException("Autowire field is not public or protected"); + e.setIdentifier(field.getName()); + throw e; + } + type.getExtensibilityElements().add(new AutowireExtensibilityElement(field)); + } + } + + + + private void checkAutowireType(Class paramClass, Class declaringClass) throws BuilderConfigException{ + if (SystemCompositeContext.class.isAssignableFrom(declaringClass) + && !(paramClass.equals(ConfigurationContext.class) + || paramClass.equals(MonitorFactory.class) + || paramClass.equals(RuntimeContext.class) || paramClass.equals( + AutowireContext.class))) { + BuilderConfigException e = new BuilderConfigException("Illegal autowire type for system context"); + e.setIdentifier(paramClass.getName()); + throw e; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java new file mode 100644 index 0000000000..9d7f535cc8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java @@ -0,0 +1,69 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.config.processor; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.InvalidSetterException; +import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport; +import org.apache.tuscany.core.system.annotation.Monitor; +import org.apache.tuscany.core.system.config.extensibility.MonitorExtensibilityElement; +import org.apache.tuscany.model.assembly.ComponentType; + +/** + * Processes {@link org.apache.tuscany.core.system.annotation.Autowire} annotations + * + * @version $$Rev$$ $$Date$$ + */ +public class MonitorProcessor extends ImplementationProcessorSupport { + + @Override + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + Monitor annotation = method.getAnnotation(Monitor.class); + if (annotation != null) { + if (!Modifier.isPublic(method.getModifiers())) { + InvalidSetterException e = new InvalidSetterException("Monitor setter method is not public"); + e.setIdentifier(method.toString()); + throw e; + } + if (method.getParameterTypes().length != 1) { + InvalidSetterException e = new InvalidSetterException("Monitor setter method must have one parameter"); + e.setIdentifier(method.toString()); + throw e; + } + type.getExtensibilityElements().add(new MonitorExtensibilityElement(method)); + } + } + + @Override + public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { + int modifiers = field.getModifiers(); + Monitor annotation = field.getAnnotation(Monitor.class); + if (annotation != null) { + if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { + InvalidSetterException e = new InvalidSetterException("Monitor field is not public or protected"); + e.setIdentifier(field.getName()); + throw e; + } + type.getExtensibilityElements().add(new MonitorExtensibilityElement(field)); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java new file mode 100644 index 0000000000..1ddc68e3e8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java @@ -0,0 +1,72 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.config.processor; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.InvalidSetterException; +import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.system.annotation.ParentContext; +import org.apache.tuscany.core.system.config.extensibility.ParentContextExtensibilityElement; +import org.apache.tuscany.model.assembly.ComponentType; + +/** + * Processes {@link org.apache.tuscany.core.system.annotation.Autowire} annotations + * + * @version $$Rev$$ $$Date$$ + */ +public class ParentContextProcessor extends ImplementationProcessorSupport { + + @Override + public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException { + ParentContext annotation = method.getAnnotation(ParentContext.class); + if (annotation != null) { + if (!Modifier.isPublic(method.getModifiers())) { + InvalidSetterException e = new InvalidSetterException("ParentContext setter method is not public"); + e.setIdentifier(method.toString()); + throw e; + } + if (method.getParameterTypes().length != 1 + && !CompositeContext.class.isAssignableFrom(method.getParameterTypes()[0])) { + InvalidSetterException e = new InvalidSetterException("ParentContext setter method must have one parameter of type " + CompositeContext.class.getName()); + e.setIdentifier(method.toString()); + throw e; + } + type.getExtensibilityElements().add(new ParentContextExtensibilityElement(method)); + } + } + + @Override + public void visitField(Field field, ComponentType type) throws ConfigurationLoadException { + int modifiers = field.getModifiers(); + ParentContext annotation = field.getAnnotation(ParentContext.class); + if (annotation != null) { + if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) { + InvalidSetterException e = new InvalidSetterException("ParentContext field is not public or protected"); + e.setIdentifier(field.getName()); + throw e; + } + type.getExtensibilityElements().add(new ParentContextExtensibilityElement(field)); + } + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAtomicContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAtomicContext.java new file mode 100644 index 0000000000..374555bfb6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemAtomicContext.java @@ -0,0 +1,159 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.injection.EventInvoker; +import org.apache.tuscany.core.injection.ObjectCallbackException; +import org.apache.tuscany.core.injection.ObjectCreationException; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.impl.AbstractContext; +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ContextInitException; +import org.apache.tuscany.core.context.event.InstanceCreated; + +/** + * Manages system component implementation instances + * + * @version $Rev$ $Date$ + */ +public class SystemAtomicContext extends AbstractContext implements AtomicContext { + + private boolean eagerInit; + + private EventInvoker initInvoker; + + private EventInvoker destroyInvoker; + + private boolean stateless; + + // the cached target instance + private Object cachedTargetInstance; + + // responsible for creating a new implementation instance with injected references and properties + private ObjectFactory objectFactory; + + public SystemAtomicContext(String name, ObjectFactory objectFactory, boolean eagerInit, EventInvoker initInvoker, + EventInvoker destroyInvoker, boolean stateless) { + super(name); + assert (objectFactory != null) : "Object factory was null"; + if (eagerInit && initInvoker == null) { + throw new AssertionError("No intialization method found for eager init implementation"); + } + this.objectFactory = objectFactory; + this.eagerInit = eagerInit; + this.initInvoker = initInvoker; + this.destroyInvoker = destroyInvoker; + this.stateless = stateless; + } + + public void setName(String name) { + super.setName(name); + } + + protected int type; + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public void init() throws TargetException{ + getInstance(null); + } + + public void destroy() throws TargetException { + if (cachedTargetInstance != null) { + if (destroyInvoker != null) { + try { + destroyInvoker.invokeEvent(cachedTargetInstance); + } catch (ObjectCallbackException e) { + throw new TargetException(e.getCause()); + } + } + } + lifecycleState = STARTED; + } + + public synchronized Object getInstance(QualifiedName qName) throws TargetException { + if (cachedTargetInstance != null) { + return cachedTargetInstance; // already cached, just return + } + + if (getLifecycleState() == ERROR || getLifecycleState() == CONFIG_ERROR) { + return null; + } + synchronized (this) { + try { + Object instance = objectFactory.getInstance(); + // handle @Init + if (initInvoker != null) { + initInvoker.invokeEvent(instance); + } + publish(new InstanceCreated(this)); + lifecycleState = RUNNING; + if (stateless) { + return instance; + } else { + // cache the actual instance + cachedTargetInstance = instance; + return cachedTargetInstance; + } + } catch (ObjectCreationException e) { + lifecycleState = ERROR; + TargetException te = new TargetException("Error creating component instance", e); + te.setIdentifier(getName()); + throw te; + } + } + + } + + public Object getTargetInstance() throws TargetException { + return getInstance(null); + } + + public boolean isEagerInit() { + return eagerInit; + } + + public boolean isDestroyable() { + return (destroyInvoker != null); + } + + public void start() throws ContextInitException { + if (getLifecycleState() != UNINITIALIZED && getLifecycleState() != STOPPED) { + throw new IllegalStateException("Component must be in UNINITIALIZED state [" + getLifecycleState() + "]"); + } + if (objectFactory == null) { + lifecycleState = ERROR; + ContextInitException e = new ContextInitException("Object factory not found "); + e.setIdentifier(getName()); + throw e; + } + lifecycleState = INITIALIZED; + } + + public void stop() { + lifecycleState = STOPPED; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java new file mode 100644 index 0000000000..9ac0abe38a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemCompositeContextImpl.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.AutowireResolutionException; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.ConfigurationContext; +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.ScopeStrategy; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.impl.AbstractCompositeContext; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.system.config.SystemObjectContextFactory; +import org.apache.tuscany.core.wire.WireFactoryFactory; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; + + +/** + * Implements an composite context for system components. By default a system context uses the scopes specified by + * {@link org.apache.tuscany.core.system.context.SystemScopeStrategy}. In addition, it implements an autowire policy + * where entry points configured with a {@link org.apache.tuscany.core.system.assembly.SystemBinding} are matched + * according to their exposed interface. A system context may contain child composite contexts but an entry point in a + * child context will only be outwardly accessible if there is an entry point that exposes it configured in the + * top-level system context. + * + * @version $Rev$ $Date$ + */ +public class SystemCompositeContextImpl extends AbstractCompositeContext implements SystemCompositeContext { + public SystemCompositeContextImpl() { + super(); + eventContext = new EventContextImpl(); + scopeStrategy = new SystemScopeStrategy(); + } + + public SystemCompositeContextImpl(String name, + CompositeContext parent, + AutowireContext autowire, + ScopeStrategy strategy, + EventContext ctx, + ConfigurationContext configCtx + ) { + super(name, parent, strategy, ctx, configCtx); + setAutowireContext(autowire); + scopeIndex = new ConcurrentHashMap(); + } + + public void registerJavaObject(String componentName, Class service, Object instance) throws ConfigurationException { + SystemObjectContextFactory configuration = new SystemObjectContextFactory(componentName, instance); + registerConfiguration(configuration); + ScopeContext scope = scopeContexts.get(configuration.getScope()); + registerAutowireInternal(service, componentName, scope); + } + + // FIXME These should be removed and configured + private static final MessageFactory messageFactory = new MessageFactoryImpl(); + + private static final WireFactoryFactory WIRE_FACTORY_FACTORY = new JDKWireFactoryFactory(); + + public T resolveInstance(Class instanceInterface) throws AutowireResolutionException { + if (CompositeContext.class.equals(instanceInterface)) { + return instanceInterface.cast(this); + } else if (MessageFactory.class.equals(instanceInterface)) { + return instanceInterface.cast(messageFactory); + } else if (WireFactoryFactory.class.equals(instanceInterface)) { + return instanceInterface.cast(WIRE_FACTORY_FACTORY); + } else { + return super.resolveInstance(instanceInterface); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemEntryPointContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemEntryPointContext.java new file mode 100644 index 0000000000..107e676c47 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemEntryPointContext.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.context.impl.AbstractContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.CoreRuntimeException; +import org.apache.tuscany.core.context.EntryPointContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.TargetException; + +/** + * Manages an entry point into a system module. System entry points cache a direct (i.e. non-proxied) reference to a + * component instance. + * + * @version $Rev$ $Date$ + */ +public class SystemEntryPointContext extends AbstractContext implements EntryPointContext { + + // a reference to the component's implementation instance exposed by the entry point + private Object cachedInstance; + + private ContextResolver resolver; + + private QualifiedName targetName; + + private Class serviceInterface; + + public SystemEntryPointContext(String name, String targetName, Class serviceInterface, ContextResolver resolver) { + super(name); + assert (resolver != null) : "Context resolver was null"; + assert (targetName != null) : "Target name was null"; + assert (serviceInterface != null) : "Service interface is null"; + this.serviceInterface = serviceInterface; + this.resolver = resolver; + this.targetName = new QualifiedName(targetName); + } + + public Object getInstance(QualifiedName qName) throws TargetException { + try { + if (cachedInstance == null) { + Context ctx = resolver.getCurrentContext().getContext(targetName.getPartName()); + if (ctx == null){ + return null; + } + cachedInstance = ctx.getInstance(targetName); + } + return cachedInstance; + } catch (TargetException e) { + e.addContextName(getName()); + throw e; + } + } + + public void start() throws CoreRuntimeException { + lifecycleState = RUNNING; + } + + public void stop() throws CoreRuntimeException { + lifecycleState = STOPPED; + } + + public Object getHandler() throws TargetException { + return getInstance(null); + } + + public Class getServiceInterface() { + return serviceInterface; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemExternalServiceContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemExternalServiceContext.java new file mode 100644 index 0000000000..b85bd2722b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemExternalServiceContext.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.impl.AbstractContext; +import org.apache.tuscany.core.context.ExternalServiceContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.TargetException; + +/** + * An implementation of an external service for system wiring. As system components are not proxied and the system + * binding is by-reference, the implementation caches a reference to its configured target. + * + * @version $Rev$ $Date$ + */ +public class SystemExternalServiceContext extends AbstractContext implements ExternalServiceContext { + + // a factory for retrieving the target of the external service wire + private ObjectFactory factory; + + // the cached target + private Object cachedInstance; + + public SystemExternalServiceContext(String name, ObjectFactory factory) { + super(name); + assert (factory != null) : "Object factory was null"; + this.factory = factory; + } + + public Object getInstance(QualifiedName qName) throws TargetException { + try { + if (cachedInstance == null) { + cachedInstance = factory.getInstance(); + } + return cachedInstance; + } catch (TargetException e) { + e.addContextName(getName()); + throw e; + } + + } + + public void start() { + lifecycleState = RUNNING; + } + + public void stop() { + lifecycleState = STOPPED; + } + + public Object getHandler() throws TargetException { + return this; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemScopeStrategy.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemScopeStrategy.java new file mode 100644 index 0000000000..76b9f2856d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/context/SystemScopeStrategy.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import org.apache.tuscany.core.context.EventContext; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.scope.AbstractScopeStrategy; +import org.apache.tuscany.core.context.scope.CompositeScopeContext; +import org.apache.tuscany.core.context.scope.ModuleScopeContext; +import org.apache.tuscany.core.context.scope.StatelessScopeContext; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.HashMap; +import java.util.Map; + +/** + * Implements a {@link org.apache.tuscany.core.context.ScopeStrategy} for a system composite context with the following scopes: + *
    + *
  • {@link org.apache.tuscany.model.assembly.Scope#AGGREGATE}
  • + *
  • {@link org.apache.tuscany.model.assembly.Scope#MODULE}
  • + *
  • {@link org.apache.tuscany.model.assembly.Scope#INSTANCE}
  • + *
+ * + * @version $Rev$ $Date$ + */ +public class SystemScopeStrategy extends AbstractScopeStrategy { + + public SystemScopeStrategy() { + } + + public Map getScopeContexts(EventContext eventContext) { + ScopeContext aggregrateScope = new CompositeScopeContext(eventContext); + ScopeContext moduleScoper = new ModuleScopeContext(eventContext); + ScopeContext statelessScope = new StatelessScopeContext(eventContext); + Map scopes = new HashMap(); + scopes.put(Scope.AGGREGATE, aggregrateScope); + scopes.put(Scope.MODULE, moduleScoper); + scopes.put(Scope.INSTANCE, statelessScope); + return scopes; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java new file mode 100644 index 0000000000..6c1d291673 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/system/injection/AutowireObjectFactory.java @@ -0,0 +1,72 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.injection; + +import org.apache.tuscany.core.builder.ContextResolver; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.injection.FactoryInitException; +import org.apache.tuscany.core.injection.ObjectCreationException; + +/** + * Returns an instance by resolving against an AutowireContext. + * + * @version $Rev: 385139 $ $Date: 2006-03-11 11:03:11 -0800 (Sat, 11 Mar 2006) $ + */ +public class AutowireObjectFactory implements ObjectFactory { + + private ContextResolver resolver; + + private Class autowireType; + + /** + * + * @throws FactoryInitException + */ + public AutowireObjectFactory(Class autowireType,ContextResolver resolver) { + assert (autowireType != null) : "Target interface was null"; + this.resolver = resolver; + this.autowireType = autowireType; + } + + /** + * Creates a new factory that resolves against the cuurent context using the given implementation type + * + * @throws FactoryInitException + */ + public AutowireObjectFactory(Class implementationType) { + this(implementationType, null); + } + + public T getInstance() throws ObjectCreationException { + CompositeContext parent = resolver.getCurrentContext(); + if (parent == null) { + return null;// FIXME semantic here means required is not followed + } + if (!(parent instanceof AutowireContext)) { + ObjectCreationException e = new ObjectCreationException("Parent does not implement " + + AutowireContext.class.getName()); + e.setIdentifier(parent.getName()); + throw e; + } + AutowireContext ctx = (AutowireContext) parent; + return ctx.resolveInstance(autowireType); + } + + public void setContextResolver(ContextResolver resolver) { + this.resolver = resolver; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ContextBinder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ContextBinder.java new file mode 100644 index 0000000000..70b40e7269 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ContextBinder.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.webapp; + +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + +/** + * @version $Rev$ $Date$ + */ +class ContextBinder extends SCA { + static final ContextBinder BINDER = new ContextBinder(); + + public void setContext(ModuleContext context) { + setModuleContext(context); + } + + public void start() { + throw new AssertionError(); + } + + public void stop() { + throw new AssertionError(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/LazyHTTPSessionId.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/LazyHTTPSessionId.java new file mode 100644 index 0000000000..c9e69eaa82 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/LazyHTTPSessionId.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.webapp; + +import org.apache.tuscany.core.context.ScopeIdentifier; + +import javax.servlet.http.HttpServletRequest; + +/** + * Implements a ScopeIdentifier for a Servlet-based transport. + * Wraps an HttpServletRequest so that the session id associated + * with the current request may be lazily retrieved by the module context - i.e. + * if a session context or session-scoped component is not accessed, no session + * is created. + * + * @version $Rev$ $Date$ + */ +public class LazyHTTPSessionId implements ScopeIdentifier { + + private HttpServletRequest request; + + //---------------------------------- + // Constructors + //---------------------------------- + + public LazyHTTPSessionId(HttpServletRequest request) { + this.request = request; + } + + //---------------------------------- + // Methods + //---------------------------------- + + /** + * Returns the session identifier + * + * @see org.apache.tuscany.core.context.ScopeIdentifier#getIdentifier() + */ + public Object getIdentifier() { + return request.getSession(true); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ServletHost.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ServletHost.java new file mode 100644 index 0000000000..85a4a180c5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/ServletHost.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.webapp; + +import javax.servlet.Servlet; + +/** + * Service interface implemented by host environments that allow Servlets + * to be registered. + *

+ * This interface allows an SCA system component to register a servlet to handle + * inbound requests. + * + * @version $Rev$ $Date$ + */ +public interface ServletHost { + /** + * Register a mapping for an instance of a Servlet. + * This requests that the servlet container direct all requests to the + * designated mapping to the supplied Servlet instance. + * + * @param mapping the uri-mapping for the Servlet + * @param servlet the Servlet that should be invoked + */ + void registerMapping(String mapping, Servlet servlet); + + /** + * Unregister a servlet mapping. + * This directs the servlet contain not to direct any more requests to + * a previously registered Servlet. + * + * @param mapping the uri-mapping for the Servlet + */ + void unregisterMapping(String mapping); + + /** + * Get the servlet instance registered for the mapping. + * + * @param mapping the uri-mapping for the Servlet + * @return the Servelt for the mapping or null if there is no Servlet registered for the mapping + */ + @Deprecated + Servlet getMapping(String mapping); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyRequestFilter.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyRequestFilter.java new file mode 100644 index 0000000000..6637448204 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyRequestFilter.java @@ -0,0 +1,96 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.webapp; + +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.event.HttpSessionBound; +import org.apache.tuscany.core.context.event.RequestStart; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.Filter; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.FilterConfig; +import javax.servlet.ServletResponse; +import javax.servlet.FilterChain; +import javax.servlet.ServletRequest; +import java.io.IOException; + +/** + * Notifies the {@link org.apache.tuscany.core.context.CompositeContext} of web request start and end events as well as setting up the + * current session context. The latter is done using lazy Servlet-based session retrieval. The filter fires a session + * start event, passing a LazyServletSessionId as the session id. The LazyServletSessionId is a + * wrapper for the servlet request which may be called by the ModuleContext to retrieve the session id + * lazily. + * + * @version $Rev: 379957 $ $Date: 2006-02-22 14:58:24 -0800 (Wed, 22 Feb 2006) $ + */ +public class TuscanyRequestFilter implements Filter { + private CompositeContext moduleContext; + + public TuscanyRequestFilter() { + } + + public void init(FilterConfig filterConfig) throws ServletException { + ServletContext servletContext = filterConfig.getServletContext(); + moduleContext = (CompositeContext) servletContext.getAttribute(TuscanyServletListener.MODULE_COMPONENT_NAME); + } + + public void destroy() { + } + + public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws ServletException, IOException { + ModuleContext oldContext = CurrentModuleContext.getContext(); + try { + // Set the current module context + ContextBinder.BINDER.setContext((ModuleContext) moduleContext); + + // Handle a request + if (request instanceof HttpServletRequest) { + if (((HttpServletRequest) request).getSession(false) != null) { + + // A session is already active + moduleContext.publish(new HttpSessionBound(this, ((HttpServletRequest) request).getSession(true))); + } else { + // Create a lazy wrapper since a session is not yet active + moduleContext.publish(new HttpSessionBound(this, new LazyHTTPSessionId((HttpServletRequest) request))); + } + } else { + moduleContext.publish(new HttpSessionBound(this, request)); + } + // Start processing the request + moduleContext.publish(new RequestStart(this, request)); + // Dispatch to the next filter + filterChain.doFilter(request, response); + } catch (Exception e) { + throw new ServletException(e); + + } finally { + try { + // End processing the request + moduleContext.publish(new RequestEnd(this, request)); + } catch (Exception e) { + throw new ServletException(e); + } + ContextBinder.BINDER.setContext(oldContext); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyServletListener.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyServletListener.java new file mode 100644 index 0000000000..8c9c215d64 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/webapp/TuscanyServletListener.java @@ -0,0 +1,129 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.webapp; + +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.HttpSessionEnd; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.runtime.RuntimeContextImpl; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; +import javax.servlet.http.HttpSessionEvent; +import javax.servlet.http.HttpSessionListener; + +/** + * ServletContextListener that can be added to a standard web application to boot + * a Tuscany runtime inside that application. All implementation classes should + * be located in the web application itself. + * + * @version $Rev: 380792 $ $Date: 2006-02-24 11:25:11 -0800 (Fri, 24 Feb 2006) $ + */ +public class TuscanyServletListener implements ServletContextListener, HttpSessionListener { + public static final String SCA_COMPONENT_NAME = "org.apache.tuscany.core.webapp.ModuleComponentName"; + public static final String MODULE_COMPONENT_NAME = "org.apache.tuscany.core.webapp.ModuleComponentContext"; + public static final String TUSCANY_RUNTIME_NAME = RuntimeContext.class.getName(); + + private RuntimeContext runtime; + private CompositeContext moduleContext; + + private static final String SYSTEM_MODULE_COMPONENT = "org.apache.tuscany.core.system"; + + public void contextInitialized(ServletContextEvent servletContextEvent) { + ServletContext servletContext = servletContextEvent.getServletContext(); + String name = servletContext.getInitParameter(SCA_COMPONENT_NAME); + String uri = name; // todo get from context path + MonitorFactory monitorFactory = new NullMonitorFactory(); // todo have one that writes to the servlet log + + try { + bootRuntime(name, uri, monitorFactory); + } catch (ConfigurationException e) { + throw new RuntimeException(e.getMessage(), e); + } + + servletContext.setAttribute(TUSCANY_RUNTIME_NAME, runtime); + servletContext.setAttribute(MODULE_COMPONENT_NAME, moduleContext); + } + + public void contextDestroyed(ServletContextEvent servletContextEvent) { + moduleContext.publish(new ModuleStop(this)); + moduleContext.stop(); + SystemCompositeContext systemContext = runtime.getSystemContext(); + systemContext.publish(new ModuleStop(this)); + systemContext.stop(); + runtime.stop(); + servletContextEvent.getServletContext().removeAttribute(MODULE_COMPONENT_NAME); + servletContextEvent.getServletContext().removeAttribute(TUSCANY_RUNTIME_NAME); + } + + public void sessionCreated(HttpSessionEvent event) { + // do nothing since sessions are lazily created in {@link TuscanyRequestFilter} + } + + public void sessionDestroyed(HttpSessionEvent event) { + // todo do we actually need to bind the module context to the thread to fire this event? + ModuleContext oldContext = CurrentModuleContext.getContext(); + try { + ContextBinder.BINDER.setContext((ModuleContext) moduleContext); + moduleContext.publish(new HttpSessionEnd(this, event.getSession())); + } finally{ + ContextBinder.BINDER.setContext(oldContext); + } + } + + private void bootRuntime(String name, String uri, MonitorFactory monitorFactory) throws ConfigurationException { + + // Create an assembly model context + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + AssemblyContext modelContext = BootstrapHelper.getModelContext(classLoader); + + // Create a runtime context and start it + ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); + runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, new DefaultWireBuilder()); + runtime.start(); + + // Load and start the system configuration + SystemCompositeContext systemContext = runtime.getSystemContext(); + BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext); + ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext); + ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT); + CompositeContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent); + context.publish(new ModuleStart(this)); + + // Load the SCDL configuration of the application module + CompositeContext rootContext = runtime.getRootContext(); + ModuleComponent moduleComponent = loader.loadModuleComponent(name, uri); + moduleContext = BootstrapHelper.registerModule(rootContext, moduleComponent); + + moduleContext.publish(new ModuleStart(this)); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/Interceptor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/Interceptor.java new file mode 100644 index 0000000000..1e87e45616 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/Interceptor.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.apache.tuscany.core.message.Message; + +/** + * Synchronous, around-style mediation associated with a client- or target- side wire. + * + * @version $Rev$ $Date$ + */ +public interface Interceptor { + + /** + * Process a synchronous wire. + * + * @param msg the request Message for the wire + * @return the response Message from the wire + */ + Message invoke(Message msg); + + /** + * Sets the next interceptor. + * + * @param next + */ + void setNext(Interceptor next); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java new file mode 100644 index 0000000000..94e8d91ba5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationConfiguration.java @@ -0,0 +1,181 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +/** + * Contains a source- or target-side invocation pipeline for a service operation. The runtime framework creates invocation chains + * on a per-operation, per-service basis. Further, invocation chains are further distinguished by being part of the source or + * target sides of a wire. Chains are "bridged" together by the runtime by a set of {@link + * org.apache.tuscany.core.builder.WireBuilder}s with the source-side holding references to the target. + *

+ * InvocationChains are managed by {@link WireConfiguration}s, which are used by {@link + * org.apache.tuscany.core.wire.WireFactory}s to buildSource wires and proxies. + *

+ * Invocation configurations must contain at least one interceptor and may have 0 to N handlers. Handlers process a wire request + * or response in a one-way fashion. A typical wire sequence where interceptors and handlers are configured for both the source + * and target-side will proceed as follows: + *

+ * 
    + *
  1. The first source interceptor will be called with a message, which will in + * turn invoke the next interceptor in the chain
  2. The last source interceptor, which must be of type {@link + * org.apache.tuscany.core.wire.impl.RequestResponseInterceptor} if there are handlers present, will be invoked. The RR + * interceptor will in turn pass the message to a {@link MessageChannel} which will invoke all source-side request handlers. + *
  3. The RR interceptor will then invoke the target-side request MessageChannel. + *
  4. The last source-side handler, an instance of {@link org.apache.tuscany.core.wire.impl.MessageDispatcher}, will invoke the + * first source-side interceptor, which in turn will pass the message down the target-side interceptor chain. + *
  5. If the target is a component instance the last target-side interceptor, an instance of + * {@link org.apache.tuscany.core.wire.impl.InvokerInterceptor} will retrieve the {@link TargetInvoker} from the message and + * call it to invoke the operation on a target instance. TargetInvokers are help by + * the source proxy to enable optimizations such as caching of target instances.
  6. The response is returned up the wire + * stack + * until it reaches the source-side RequestResponseInterceptor, which invokes the target and source-side response + * channels respectively. + *
  7. The response is then passed back up the rest of the wire stack.
+ *
+ *

+ * The source-to-target bridge may be constructed in any of the following ways: + *

+ * 
    + *
  • Source handler-to-target handler + *
  • Source handler-to-target interceptor + *
  • Source interceptor-to-target handler + *
  • Source interceptor-to-target interceptor + *
+ *
+ *

+ * In some scenarios, a service proxy may only contain target-side invocaton chains, for example, when a service is resolved + * through a locate operation by a non-component client. In this case, there will be no source-side wire chains and the target + * invoker will be held by the target-side and passed down the pipeline. + * + * @version $Rev$ $Date$ + * @see org.apache.tuscany.core.builder.WireBuilder + * @see WireFactory + * @see TargetInvoker + * @see org.apache.tuscany.core.wire.impl.MessageDispatcher + */ +public abstract class InvocationConfiguration { + + // the operation on the target that will utlimately be invoked + protected Method operation; + + // responsible for invoking a target instance + protected TargetInvoker targetInvoker; + + protected Interceptor interceptorChainHead; + + protected Interceptor interceptorChainTail; + + protected List requestHandlers; + + protected List responseHandlers; + + public InvocationConfiguration(Method operation) { + assert (operation != null) : "No operation type specified"; + this.operation = operation; + } + + /** + * Returns the target operation for this invocation chain + */ + public Method getMethod() { + return operation; + } + + /** + * Adds an request handler to the invocation chain + */ + public void addRequestHandler(MessageHandler handler) { + if (requestHandlers == null) { + requestHandlers = new ArrayList(); + } + requestHandlers.add(handler); + } + + /** + * Adds an response handler to the invocation chain + */ + public void addResponseHandler(MessageHandler handler) { + if (responseHandlers == null) { + responseHandlers = new ArrayList(); + } + responseHandlers.add(handler); + } + + /** + * Returns the request handler chain + */ + public List getRequestHandlers() { + return requestHandlers; + } + + /** + * Returns the response handler chain + */ + public List getResponseHandlers() { + return responseHandlers; + } + + /** + * Sets the target invoker to pass down the chain + */ + public void setTargetInvoker(TargetInvoker invoker) { + this.targetInvoker = invoker; + } + + /** + * Returns the target invoker that is passed down the chain + */ + public TargetInvoker getTargetInvoker() { + return targetInvoker; + } + + /** + * Adds an interceptor to the chain + */ + public void addInterceptor(Interceptor interceptor) { + if (interceptorChainHead == null) { + interceptorChainHead = interceptor; + } else { + interceptorChainTail.setNext(interceptor); + } + interceptorChainTail = interceptor; + } + + /** + * Returns the last interceptor in the chain + */ + public Interceptor getTailInterceptor() { + return interceptorChainTail; + } + + /** + * Returns the first interceptor in the chain + */ + public Interceptor getHeadInterceptor() { + return interceptorChainHead; + } + + /** + * Signals to the chain that its configuration is complete. Implementations may use this callback to prepare there invocation + * chains. + */ + public abstract void build(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationRuntimeException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationRuntimeException.java new file mode 100644 index 0000000000..5e3dbaa204 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/InvocationRuntimeException.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.osoa.sca.ServiceRuntimeException; + +/** + * Denotes a runtime exception thrown during an invocation over a wire + * + * @version $Rev$ $Date$ + */ +public class InvocationRuntimeException extends ServiceRuntimeException { + + public InvocationRuntimeException() { + super(); + } + + public InvocationRuntimeException(String message) { + super(message); + } + + public InvocationRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public InvocationRuntimeException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageChannel.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageChannel.java new file mode 100644 index 0000000000..07a7594849 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageChannel.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.apache.tuscany.core.message.Message; + +/** + * Represents a one-way pipeline through which messages are sent during an invocation over a wire + * + * @see org.apache.tuscany.core.message.Message + */ +public interface MessageChannel { + + /** + * Sends a message + */ + void send(Message message); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageHandler.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageHandler.java new file mode 100644 index 0000000000..19442f3663 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MessageHandler.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.apache.tuscany.core.message.Message; + + +/** + * Performs a uni-directional mediation on a message + * + * @see org.apache.tuscany.core.message.Message + */ +public interface MessageHandler { + + /** + * Process a message. + */ + boolean processMessage(Message message); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java new file mode 100644 index 0000000000..c0e40e0644 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/MethodHashMap.java @@ -0,0 +1,55 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.apache.tuscany.core.config.JavaIntrospectionHelper; + +import java.lang.reflect.Method; +import java.util.HashMap; + +/** + * A Map implementation that performs a lookup on a collection of methods by method name. This implementation is used + * to map methods on one interface to compatible methods on another interface, for example, when flowing an invocation from a + * proxy injected on a source reference to a target service instance. + * + * @version $Rev$ $Date$ + */ +public class MethodHashMap extends HashMap { + + public MethodHashMap() { + super(); + } + + public MethodHashMap(int size) { + super(size); + } + + /** + * @see java.util.HashMap#get(java.lang.Object) + */ + public T get(Object key) { + if (key instanceof Method) { + Method m = (Method) key; + //FIXME find a more efficient way to find a matching method + Method closestMethod = JavaIntrospectionHelper.findClosestMatchingMethod(m.getName(), m.getParameterTypes(), super.keySet()); + return super.get(closestMethod); + } else { + throw new IllegalArgumentException("Key must be a method"); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/ProxyCreationException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/ProxyCreationException.java new file mode 100644 index 0000000000..2caa613b8f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/ProxyCreationException.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +/** + * Denotes an error creating a proxy representing for a wire + * + * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $ + */ +public class ProxyCreationException extends WireException { + + public ProxyCreationException() { + super(); + } + + public ProxyCreationException(String message, Throwable cause) { + super(message, cause); + } + + public ProxyCreationException(String message) { + super(message); + } + + public ProxyCreationException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java new file mode 100644 index 0000000000..80e1450a0d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceInvocationConfiguration.java @@ -0,0 +1,131 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.apache.tuscany.core.wire.impl.MessageChannelImpl; +import org.apache.tuscany.core.wire.impl.MessageDispatcher; +import org.apache.tuscany.core.wire.impl.RequestResponseInterceptor; + +import java.lang.reflect.Method; + +/** + * Contains a source-side invocation pipeline for a service operation. + * + * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $ + */ +public class SourceInvocationConfiguration extends InvocationConfiguration { + + // the pointer to the bridged target head interceptor or null if the target has no interceptors + private Interceptor targetInterceptorChainHead; + + // the pointer to bridged target request channel, or null if the target has an interceptor + private MessageChannel targetRequestChannel; + + // the pointer to bridged target response channel, or null if the target has an interceptor + private MessageChannel targetResponseChannel; + + /** + * Creates an new wire configuration for the given service reference operation + * + * @param operation the method on the interface representing specified by the reference, where the method corresponds to the + * service operation + */ + public SourceInvocationConfiguration(Method operation) { + super(operation); + } + + /** + * Sets the head interceptor of the target-side configuration for the wire. Used when the runtime bridges source and target + * chains. + * + * @param interceptor + */ + public void setTargetInterceptor(Interceptor interceptor) { + targetInterceptorChainHead = interceptor; + } + + /** + * Returns the head target-side interceptor. This will be the head interceptor of the "bridged" target configuration. + */ + public Interceptor getTargetInterceptor() { + return targetInterceptorChainHead; + } + + /** + * Sets the target-side request channel. Used when the runtime bridges source and target chains. + */ + public void setTargetRequestChannel(MessageChannel channel) { + targetRequestChannel = channel; + } + + /** + * Sets the target-side response channel. Used when the runtime bridges source and target chains. + */ + public void setTargetResponseChannel(MessageChannel channel) { + targetResponseChannel = channel; + } + + /** + * Prepares the configuration by linking interceptors and handlers + */ + @Override + public void build() { + + if (requestHandlers != null && targetInterceptorChainHead != null) { + // on target-side, connect existing handlers and interceptors + MessageHandler messageDispatcher = new MessageDispatcher(targetInterceptorChainHead); + requestHandlers.add(messageDispatcher); + } + + if (requestHandlers != null) { + MessageChannel requestChannel = new MessageChannelImpl(requestHandlers); + MessageChannel responseChannel = new MessageChannelImpl(responseHandlers); + Interceptor channelInterceptor = new RequestResponseInterceptor(requestChannel, targetRequestChannel, + responseChannel, targetResponseChannel); + + if (interceptorChainHead != null) { + interceptorChainTail.setNext(channelInterceptor); + } else { + interceptorChainHead = channelInterceptor; + } + + } else { + // no request handlers + if (interceptorChainHead != null) { + if (targetInterceptorChainHead != null) { + // Connect source interceptor chain directly to target interceptor chain + interceptorChainTail.setNext(targetInterceptorChainHead); + // interceptorChainTail = targetInterceptorChainHead; + } else { + // Connect source interceptor chain to the target request channel + Interceptor channelInterceptor = new RequestResponseInterceptor(null, targetRequestChannel, null, + targetResponseChannel); + interceptorChainTail.setNext(channelInterceptor); + } + } else { + // no source interceptor chain or source handlers, conntect to target interceptor chain or channel + if (targetInterceptorChainHead != null) { + interceptorChainHead = targetInterceptorChainHead; + interceptorChainTail = targetInterceptorChainHead; + } else { + Interceptor channelInterceptor = new RequestResponseInterceptor(null, targetRequestChannel, null, + targetResponseChannel); + interceptorChainHead = channelInterceptor; + interceptorChainTail = channelInterceptor; + } + } + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.java new file mode 100644 index 0000000000..c460c71bd5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/SourceWireFactory.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire; + +/** + * Implementations are responsible for managing the source side of a wire. + * + * @version $$Rev$$ $$Date$$ + */ +public interface SourceWireFactory extends WireFactory{ + + /** + * Returns the configuration information used to create the source-side of a wire, including invocation chains + */ + public WireSourceConfiguration getConfiguration(); + + /** + * Sets the configuration information used to create the source-side of a wire, including invocation chains + */ + public void setConfiguration(WireSourceConfiguration config); + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java new file mode 100644 index 0000000000..fc7810763d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvocationConfiguration.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.apache.tuscany.core.wire.impl.MessageDispatcher; + +import java.lang.reflect.Method; + +/** + * Contains a target-side invocation pipeline for a service operation. + * + * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $ + */ +public class TargetInvocationConfiguration extends InvocationConfiguration { + + /** + * Creates an new target-side pipeline for the given operation + * + * @param operation the method on the interface representing target service, where the method corresponds to the service + * operation + */ + public TargetInvocationConfiguration(Method operation) { + super(operation); + } + + /** + * Prepares the configuration by linking interceptors and handlers + */ + @Override + public void build() { + if (requestHandlers != null && interceptorChainHead != null) { + // on target-side, connect existing handlers and interceptors + MessageHandler messageDispatcher = new MessageDispatcher(interceptorChainHead); + requestHandlers.add(messageDispatcher); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java new file mode 100644 index 0000000000..387da1bca3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetInvoker.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import java.lang.reflect.InvocationTargetException; + +/** + * Implementations are responsible for resolving a target and performing the actual invocation on it, for example, a + * service component implementation instance or an external service client. + * + * @version $Rev$ $Date$ + */ +public interface TargetInvoker extends Interceptor, Cloneable{ + + /** + * Responsible for invoking an operation on a target with the given payload + * + * @param payload the parameters of the target operation or null + * @throws InvocationTargetException if the target operation itself throws an exception. The root cause will be set + * to that exception + */ + public Object invokeTarget(Object payload) throws InvocationTargetException; + + /** + * Determines whether the proxy can be cached on the client/source side + */ + public boolean isCacheable(); + + /** + * Implementations must support deep cloning + */ + public Object clone() throws CloneNotSupportedException; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.java new file mode 100644 index 0000000000..f46754b975 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/TargetWireFactory.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire; + +/** + * Implementations are responsible for managing the target side of a wire + * + * @version $$Rev$$ $$Date$$ + */ +public interface TargetWireFactory extends WireFactory { + + /** + * Returns the configuration information used to create the target-side of a wire, including invocation chains + */ + public WireTargetConfiguration getConfiguration(); + + /** + * Sets the configuration information used to create the target-side of a wire, including invocation chains + */ + public void setConfiguration(WireTargetConfiguration config); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java new file mode 100644 index 0000000000..78ab6ee3c7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireConfiguration.java @@ -0,0 +1,92 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.message.MessageFactory; + +import java.lang.reflect.Method; +import java.util.Map; + +/** + * Contains configuration for a wire, including its invocation chains. Invocation chains are accessed from the collection of + * {@link InvocationConfiguration}s keyed by operation on the service specified by the source reference or target service. + * WireConfiguration subtypes distinguish between source and target sides of a wire and hence return corresponding + * InvocationChain subtypes. Operations are represented using JDK reflection, i.e. as a Method + * corresponding to the Java interface representing the service. + *

+ * Wire configurations are created from an assembly model by the runtime during the buildSource phase. + * + * @version $Rev$ $Date$ + */ +public abstract class WireConfiguration { + + protected Map configurations; + + protected ClassLoader proxyClassLoader; + + protected MessageFactory messageFactory; + + protected QualifiedName targetName; + + /** + * Creates the configuration + * + * @param targetName the qualified name of the target service specified by the wire + * @param proxyClassLoader the classloader to use when creating a proxy + * @param messageFactory the factory used to create wire messages + */ + public WireConfiguration(QualifiedName targetName, ClassLoader proxyClassLoader, MessageFactory messageFactory) { + this.targetName = targetName; + this.messageFactory = messageFactory; + if (proxyClassLoader == null) { + this.proxyClassLoader = Thread.currentThread().getContextClassLoader(); + } else { + this.proxyClassLoader = proxyClassLoader; + } + } + + /** + * Returns the qualified name of the target service specified by the wire + */ + public QualifiedName getTargetName() { + return targetName; + } + + /** + * Returns the classloader used for creating proxies + */ + public ClassLoader getProxyClassLoader() { + return proxyClassLoader; + } + + /** + * Returns the factory used to create invocation messages + */ + public MessageFactory getMessageFactory() { + return messageFactory; + } + + /** + * Returns the invocation configuration for each operation on a service specified by a reference or a target service. + */ + public Map getInvocationConfigurations() { + return configurations; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.java new file mode 100644 index 0000000000..0bada0bbfc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireException.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.apache.tuscany.common.TuscanyException; + +/** + * Denotes a top-level exception dealing with a wire + */ +public abstract class WireException extends TuscanyException { + + public WireException() { + super(); + } + + public WireException(String message) { + super(message); + } + + public WireException(String message, Throwable cause) { + super(message, cause); + } + + public WireException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java new file mode 100644 index 0000000000..55cab31adf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactory.java @@ -0,0 +1,76 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +/** + * Implementations are responsible for managing source or target sides of a wire, including creation of service proxies. + * Source-side wires are injected on references and may contain policy interceptors and/or handlers specified by them. Target-side + * wires may contain policy interceptors and/or handlers specified by the service the wire is targeted to or one of its + * operations. Source- and target-side WireFactorys are held in the {@link org.apache.tuscany.core.builder.ContextFactory} + * associated with the source reference or target service. + *

+ * When an assembly is built by the runtime, source-side and target-side wires are "bridged" on the source side (i.e. a reference + * to the target-side is stored in the source-side). This bridging process is done by a series of {@link + * org.apache.tuscany.core.builder.WireBuilder}s configured in the runtime. When a new component implementation instance is + * created, it will be injected with a proxy for each reference containing the bridged source- and target-side wires. + *

+ * Unmanaged code, i.e. clients that are not components, that perform a locate operation are handled differently. In this case, a + * target-side proxy will be returned by the locate operation created by the WireFactory associated with the target + * service. This target-side proxy will only contain the target-side wire and its handlers/interceptors.Ê + *

+ * Wires are structured by operation; that is, they contain an invocation chain per operation on a service. Note that the service + * specified by a reference may differ in type from the target service specified by the wire. In this case, a mediation may be + * performed by the runtime. Hence, source-to-target bridging is done on a per operation basis. Source- and target-side Invocation + * chains are accessible through the subtypes of WireFactory. + * + * @version $Rev$ $Date$ + */ +public interface WireFactory { + + /** + * Prepares the factory. This will typically be called at buildSource time, after bridging source- and target-side invocation chains. + * + * @throws WireFactoryInitException if an error is encountered during initialization + */ + public void initialize() throws WireFactoryInitException; + + /** + * Returns a proxy for a service specified by a reference or target + */ + public T createProxy() throws ProxyCreationException; + + /** + * Sets the primary interface type generated proxies implement + */ + public void setBusinessInterface(Class interfaze); + + /** + * Returns the primary interface type implemented by generated proxies + */ + public Class getBusinessInterface(); + + /** + * Adds an interface type generated proxies implement + */ + public void addInterface(Class claz); + + /** + * Returns an array of all interfaces implemented by generated proxies + */ + public Class[] getImplementatedInterfaces(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java new file mode 100644 index 0000000000..f055ecd427 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryFactory.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import java.lang.reflect.InvocationHandler; + +/** + * Implementations provide a runtime system service that creates {@link WireFactory}s + * + * @version $Rev$ $Date$ + */ +public interface WireFactoryFactory { + + /** + * Creates a target-side wire factory + */ + public TargetWireFactory createTargetWireFactory(); + + /** + * Creates a source-side wire factory + */ + public SourceWireFactory createSourceWireFactory(); + + /** + * Determines whether the given object is a proxy + */ + public boolean isProxy(Object object); + + /** + * Returns an wire handler fronting the wire chains used by the proxy. Note that should SCA define a + * DII, this could return such an interface. + * + * @throws IllegalArgumentException if the class is not a proxy + */ + public InvocationHandler getHandler(Object proxy) throws IllegalArgumentException; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.java new file mode 100644 index 0000000000..caf535ee00 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireFactoryInitException.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +/** + * Denotes an error initializing a wire factory + * + * @version $Rev$ $Date$ + */ +public class WireFactoryInitException extends WireException { + + public WireFactoryInitException() { + super(); + } + + public WireFactoryInitException(String message) { + super(message); + } + + public WireFactoryInitException(String message, Throwable cause) { + super(message, cause); + } + + public WireFactoryInitException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.java new file mode 100644 index 0000000000..d9408b2fb0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireSourceConfiguration.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.message.MessageFactory; + +import java.lang.reflect.Method; +import java.util.Map; + +/** + * Contains configuration for the source side of a wire + * + * @version $Rev: 394379 $ $Date: 2006-04-15 15:01:36 -0700 (Sat, 15 Apr 2006) $ + */ +public class WireSourceConfiguration extends WireConfiguration { + + private String referenceName; + + /** + * Creates the source side of a wire + * + * @param referenceName the name of the reference the wire is associated with + * @param targetName the qualified name of the target service specified by the wire + * @param invocationConfigs a collection of service operation-to-invocation chain mappings + * @param proxyClassLoader the classloader to use when creating a proxy + * @param messageFactory the factory used to create wire messages + */ + public WireSourceConfiguration(String referenceName, QualifiedName targetName, + Map invocationConfigs, ClassLoader proxyClassLoader, MessageFactory messageFactory) { + super(targetName, proxyClassLoader, messageFactory); + this.referenceName = referenceName; + this.configurations = invocationConfigs; + } + + /** + * Creates the source side of a wire where the reference is "anonymous", i.e. on an entry point + * + * @param targetName the qualified name of the target service specified by the wire + * @param invocationConfigs a collection of service operation-to-invocation chain mappings + * @param proxyClassLoader the classloader to use when creating a proxy + * @param messageFactory the factory used to create wire messages + */ + public WireSourceConfiguration(QualifiedName targetName, + Map invocationConfigs, ClassLoader proxyClassLoader, MessageFactory messageFactory) { + this(null, targetName, invocationConfigs, proxyClassLoader, messageFactory); + } + + + /** + * Returns the name of the source reference + */ + public String getReferenceName() { + return referenceName; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java new file mode 100644 index 0000000000..ce6ebade0c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/WireTargetConfiguration.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.context.QualifiedName; + +import java.lang.reflect.Method; +import java.util.Map; + +/** + * Contains configuration for the target side of a wire + * + * @version $$Rev$$ $$Date$$ + */ +public class WireTargetConfiguration extends WireConfiguration { + + /** + * Creates the source side of a wire + * + * @param targetName the qualified name of the target service specified by the wire + * @param invocationConfigs a collection of target service operation-to-invocation chain mappings + * @param proxyClassLoader the classloader to use when creating a proxy + * @param messageFactory the factory used to create wire messages + */ + public WireTargetConfiguration(QualifiedName targetName, Map invocationConfigs, + ClassLoader proxyClassLoader, MessageFactory messageFactory) { + super(targetName, proxyClassLoader, messageFactory); + assert (invocationConfigs != null) : "No wire configuration map specified"; + configurations = invocationConfigs; + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/InvokerInterceptor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/InvokerInterceptor.java new file mode 100644 index 0000000000..9c114c013e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/InvokerInterceptor.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire.impl; + +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.InvocationRuntimeException; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.apache.tuscany.core.message.Message; + +/** + * Serves as a tail interceptor on a target wire chain. This implementation dispatches to the target invoker + * passed inside the wire message. Target invokers are passed from the source in order to allow for caching of + * target instances. + * + * @see org.apache.tuscany.core.wire.TargetInvoker + * @version $Rev$ $Date$ + */ +public class InvokerInterceptor implements Interceptor { + + public InvokerInterceptor() { + } + + public Message invoke(Message msg) throws InvocationRuntimeException { + TargetInvoker invoker = msg.getTargetInvoker(); + if (invoker == null) { + throw new InvocationRuntimeException("No target invoker specified on message"); + } + return invoker.invoke(msg); + } + + public void setNext(Interceptor next) { + throw new IllegalStateException("This interceptor must be the last one in an target interceptor chain"); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageChannelImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageChannelImpl.java new file mode 100644 index 0000000000..8b9d484313 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageChannelImpl.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.impl; + +import org.apache.tuscany.core.wire.MessageChannel; +import org.apache.tuscany.core.wire.MessageHandler; +import org.apache.tuscany.core.message.Message; + +import java.util.List; + +/** + * A channel comprising an ordered collection of message handlers. + * + *@see org.apache.tuscany.core.message.Message + * @version $Rev$ $Date$ + */ +public class MessageChannelImpl implements MessageChannel { + + private final List pipeline; + + //---------------------------------- + // Constructors + //---------------------------------- + + /** + * Construct a new channel comprising the supplied list of handlers. + * + * @param pipeline the Handlers in the channel + */ + public MessageChannelImpl(List pipeline) { + this.pipeline = pipeline; + } + + //---------------------------------- + // Methods + //---------------------------------- + + /** + * Send a message down the channel. The message will be processed by all handlers + * in order until one returns false to indicate processing is complete or all + * handlers have been called. + * + * @param msg a Message to send down the channel + */ + public void send(Message msg) { + if (pipeline!=null) { + for (MessageHandler handler : pipeline) { + if (!handler.processMessage(msg)) { + break; + } + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageDispatcher.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageDispatcher.java new file mode 100644 index 0000000000..ada01b7f91 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/MessageDispatcher.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.impl; + +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.MessageHandler; +import org.apache.tuscany.core.message.Message; + +/** + * A message handler that dispatches the message through an interceptor stack and the uses the response channel to + * return the wire result. + * + * @version $Rev$ $Date$ + */ +public class MessageDispatcher implements MessageHandler { + private final Interceptor head; + + /** + * Construct a handler that dispatches messages to an Interceptor stack. + * + * @param head the interceptor at the head of the stack + */ + public MessageDispatcher(Interceptor head) { + this.head = head; + } + + public boolean processMessage(Message msg) { + Message resp = head.invoke(msg); + msg.getCallbackChannel().send(resp); + return false; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java new file mode 100644 index 0000000000..e46ed26184 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/NullWireFactory.java @@ -0,0 +1,71 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.impl; + +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.wire.WireConfiguration; +import org.apache.tuscany.core.wire.ProxyCreationException; +import org.apache.tuscany.core.wire.WireFactory; +import org.apache.tuscany.core.wire.WireFactoryInitException; + +/** + * Returns an actual implementation instance as opposed to a proxy. Used in cases where proxying may be optimized away. + * + * @version $Rev: 379957 $ $Date: 2006-02-22 14:58:24 -0800 (Wed, 22 Feb 2006) $ + */ +public class NullWireFactory implements WireFactory { + + private CompositeContext parentContext; + + private String targetName; + + private Class businessInterface; + + public NullWireFactory(String componentName, CompositeContext parentContext) { + assert (parentContext != null) : "Parent context was null"; + this.targetName = componentName; + this.parentContext = parentContext; + } + + public void initialize(Class businessInterface, WireConfiguration config) throws WireFactoryInitException { + this.businessInterface = businessInterface; + } + + public Object createProxy() throws ProxyCreationException { + return parentContext.getContext(targetName); + } + + public void initialize() throws WireFactoryInitException { + } + + public void setBusinessInterface(Class interfaze) { + businessInterface = interfaze; + } + + public Class getBusinessInterface() { + return businessInterface; + } + + public void addInterface(Class claz) { + throw new UnsupportedOperationException(); + } + + public Class[] getImplementatedInterfaces() { + throw new UnsupportedOperationException(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/OneWayInterceptor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/OneWayInterceptor.java new file mode 100644 index 0000000000..4e3bb460aa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/OneWayInterceptor.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.impl; + +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.MessageChannel; +import org.apache.tuscany.core.message.Message; + +/** + * An interceptor that sends the wire Message down its request channel and does not expect a response. + * + * @version $Rev$ $Date$ + */ +public class OneWayInterceptor implements Interceptor { + private MessageChannel requestChannel; + + /** + * Construct an interceptor that sends messages down the supplied channel. + * + * @param requestChannel the channel to send messages down + */ + public OneWayInterceptor(MessageChannel requestChannel) { + this.requestChannel = requestChannel; + } + + public Message invoke(Message message) { + requestChannel.send(message); + return null; + } + + public void setNext(Interceptor next) { + throw new IllegalStateException("This interceptor must be the last one in an interceptor chain"); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/RequestResponseInterceptor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/RequestResponseInterceptor.java new file mode 100644 index 0000000000..ae1c69fc12 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/impl/RequestResponseInterceptor.java @@ -0,0 +1,73 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.impl; + +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.MessageChannel; +import org.apache.tuscany.core.message.Message; + +/** + * An interceptor that first sends a message down its request channel then extracts the response from the + * message and sends it down the response channel before returning it up the interceptor stack. + * + * @version $Rev$ $Date$ + */ +public class RequestResponseInterceptor implements Interceptor { + + private MessageChannel sourceRequestChannel; + + private MessageChannel sourceResponseChannel; + + private MessageChannel targetRequestChannel; + + private MessageChannel targetResponseChannel; + + /** + * Construct an interceptor that sends messages down the supplied channels. + * + * @param targetRequestChannel the channel to send request messages down + * @param targetResponseChannel the channel to sent response messages down + */ + public RequestResponseInterceptor(MessageChannel sourceRequestChannel, MessageChannel targetRequestChannel, + MessageChannel sourceResponseChannel, MessageChannel targetResponseChannel) { + this.sourceRequestChannel = sourceRequestChannel; + this.sourceResponseChannel = sourceResponseChannel; + this.targetRequestChannel = targetRequestChannel; + this.targetResponseChannel = targetResponseChannel; + } + + public Message invoke(Message requestMessage) { + if (sourceRequestChannel != null) { + sourceRequestChannel.send(requestMessage); + } + if (targetRequestChannel != null) { + targetRequestChannel.send(requestMessage); + } + Message responseMessage = requestMessage.getRelatedCallbackMessage(); + if (targetResponseChannel != null) { + targetResponseChannel.send(responseMessage); + } + if (sourceResponseChannel != null) { + sourceResponseChannel.send(responseMessage); + } + return responseMessage; + } + + public void setNext(Interceptor next) { + throw new IllegalStateException("This interceptor must be the last one in an interceptor chain"); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java new file mode 100644 index 0000000000..2cef096a5e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandler.java @@ -0,0 +1,137 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.jdk; + +import org.apache.tuscany.core.context.TargetException; +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.InvocationConfiguration; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.message.MessageFactory; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; + +/** + * Receives a request from a JDK proxy and dispatches it to a target invoker or source interceptor stack + * + * @version $Rev$ $Date$ + */ +public class JDKInvocationHandler implements InvocationHandler { + + private MessageFactory messageFactory; + + /* + * an association of an operation to configuration holder. The holder contains the master wire configuration + * and a locale clone of the master TargetInvoker. TargetInvokers will be cloned by the handler and placed in the + * holder if they are cacheable. This allows optimizations such as avoiding target resolution when a source refers + * to a target of greater scope since the target reference can be maintained by the invoker. When a target invoker + * is not cacheable, the master associated with the wire configuration will be used. + */ + private Map configuration; + + public JDKInvocationHandler(MessageFactory messageFactory, Map configuration) { + assert (messageFactory != null) : "Message factory was null"; + assert (configuration != null) : "Configuration not specified"; + this.configuration = new HashMap(configuration.size()); + for (Map.Entry entry : configuration.entrySet()) { + this.configuration.put(entry.getKey(), new ConfigHolder(entry.getValue())); + } + this.messageFactory = messageFactory; + } + + /** + * Dispatches a client request made on a proxy + */ + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + Interceptor headInterceptor = null; + ConfigHolder holder = configuration.get(method); + if (holder == null) { + TargetException e = new TargetException("Operation not configured"); + e.setIdentifier(method.getName()); + throw e; + } + InvocationConfiguration config = holder.config; + if (config != null) { + headInterceptor = config.getHeadInterceptor(); + } + + TargetInvoker invoker; + + if (holder.cachedInvoker == null) { + assert config != null; + if(config.getTargetInvoker() == null){ + TargetException e= new TargetException("No target invoker configured for operation"); + e.setIdentifier(config.getMethod().getName()); + throw e; + } + if (config.getTargetInvoker().isCacheable()) { + // clone and store the invoker locally + holder.cachedInvoker = (TargetInvoker) config.getTargetInvoker().clone(); + invoker = holder.cachedInvoker; + } else { + invoker = config.getTargetInvoker(); + } + } else { + assert config != null; + invoker = config.getTargetInvoker(); + } + if (headInterceptor == null) { + try { + // short-circuit the dispatch and invoke the target directly + if (config.getTargetInvoker() == null) { + throw new AssertionError("No target invoker [" + method.getName() + "]"); + } + return config.getTargetInvoker().invokeTarget(args); + } catch (InvocationTargetException e) { + // the cause was thrown by the target so throw it + throw e.getCause(); + } + } else { + Message msg = messageFactory.createMessage(); + msg.setTargetInvoker(invoker); + msg.setBody(args); + // dispatch the wire down the chain and get the response + Message resp = headInterceptor.invoke(msg); + + Object body = resp.getBody(); + if (body instanceof Throwable) { + throw (Throwable) body; + } + return body; + } + } + + /** + * A holder used to associate an wire configuration with a local copy of a target invoker that was previously + * cloned from the configuration master + */ + private class ConfigHolder { + + public ConfigHolder(InvocationConfiguration config) { + this.config = config; + } + + InvocationConfiguration config; + + TargetInvoker cachedInvoker; + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java new file mode 100644 index 0000000000..dbaab87fce --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKSourceWireFactory.java @@ -0,0 +1,92 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire.jdk; + +import org.apache.tuscany.core.wire.MethodHashMap; +import org.apache.tuscany.core.wire.WireFactoryInitException; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.WireSourceConfiguration; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Map; + +/** + * Creates proxies that are injected on references using JDK dynamic proxy facilities and front a wire. The proxies implement the + * business interface associated with the service required by reference. + * + * @version $Rev: 394431 $ $Date: 2006-04-15 21:27:44 -0700 (Sat, 15 Apr 2006) $ + */ +public class JDKSourceWireFactory implements SourceWireFactory { + + private static final int UNINITIALIZED = 0; + + private static final int INITIALIZED = 1; + + private int state = UNINITIALIZED; + + private Class[] businessInterfaceArray; + + private Map methodToInvocationConfig; + + private WireSourceConfiguration configuration; + + public void initialize() throws WireFactoryInitException { + if (state != UNINITIALIZED) { + throw new IllegalStateException("Proxy factory in wrong state [" + state + "]"); + } + Map invocationConfigs = configuration.getInvocationConfigurations(); + methodToInvocationConfig = new MethodHashMap(invocationConfigs.size()); + for (Map.Entry entry : invocationConfigs.entrySet()) { + Method method = entry.getKey(); + methodToInvocationConfig.put(method, entry.getValue()); + } + state = INITIALIZED; + } + + public Object createProxy() { + if (state != INITIALIZED) { + throw new IllegalStateException("Proxy factory not INITIALIZED [" + state + "]"); + } + InvocationHandler handler = new JDKInvocationHandler(configuration.getMessageFactory(), methodToInvocationConfig); + return Proxy.newProxyInstance(configuration.getProxyClassLoader(), businessInterfaceArray, handler); + } + + public WireSourceConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration(WireSourceConfiguration config) { + configuration = config; + } + + public void setBusinessInterface(Class interfaze) { + businessInterfaceArray = new Class[]{interfaze}; + } + + public Class getBusinessInterface() { + return businessInterfaceArray[0]; + } + + public void addInterface(Class claz) { + throw new UnsupportedOperationException("Additional proxy interfaces not yet supported"); + } + + public Class[] getImplementatedInterfaces() { + return businessInterfaceArray; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java new file mode 100644 index 0000000000..76f3b0389c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKTargetWireFactory.java @@ -0,0 +1,95 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.jdk; + +import org.apache.tuscany.core.wire.MethodHashMap; +import org.apache.tuscany.core.wire.WireFactoryInitException; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.WireTargetConfiguration; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Map; + +/** + * Creates proxies that are returned to non-SCA clients using JDK dynamic proxy facilities and front a wire. The proxies implement + * the business interface associated with the target service of the wire and are typically returned by a locate operation. + * + * @version $Rev: 394431 $ $Date: 2006-04-15 21:27:44 -0700 (Sat, 15 Apr 2006) $ + */ +public class JDKTargetWireFactory implements TargetWireFactory { + + private static final int UNINITIALIZED = 0; + + private static final int INITIALIZED = 1; + + private int state = UNINITIALIZED; + + private Class[] businessInterfaceArray; + + private Map methodToInvocationConfig; + + private WireTargetConfiguration configuration; + + public void initialize() throws WireFactoryInitException { + if (state != UNINITIALIZED) { + throw new IllegalStateException("Proxy factory in wrong state [" + state + "]"); + } + Map invocationConfigs = configuration.getInvocationConfigurations(); + methodToInvocationConfig = new MethodHashMap(invocationConfigs.size()); + for (Map.Entry entry : invocationConfigs.entrySet()) { + Method method = entry.getKey(); + methodToInvocationConfig.put(method, entry.getValue()); + } + state = INITIALIZED; + } + + public Object createProxy() { + if (state != INITIALIZED) { + throw new IllegalStateException("Proxy factory not INITIALIZED [" + state + "]"); + } + InvocationHandler handler = new JDKInvocationHandler(configuration.getMessageFactory(), methodToInvocationConfig); + return Proxy.newProxyInstance(configuration.getProxyClassLoader(), businessInterfaceArray, handler); + } + + public WireTargetConfiguration getConfiguration() { + return configuration; + } + + public void setConfiguration(WireTargetConfiguration config) { + configuration = config; + } + + public void setBusinessInterface(Class interfaze) { + businessInterfaceArray = new Class[]{interfaze}; + } + + public Class getBusinessInterface() { + return businessInterfaceArray[0]; + } + + public void addInterface(Class claz) { + throw new UnsupportedOperationException("Additional proxy interfaces not yet supported"); + } + + public Class[] getImplementatedInterfaces() { + return businessInterfaceArray; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java new file mode 100644 index 0000000000..3eaffb9ba8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactory.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire.jdk; + +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.WireFactoryFactory; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; + +/** + * A system service that creates JDK dynamic proxy-based {@link org.apache.tuscany.core.wire.WireFactory}s + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +@Service(interfaces = {WireFactoryFactory.class}) +public class JDKWireFactoryFactory implements WireFactoryFactory { + + public JDKWireFactoryFactory() { + } + + @Init(eager = true) + public void init() { + } + + public TargetWireFactory createTargetWireFactory() { + return new JDKTargetWireFactory(); + } + + public SourceWireFactory createSourceWireFactory() { + return new JDKSourceWireFactory(); + } + + public boolean isProxy(Object object) { + if (object == null) { + return false; + } else { + return Proxy.isProxyClass(object.getClass()); + } + } + + public InvocationHandler getHandler(Object proxy) { + if (proxy == null) { + return null; + } else { + return Proxy.getInvocationHandler(proxy); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java new file mode 100644 index 0000000000..3c61081caf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/DefaultWireFactoryService.java @@ -0,0 +1,157 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire.service; + +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.wire.MethodHashMap; +import org.apache.tuscany.core.wire.WireFactoryFactory; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.core.wire.impl.InvokerInterceptor; +import org.apache.tuscany.core.builder.system.PolicyBuilderRegistry; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.List; +import java.util.ArrayList; + +/** + * The default implementation of a WireFactoryFactory + * + * @version $$Rev$$ $$Date$$ + */ +@Scope("MODULE") +@Service(interfaces = {org.apache.tuscany.core.wire.service.WireFactoryService.class}) +public class DefaultWireFactoryService implements org.apache.tuscany.core.wire.service.WireFactoryService { + + private MessageFactory messageFactory; + private WireFactoryFactory wireFactoryFactory; + private PolicyBuilderRegistry policyRegistry; + + + public DefaultWireFactoryService() { + + } + + public DefaultWireFactoryService(MessageFactory messageFactory, WireFactoryFactory wireFactoryFactory, PolicyBuilderRegistry registry) { + this.messageFactory = messageFactory; + this.wireFactoryFactory = wireFactoryFactory; + this.policyRegistry = registry; + } + + @Autowire + public void setMessageFactory(MessageFactory messageFactory) { + this.messageFactory = messageFactory; + } + + @Autowire + public void setWireFactoryService(WireFactoryFactory wireFactoryFactory) { + this.wireFactoryFactory = wireFactoryFactory; + } + + @Autowire + public void setPolicyRegistry(PolicyBuilderRegistry policyRegistry) { + this.policyRegistry = policyRegistry; + } + + @Init(eager = true) + public void init() { + } + + public List createSourceFactory(ConfiguredReference configuredReference) throws BuilderConfigException{ + String referenceName = configuredReference.getPort().getName(); + Class interfaze; + // FIXME hack for NPE when entry points with no set service contract on their configuredReference + if (configuredReference.getPort().getServiceContract() != null){ + interfaze = configuredReference.getPort().getServiceContract().getInterface(); + }else if(configuredReference.getPart() instanceof EntryPoint){ + interfaze = ((EntryPoint)configuredReference.getPart()).getConfiguredService().getPort().getServiceContract().getInterface(); + }else{ + BuilderConfigException bce = new BuilderConfigException("No interface found on configured reference"); + bce.setIdentifier(configuredReference.getName()); + throw bce; + } + List wireFactories = new ArrayList(); + List wireConfigurations = new ArrayList(); + for (ConfiguredService configuredService : configuredReference.getTargetConfiguredServices()) { + String targetCompName = configuredService.getPart().getName(); + String targetSerivceName = configuredService.getPort().getName(); + QualifiedName targetName = new QualifiedName(targetCompName + QualifiedName.NAME_SEPARATOR + targetSerivceName); + SourceWireFactory wireFactory = wireFactoryFactory.createSourceWireFactory(); + Map iConfigMap = new HashMap(); + Set javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(interfaze); + for (Method method : javaMethods) { + SourceInvocationConfiguration iConfig = new SourceInvocationConfiguration(method); + iConfigMap.put(method, iConfig); + } + WireSourceConfiguration wireConfiguration = new WireSourceConfiguration(referenceName, targetName, iConfigMap, interfaze.getClassLoader(), + messageFactory); + wireConfigurations.add(wireConfiguration); + wireFactory.setBusinessInterface(interfaze); + wireFactory.setConfiguration(wireConfiguration); + wireFactories.add(wireFactory); + } + if (policyRegistry != null) { + // invoke policy builders + policyRegistry.buildSource(configuredReference, wireConfigurations); + } + return wireFactories; + + } + + public TargetWireFactory createTargetFactory(ConfiguredService configuredService) { + org.apache.tuscany.model.assembly.Service service = configuredService.getPort(); + Class interfaze = service.getServiceContract().getInterface(); + QualifiedName targetName = new QualifiedName(configuredService.getPart().getName() + QualifiedName.NAME_SEPARATOR + + service.getName()); + + Map iConfigMap = new MethodHashMap(); + TargetWireFactory wireFactory = wireFactoryFactory.createTargetWireFactory(); + Set javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(interfaze); + for (Method method : javaMethods) { + TargetInvocationConfiguration iConfig = new TargetInvocationConfiguration(method); + iConfigMap.put(method, iConfig); + } + WireTargetConfiguration wireConfiguration = new WireTargetConfiguration(targetName, iConfigMap, interfaze.getClassLoader(), messageFactory); + wireFactory.setBusinessInterface(interfaze); + wireFactory.setConfiguration(wireConfiguration); + if (policyRegistry != null) { + // invoke policy builders + policyRegistry.buildTarget(configuredService, wireConfiguration); + } + // add tail interceptor + for (TargetInvocationConfiguration iConfig : wireFactory.getConfiguration().getInvocationConfigurations().values()) { + iConfig.addInterceptor(new InvokerInterceptor()); + } + return wireFactory; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java new file mode 100644 index 0000000000..eb41baf69a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/wire/service/WireFactoryService.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire.service; + +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; + +import java.util.List; + +/** + * Implementations provide a system service that creates {@link org.apache.tuscany.core.wire.SourceWireFactory}s + * and {@link org.apache.tuscany.core.wire.TargetWireFactory}s. This service is used by {@link + * org.apache.tuscany.core.builder.ContextFactoryBuilder}s to provide {@link org.apache.tuscany.core.builder.ContextFactory}s with + * {@link org.apache.tuscany.core.wire.WireFactory}s for their references and target services. This service is typically autowired + * to. + * + * @version $$Rev$$ $$Date$$ + */ +public interface WireFactoryService { + + /** + * Creates the source-side wire factory for a reference + * + * @param configuredReference the configured reference to create the wire factory for + * @throws BuilderConfigException + */ + public List createSourceFactory(ConfiguredReference configuredReference) throws BuilderConfigException; + + /** + * Creates a target-side wire factory for a service implementing a given interface + * + * @param configuredService the configured service to create the wire factory for + * @throws BuilderConfigException + */ + public TargetWireFactory createTargetFactory(ConfiguredService configuredService) throws BuilderConfigException; + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/services/org.apache.tuscany.core.runtime.proxy.ServiceProxyFactory b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/services/org.apache.tuscany.core.runtime.proxy.ServiceProxyFactory new file mode 100644 index 0000000000..9b2d05d734 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/META-INF/services/org.apache.tuscany.core.runtime.proxy.ServiceProxyFactory @@ -0,0 +1 @@ +org.apache.tuscany.core.runtime.proxy.impl.ServiceProxyFactoryImpl \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/model/anyobject.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/model/anyobject.xsd new file mode 100644 index 0000000000..47f45d61d7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/model/anyobject.xsd @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/model/tuscany-system.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/model/tuscany-system.xsd new file mode 100644 index 0000000000..9c85db8c37 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/model/tuscany-system.xsd @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties new file mode 100644 index 0000000000..e3b2ff9a4f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties @@ -0,0 +1,23 @@ +# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# $Rev$ $Date$ +# + +org.apache.tuscany.core.client.TuscanyRuntime$Monitor#moduleStarted = Started application module [{0}] +org.apache.tuscany.core.client.TuscanyRuntime$Monitor#moduleStartFailed = Fatal exception starting application module [{0}] +org.apache.tuscany.core.client.TuscanyRuntime$Monitor#moduleStopped = Stopped application module [{0}] + +org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl$Monitor#registeringLoader = Registering StAXElementLoader for {0} +org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl$Monitor#elementLoad = Processing element {0} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/system.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/system.module new file mode 100644 index 0000000000..8d76e19283 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/main/resources/system.module @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/invocation/AsyncInvocationConfigurationTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/invocation/AsyncInvocationConfigurationTestCase.java new file mode 100644 index 0000000000..6f55182c2b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/invocation/AsyncInvocationConfigurationTestCase.java @@ -0,0 +1,197 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.async.invocation; + +import java.lang.reflect.Method; +import java.util.concurrent.CountDownLatch; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.core.async.wire.mock.MockHandler; +import org.apache.tuscany.core.async.wire.mock.MockStaticInvoker; +import org.apache.tuscany.core.async.wire.mock.MockSyncInterceptor; +import org.apache.tuscany.core.async.wire.mock.SimpleTarget; +import org.apache.tuscany.core.async.wire.mock.SimpleTargetImpl; +import org.apache.tuscany.core.async.work.DefaultWorkManager; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.impl.InvokerInterceptor; +import org.apache.tuscany.core.wire.impl.MessageChannelImpl; + +public class AsyncInvocationConfigurationTestCase extends TestCase { + + private DefaultWorkManager workManager; + private Method hello; + + private MessageFactory factory = new MessageFactoryImpl(); + + public AsyncInvocationConfigurationTestCase() { + super(); + } + + public AsyncInvocationConfigurationTestCase(String arg0) { + super(arg0); + } + + protected void setUp() throws Exception { + hello = SimpleTarget.class.getMethod("hello", String.class); + + workManager=new DefaultWorkManager(); + workManager.setScheduledMaximumPoolSize(5); + workManager.init(); + } + + protected void tearDown() throws Exception { + workManager.destroy(); + + super.tearDown(); + } + + /** + * Tests basic wiring of a source to a target, including handlers and interceptors + */ + public void testInvokeWithHandlers() throws Exception { + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + + source.addInterceptor(new AsyncInterceptor(workManager, factory)); + + MockHandler sourceRequestHandler = new MockHandler(); + MockHandler sourceResponseHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addResponseHandler(sourceResponseHandler); + source.addInterceptor(sourceInterceptor); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockHandler targetResponseHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addResponseHandler(targetResponseHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + // connect the source to the target + source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); + source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); + source.build(); + target.build(); + + CountDownLatch startSignal = new CountDownLatch(1); + CountDownLatch doneSignal = new CountDownLatch(1); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl(startSignal, doneSignal)); + source.setTargetInvoker(invoker); + + Message msg = factory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + startSignal.countDown(); + doneSignal.await(); + + Assert.assertEquals(null, response.getBody()); + Assert.assertEquals(1, sourceRequestHandler.getCount()); + //FIXME why isn't the responseHandler invoked? + //Assert.assertEquals(1, sourceResponseHandler.getCount()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetRequestHandler.getCount()); + //FIXME + //Assert.assertEquals(1, targetResponseHandler.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + public void testInvokeWithRequestHandlers() throws Exception { + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + + source.addInterceptor(new AsyncInterceptor(workManager, factory)); + + MockHandler sourceRequestHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addInterceptor(sourceInterceptor); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + // connect the source to the target + source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); + source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); + source.build(); + target.build(); + + CountDownLatch startSignal = new CountDownLatch(1); + CountDownLatch doneSignal = new CountDownLatch(1); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl(startSignal, doneSignal)); + source.setTargetInvoker(invoker); + + Message msg = factory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + startSignal.countDown(); + doneSignal.await(); + + Assert.assertEquals(null, response.getBody()); + Assert.assertEquals(1, sourceRequestHandler.getCount()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetRequestHandler.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + /** + * Tests basic wiring of a source to a target, including handlers and interceptors + */ + public void testInvokeWithInterceptorsOnly() throws Exception { + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + + source.addInterceptor(new AsyncInterceptor(workManager, factory)); + + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addInterceptor(sourceInterceptor); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + // connect the source to the target + source.setTargetInterceptor(target.getHeadInterceptor()); + source.build(); + target.build(); + + CountDownLatch startSignal = new CountDownLatch(1); + CountDownLatch doneSignal = new CountDownLatch(1); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl(startSignal, doneSignal)); + source.setTargetInvoker(invoker); + + Message msg = factory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + startSignal.countDown(); + doneSignal.await(); + + Assert.assertEquals(null, response.getBody()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockHandler.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockHandler.java new file mode 100644 index 0000000000..4f17dc2a76 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockHandler.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.async.wire.mock; + +import org.apache.tuscany.core.wire.MessageHandler; +import org.apache.tuscany.core.message.Message; + +/** + * + */ +public class MockHandler implements MessageHandler { + + private int count =0; + + public boolean processMessage(Message message) { + //System.out.println("Invoking handler"); + count++; + return true; + } + + public int getCount(){ + return count; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockStaticInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockStaticInvoker.java new file mode 100644 index 0000000000..e32de0eec1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockStaticInvoker.java @@ -0,0 +1,86 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.async.wire.mock; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.InvocationRuntimeException; +import org.apache.tuscany.core.wire.TargetInvoker; + +/** + * Caches component instances that do not need to be resolved for every wire, e.g. an wire originating from + * a lesser scope intended for a target with a wider scope + * + * @version $Rev: 377006 $ $Date: 2006-02-11 09:41:59 -0800 (Sat, 11 Feb 2006) $ + */ +public class MockStaticInvoker implements TargetInvoker { + + private Object instance; + + private Method operation; + + public MockStaticInvoker(Method operation, Object instance) { + this.operation = operation; + this.instance = instance; + } + + public boolean isCacheable() { + return true; + } + + public Object invokeTarget(Object payload) throws InvocationTargetException { + try { + if (payload != null && !payload.getClass().isArray()) { + return operation.invoke(instance, payload); + } else { + return operation.invoke(instance, (Object[]) payload); + } + } catch (IllegalAccessException e) { + throw new InvocationRuntimeException(e); + } + } + + public Message invoke(Message msg) { + try { + Object resp = invokeTarget(msg.getBody()); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBody(e.getCause()); + } catch (Throwable e) { + msg.setBody(e); + } + return msg; + } + + public void setNext(Interceptor next) { + throw new IllegalStateException("This interceptor must be the last interceptor in an interceptor chain"); + } + + public Object clone() throws CloneNotSupportedException { + try { + MockStaticInvoker invoker = (MockStaticInvoker) super.clone(); + invoker.instance = this.instance; + invoker.operation = this.operation; + return invoker; + } catch (CloneNotSupportedException e) { + return null; // will not happen + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockSyncInterceptor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockSyncInterceptor.java new file mode 100644 index 0000000000..5b70848d06 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/MockSyncInterceptor.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.async.wire.mock; + +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.message.Message; + +public class MockSyncInterceptor implements Interceptor { + + private int count; + + private Interceptor next; + + public MockSyncInterceptor() { + } + + public Message invoke(Message msg) { + ++count; + //System.out.println("Invoking interceptor"); + return next.invoke(msg); + } + + public int getCount() { + return count; + } + + public void setNext(Interceptor next) { + this.next=next; + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTarget.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTarget.java new file mode 100644 index 0000000000..2147a3a4db --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTarget.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.async.wire.mock; + +public interface SimpleTarget { + + public void hello(String message) throws Exception; + + public void goodbye(String message) throws Exception; + + public void echo(String message) throws Exception; + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTargetImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTargetImpl.java new file mode 100644 index 0000000000..e6f76494f6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/wire/mock/SimpleTargetImpl.java @@ -0,0 +1,54 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.async.wire.mock; + +import java.util.concurrent.CountDownLatch; + +public class SimpleTargetImpl implements SimpleTarget { + + private final CountDownLatch startSignal; + private final CountDownLatch doneSignal; + + public SimpleTargetImpl(CountDownLatch startSignal, CountDownLatch doneSignal) { + this.startSignal = startSignal; + this.doneSignal = doneSignal; + } + + public void hello(String message) throws Exception { + try { + startSignal.await(); + doneSignal.countDown(); + } catch (InterruptedException ex) {} + } + + public void goodbye(String message) throws Exception { + try { + startSignal.await(); + doneSignal.countDown(); + } catch (InterruptedException ex) {} + } + + public void echo(String message) throws Exception { + try { + startSignal.await(); + doneSignal.countDown(); + } catch (InterruptedException ex) {} + } + + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/DefaultWorkManagerTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/DefaultWorkManagerTestCase.java new file mode 100644 index 0000000000..964564f3ee --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/DefaultWorkManagerTestCase.java @@ -0,0 +1,98 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.async.work; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.CountDownLatch; + +import javax.resource.spi.work.Work; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.async.work.DefaultWorkManager; + +/** + * Test the PooledWorkManager. + */ +public class DefaultWorkManagerTestCase extends TestCase { + + private Set done; + private int count; + + public void testScheduleWork() throws Exception { + + DefaultWorkManager workManager = new DefaultWorkManager(); + workManager.setScheduledMaximumPoolSize(3); + workManager.init(); + + int max=workManager.getScheduledMaximumPoolSize()*5; + done=Collections.synchronizedSet(new HashSet()); + count=0; + + CountDownLatch startSignal = new CountDownLatch(1); + CountDownLatch doneSignal = new CountDownLatch(max); + for (int i = 0; i < max; ++i) { + workManager.scheduleWork(new Worker(startSignal, doneSignal)); + } + startSignal.countDown(); + doneSignal.await(); + + assertFalse(done.contains(Thread.currentThread())); + assert(done.size()==workManager.getScheduledMaximumPoolSize()); + assert(count==max); + + done=null; + count=0; + + workManager.destroy(); + + } + + private synchronized void done(Thread thread) { + done.add(thread); + count++; + } + + private class Worker implements Work { + private final CountDownLatch startSignal; + private final CountDownLatch doneSignal; + + Worker(CountDownLatch startSignal, CountDownLatch doneSignal) { + this.startSignal = startSignal; + this.doneSignal = doneSignal; + } + + public void run() { + try { + startSignal.await(); + + DefaultWorkManagerTestCase.this.done(Thread.currentThread()); + //System.out.println(Thread.currentThread()); + + doneSignal.countDown(); + } catch (InterruptedException ex) { + } + } + + public void release() { + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/GeronimoWorkManagerTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/GeronimoWorkManagerTestCase.java new file mode 100644 index 0000000000..18570d54c3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/async/work/GeronimoWorkManagerTestCase.java @@ -0,0 +1,138 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.async.work; + +import javax.resource.spi.work.Work; +import javax.resource.spi.work.WorkEvent; +import javax.resource.spi.work.WorkListener; + +import junit.framework.TestCase; + +import org.apache.geronimo.connector.work.GeronimoWorkManager; +import org.apache.geronimo.transaction.context.TransactionContextManager; + +/** + * Tests the Geronimo work manager + * + * @version $Rev$ $Date$ + */ +public class GeronimoWorkManagerTestCase extends TestCase { + + private GeronimoWorkManager workManager; + + protected void setUp() throws Exception { + TransactionContextManager transactionContextManager = new TransactionContextManager(); + + workManager = new GeronimoWorkManager(2, transactionContextManager); + workManager.doStart(); + } + + public void testScheduleWork() throws Exception { + TestThread threads[] = startTestThreads(5, 10000, 100); + int accepted = 0; + int started = 0; + for (int i = 0; i < threads.length; i++) { + if (null != threads[i].listener.acceptedEvent) { + accepted++; + } else if (null != threads[i].listener.startedEvent) { + started++; + } else { + fail("incorrect state, expecting accepted or started"); + } + } + assertTrue(accepted > 0); + } + + private TestThread[] startTestThreads(int count, int timeout, int delay) throws Exception { + TestThread threads[] = new TestThread[count]; + for (int i = 0; i < count; i++) { + TestWorkListener listener=new TestWorkListener(); + threads[i] = new TestThread(listener, timeout, delay); + } + for (int i = 0; i < count; i++) { + threads[i].start(); + } + for (int i = 0; i < count; i++) { + threads[i].join(); + } + return threads; + } + + private class TestThread extends Thread { + public final TestWorkListener listener; + private final int timeout; + private final int delay; + + public TestThread(TestWorkListener listener, int timeout, int delay) { + this.listener = listener; + this.timeout = timeout; + this.delay = delay; + } + + public void run() { + try { + workManager.scheduleWork(new TestWorker(delay), timeout, null, listener); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + + public class TestWorker implements Work { + private final int delay; + + public TestWorker(int delay) { + this.delay = delay; + } + + public void release() { + } + + public void run() { + try { + Thread.sleep(delay); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + } + + public class TestWorkListener implements WorkListener { + public WorkEvent acceptedEvent; + public WorkEvent rejectedEvent; + public WorkEvent startedEvent; + public WorkEvent completedEvent; + + public void workAccepted(WorkEvent e) { + acceptedEvent = e; + } + + public void workRejected(WorkEvent e) { + rejectedEvent = e; + } + + public void workStarted(WorkEvent e) { + startedEvent = e; + } + + public void workCompleted(WorkEvent e) { + completedEvent = e; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilderTestCase.java new file mode 100644 index 0000000000..e4aaad62d1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilderTestCase.java @@ -0,0 +1,465 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder.impl; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.wire.MethodHashMap; +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.WireFactoryFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.mock.SimpleTarget; +import org.apache.tuscany.core.wire.mock.MockHandler; +import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; +import org.apache.tuscany.core.wire.mock.MockStaticInvoker; +import org.apache.tuscany.core.wire.mock.SimpleTargetImpl; +import org.apache.tuscany.core.wire.impl.InvokerInterceptor; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; + +import java.lang.reflect.Method; +import java.util.Map; + +public class DefaultWireBuilderTestCase extends TestCase { + + private Method hello; + + private WireFactoryFactory wireFactoryFactory = new JDKWireFactoryFactory(); + + public DefaultWireBuilderTestCase() { + super(); + } + + public DefaultWireBuilderTestCase(String arg0) { + super(arg0); + } + + public void setUp() throws Exception { + hello = SimpleTarget.class.getMethod("hello", String.class); + } + + public void testWireWithInterceptorsAndHandlers() throws Exception { + MessageFactory msgFactory = new MessageFactoryImpl(); + + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockHandler sourceRequestHandler = new MockHandler(); + MockHandler sourceResponseHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addResponseHandler(sourceResponseHandler); + source.addInterceptor(sourceInterceptor); + + SourceWireFactory sourceFactory = wireFactoryFactory.createSourceWireFactory(); + Map sourceInvocationConfigs = new MethodHashMap(); + sourceInvocationConfigs.put(hello, source); + WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), + sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + sourceFactory.setConfiguration(sourceConfig); + sourceFactory.setBusinessInterface(SimpleTarget.class); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockHandler targetResponseHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addResponseHandler(targetResponseHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); + Map targetInvocationConfigs = new MethodHashMap(); + targetInvocationConfigs.put(hello, target); + WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), + targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + targetFactory.setConfiguration(targetConfig); + targetFactory.setBusinessInterface(SimpleTarget.class); + + // connect the source to the target + DefaultWireBuilder builder = new DefaultWireBuilder(); + // no need for scopes since we use a static invoker + builder.connect(sourceFactory, targetFactory, null, true, null); + // source.buildSource(); + target.build(); + // set a static invoker + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = msgFactory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, sourceRequestHandler.getCount()); + Assert.assertEquals(1, sourceResponseHandler.getCount()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetRequestHandler.getCount()); + Assert.assertEquals(1, targetResponseHandler.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + public void testWireWithSourceInterceptorTargetHandlersAndTargetInterceptor() throws Exception { + MessageFactory msgFactory = new MessageFactoryImpl(); + + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addInterceptor(sourceInterceptor); + + SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); + Map sourceInvocationConfigs = new MethodHashMap(); + sourceInvocationConfigs.put(hello, source); + WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), + sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + sourceFactory.setConfiguration(sourceConfig); + sourceFactory.setBusinessInterface(SimpleTarget.class); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockHandler targetResponseHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addResponseHandler(targetResponseHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); + Map targetInvocationConfigs = new MethodHashMap(); + targetInvocationConfigs.put(hello, target); + WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), + targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + targetFactory.setConfiguration(targetConfig); + targetFactory.setBusinessInterface(SimpleTarget.class); + + // connect the source to the target + DefaultWireBuilder builder = new DefaultWireBuilder(); + // no need for scopes since we use a static invoker + builder.connect(sourceFactory, targetFactory, null, true, null); + // source.buildSource(); + target.build(); + // set a static invoker + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = msgFactory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetRequestHandler.getCount()); + Assert.assertEquals(1, targetResponseHandler.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + public void testWireWithInterceptorsAndRequestHandlers() throws Exception { + MessageFactory msgFactory = new MessageFactoryImpl(); + + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockHandler sourceRequestHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addInterceptor(sourceInterceptor); + + SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); + Map sourceInvocationConfigs = new MethodHashMap(); + sourceInvocationConfigs.put(hello, source); + WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), + sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + sourceFactory.setConfiguration(sourceConfig); + sourceFactory.setBusinessInterface(SimpleTarget.class); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); + Map targetInvocationConfigs = new MethodHashMap(); + targetInvocationConfigs.put(hello, target); + WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), + targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + targetFactory.setConfiguration(targetConfig); + targetFactory.setBusinessInterface(SimpleTarget.class); + + // connect the source to the target + DefaultWireBuilder builder = new DefaultWireBuilder(); + // no need for scopes since we use a static invoker + builder.connect(sourceFactory, targetFactory, null, true, null); + // source.buildSource(); + target.build(); + // set a static invoker + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = msgFactory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, sourceRequestHandler.getCount()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetRequestHandler.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + public void testWireWithSourceAndTargetInterceptors() throws Exception { + MessageFactory msgFactory = new MessageFactoryImpl(); + + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addInterceptor(sourceInterceptor); + + SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); + Map sourceInvocationConfigs = new MethodHashMap(); + sourceInvocationConfigs.put(hello, source); + WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), + sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + sourceFactory.setConfiguration(sourceConfig); + sourceFactory.setBusinessInterface(SimpleTarget.class); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); + Map targetInvocationConfigs = new MethodHashMap(); + targetInvocationConfigs.put(hello, target); + WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), + targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + targetFactory.setConfiguration(targetConfig); + targetFactory.setBusinessInterface(SimpleTarget.class); + + // connect the source to the target + DefaultWireBuilder builder = new DefaultWireBuilder(); + // no need for scopes since we use a static invoker + builder.connect(sourceFactory, targetFactory, null, true, null); + // source.buildSource(); + target.build(); + // set a static invoker + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = msgFactory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + public void testWireWithSourceInterceptorSourceHandlersAndTargetInterceptor() throws Exception { + MessageFactory msgFactory = new MessageFactoryImpl(); + + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockHandler sourceRequestHandler = new MockHandler(); + MockHandler sourceResponseHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addResponseHandler(sourceResponseHandler); + source.addInterceptor(sourceInterceptor); + + SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); + Map sourceInvocationConfigs = new MethodHashMap(); + sourceInvocationConfigs.put(hello, source); + WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), + sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + sourceFactory.setConfiguration(sourceConfig); + sourceFactory.setBusinessInterface(SimpleTarget.class); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); + Map targetInvocationConfigs = new MethodHashMap(); + targetInvocationConfigs.put(hello, target); + WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), + targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + targetFactory.setConfiguration(targetConfig); + targetFactory.setBusinessInterface(SimpleTarget.class); + + // connect the source to the target + DefaultWireBuilder builder = new DefaultWireBuilder(); + // no need for scopes since we use a static invoker + builder.connect(sourceFactory, targetFactory, null, true, null); + // source.buildSource(); + target.build(); + // set a static invoker + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = msgFactory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, sourceRequestHandler.getCount()); + Assert.assertEquals(1, sourceResponseHandler.getCount()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + public void testWireWithTargetInterceptorAndTargetHandlers() throws Exception { + MessageFactory msgFactory = new MessageFactoryImpl(); + + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + + SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); + Map sourceInvocationConfigs = new MethodHashMap(); + sourceInvocationConfigs.put(hello, source); + WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), + sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + sourceFactory.setConfiguration(sourceConfig); + sourceFactory.setBusinessInterface(SimpleTarget.class); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockHandler targetResponseHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addResponseHandler(targetResponseHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); + Map targetInvocationConfigs = new MethodHashMap(); + targetInvocationConfigs.put(hello, target); + WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), + targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + targetFactory.setConfiguration(targetConfig); + targetFactory.setBusinessInterface(SimpleTarget.class); + + // connect the source to the target + DefaultWireBuilder builder = new DefaultWireBuilder(); + // no need for scopes since we use a static invoker + builder.connect(sourceFactory, targetFactory, null, true, null); + // source.buildSource(); + target.build(); + // set a static invoker + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = msgFactory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, targetRequestHandler.getCount()); + Assert.assertEquals(1, targetResponseHandler.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + public void testWireWithTargetInterceptor() throws Exception { + MessageFactory msgFactory = new MessageFactoryImpl(); + + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + + SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); + Map sourceInvocationConfigs = new MethodHashMap(); + sourceInvocationConfigs.put(hello, source); + WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), + sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + sourceFactory.setConfiguration(sourceConfig); + sourceFactory.setBusinessInterface(SimpleTarget.class); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); + Map targetInvocationConfigs = new MethodHashMap(); + targetInvocationConfigs.put(hello, target); + WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), + targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + targetFactory.setConfiguration(targetConfig); + targetFactory.setBusinessInterface(SimpleTarget.class); + + // connect the source to the target + DefaultWireBuilder builder = new DefaultWireBuilder(); + // no need for scopes since we use a static invoker + builder.connect(sourceFactory, targetFactory, null, true, null); + target.build(); + // set a static invoker + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = msgFactory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + /** + * When there are only {@link InvokerInterceptor}s in the source and target chain, we need to bypass one during + * wire up so they are not chained together + */ + public void testWireWithOnlyInvokerInterceptors() throws Exception { + MessageFactory msgFactory = new MessageFactoryImpl(); + + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + source.setTargetInterceptor(new InvokerInterceptor()); + + SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); + Map sourceInvocationConfigs = new MethodHashMap(); + sourceInvocationConfigs.put(hello, source); + WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), + sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + sourceFactory.setConfiguration(sourceConfig); + sourceFactory.setBusinessInterface(SimpleTarget.class); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + target.addInterceptor(new InvokerInterceptor()); + + TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); + Map targetInvocationConfigs = new MethodHashMap(); + targetInvocationConfigs.put(hello, target); + WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), + targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + targetFactory.setConfiguration(targetConfig); + targetFactory.setBusinessInterface(SimpleTarget.class); + + // connect the source to the target + DefaultWireBuilder builder = new DefaultWireBuilder(); + // no need for scopes since we use a static invoker + builder.connect(sourceFactory, targetFactory, null, true, null); + target.build(); + // set a static invoker + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = msgFactory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/NegativeDefaultWireBuilderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/NegativeDefaultWireBuilderTestCase.java new file mode 100644 index 0000000000..983dc577c4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/builder/impl/NegativeDefaultWireBuilderTestCase.java @@ -0,0 +1,89 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.builder.impl; + +import junit.framework.TestCase; +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.wire.MethodHashMap; +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.WireFactoryFactory; +import org.apache.tuscany.core.wire.jdk.JDKWireFactoryFactory; +import org.apache.tuscany.core.wire.mock.SimpleTarget; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; + +import java.lang.reflect.Method; +import java.util.Map; + +public class NegativeDefaultWireBuilderTestCase extends TestCase { + + private Method hello; + + private WireFactoryFactory wireFactoryFactory = new JDKWireFactoryFactory(); + + public NegativeDefaultWireBuilderTestCase() { + super(); + } + + public NegativeDefaultWireBuilderTestCase(String arg0) { + super(arg0); + } + + public void setUp() throws Exception { + hello = SimpleTarget.class.getMethod("hello", String.class); + } + + public void testNoTargetInterceptorOrHandler() throws Exception { + MessageFactory msgFactory = new MessageFactoryImpl(); + + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + + SourceWireFactory sourceFactory = new JDKWireFactoryFactory().createSourceWireFactory(); + Map sourceInvocationConfigs = new MethodHashMap(); + sourceInvocationConfigs.put(hello, source); + WireSourceConfiguration sourceConfig = new WireSourceConfiguration("foo",new QualifiedName("target/SimpleTarget"), + sourceInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + sourceFactory.setConfiguration(sourceConfig); + sourceFactory.setBusinessInterface(SimpleTarget.class); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + + TargetWireFactory targetFactory = wireFactoryFactory.createTargetWireFactory(); + Map targetInvocationConfigs = new MethodHashMap(); + targetInvocationConfigs.put(hello, target); + WireTargetConfiguration targetConfig = new WireTargetConfiguration(new QualifiedName("target/SimpleTarget"), + targetInvocationConfigs, Thread.currentThread().getContextClassLoader(), msgFactory); + targetFactory.setConfiguration(targetConfig); + targetFactory.setBusinessInterface(SimpleTarget.class); + + // connect the source to the target + DefaultWireBuilder builder = new DefaultWireBuilder(); + try { + builder.connect(sourceFactory, targetFactory, null, true, null); + fail("Expected " + BuilderConfigException.class.getName()); + } catch (BuilderConfigException e) { + // success + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean1.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean1.java new file mode 100644 index 0000000000..c02961e5f4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean1.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + + +public class Bean1 extends SuperBean { + + public static final int ALL_BEAN1_FIELDS = 6 + ALL_SUPER_FIELDS; + public static final int ALL_BEAN1_PUBLIC_PROTECTED_FIELDS = 5 + ALL_SUPER_PUBLIC_PROTECTED_FIELDS; + + public static final int ALL__BEAN1_METHODS = 4 + ALL_SUPER_METHODS - 1; + + private String field1; + protected String field2; + public String field3; + + public void setMethod1(String param) { + } + + public void setMethod1(int param) { + } + + public void override(String param) throws Exception { + } + + + public void noOverride(String param) throws Exception { + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean2.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean2.java new file mode 100644 index 0000000000..eaba545d8e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/Bean2.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +import junit.framework.AssertionFailedError; + +import java.util.List; + +public class Bean2 { + + private List methodList; + + public List getMethodList() { + return methodList; + } + + public void setMethodList(List list) { + methodList = list; + } + + private List fieldList; + + public List getfieldList() { + return fieldList; + } + + public void setfieldList(List list) { + throw new AssertionFailedError("setter inadvertantly called"); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/JavaIntrospectionHelperTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/JavaIntrospectionHelperTestCase.java new file mode 100644 index 0000000000..8a95a6c7b0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/JavaIntrospectionHelperTestCase.java @@ -0,0 +1,163 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.mock.component.Target; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class JavaIntrospectionHelperTestCase extends TestCase { + + public JavaIntrospectionHelperTestCase() { + super(); + } + + public JavaIntrospectionHelperTestCase(String arg0) { + super(arg0); + } + + public void testGetSuperAllFields() throws Exception { + Set superBeanFields = JavaIntrospectionHelper.getAllFields(SuperBean.class); + Assert.assertEquals(SuperBean.ALL_SUPER_FIELDS, superBeanFields.size()); + } + + public void testBean1AllPublicProtectedFields() throws Exception { + Set beanFields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(Bean1.class); + Assert.assertEquals(4, beanFields.size()); //Bean1.ALL_BEAN1_PUBLIC_PROTECTED_FIELDS + } + + public void testBean1AllFields() throws Exception { + Set beanFields = JavaIntrospectionHelper.getAllFields(Bean1.class); + Assert.assertEquals(Bean1.ALL_BEAN1_FIELDS, beanFields.size()); + } + + public void testGetSuperAllMethods() throws Exception { + Set superBeanMethods = JavaIntrospectionHelper.getAllUniqueMethods(SuperBean.class); + Assert.assertEquals(SuperBean.ALL_SUPER_METHODS, superBeanMethods.size()); + } + + public void testGetBean1AllMethods() throws Exception { + Set beanMethods = JavaIntrospectionHelper.getAllUniqueMethods(Bean1.class); + Assert.assertEquals(Bean1.ALL__BEAN1_METHODS, beanMethods.size()); + } + + public void testOverrideMethod() throws Exception { + Set beanFields = JavaIntrospectionHelper.getAllUniqueMethods(Bean1.class); + boolean invoked = false; + for (Method method : beanFields) { + if (method.getName().equals("override")) { + method.invoke(new Bean1(), "foo"); + invoked = true; + } + } + if (!invoked) { + throw new Exception("Override never invoked"); + } + } + + public void testNoOverrideMethod() throws Exception { + Set beanFields = JavaIntrospectionHelper.getAllUniqueMethods(Bean1.class); + boolean found = false; + for (Method method : beanFields) { + if (method.getName().equals("noOverride") && method.getParameterTypes().length == 0) { + found = true; + } + } + if (!found) { + throw new Exception("No override not found"); + } + } + + public void testGetBean1AllFields() throws Exception { + Set bean1 = JavaIntrospectionHelper.getAllFields(Bean1.class); + Assert.assertEquals(Bean1.ALL_BEAN1_FIELDS, bean1.size()); + } + + public void testDefaultConstructor() throws Exception { + Constructor ctr = JavaIntrospectionHelper.getDefaultConstructor(Bean2.class); + Assert.assertEquals(ctr, Bean2.class.getConstructor()); + Assert.assertTrue(Bean2.class == ctr.newInstance((Object[]) null).getClass()); + } + + + public void testFindMultiplicityByFieldName() throws Exception{ + Set fields = JavaIntrospectionHelper.getAllFields(getClass()); + Set methods = JavaIntrospectionHelper.getAllUniqueMethods(getClass()); + + Assert.assertNotNull(JavaIntrospectionHelper.findMultiplicityFieldByName("testList",fields)); + Assert.assertNotNull(JavaIntrospectionHelper.findMultiplicityMethodByName("fooMethod",methods)); + + // this array is not an interface + Assert.assertNull(JavaIntrospectionHelper.findMultiplicityFieldByName("testStringArray",fields)); + Assert.assertNotNull(JavaIntrospectionHelper.findMultiplicityFieldByName("testArray",fields)); + Assert.assertNotNull(JavaIntrospectionHelper.findMultiplicityMethodByName("setTestArray",methods)); + } + + /** + * Tests generics introspection capabilities + */ + public void testGenerics() throws Exception{ + + List classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testList").getGenericType()); + Assert.assertEquals(1,classes.size()); + Assert.assertEquals(String.class,classes.get(0)); + + classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testNoGenericsList").getGenericType()); + Assert.assertEquals(0,classes.size()); + + classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testMap").getGenericType()); + Assert.assertEquals(2,classes.size()); + Assert.assertEquals(String.class,classes.get(0)); + Assert.assertEquals(Bean1.class,classes.get(1)); + + classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredMethod("fooMethod", Map.class).getGenericParameterTypes()[0]); + Assert.assertEquals(2,classes.size()); + Assert.assertEquals(String.class,classes.get(0)); + Assert.assertEquals(Bean1.class,classes.get(1)); + + classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredMethod("fooMethod", List.class).getGenericParameterTypes()[0]); + Assert.assertEquals(1,classes.size()); + Assert.assertEquals(String.class,classes.get(0)); + + } + + private List testNoGenericsList; + + private List testList; + + private Map testMap; + + private void fooMethod(List foo){ + + } + + private void fooMethod(Map foo){ + + } + + private Target[] testArray; + private String[] testStringArray; + + public void setTestArray(Target[] array){} +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/SuperBean.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/SuperBean.java new file mode 100644 index 0000000000..0a4e0cca0c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/SuperBean.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config; + +/** + * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ + */ +public class SuperBean { + + public static final int ALL_SUPER_FIELDS = 6; + public static final int ALL_SUPER_PUBLIC_PROTECTED_FIELDS = 5; + + public static final int ALL_SUPER_METHODS = 4; + + private String superField1; + + public String superField2; + + protected String superField3; + + public void setSuperMethod1(String param) { + } + + public void setSuperMethod1(int param) { + } + + public void override(String param) throws Exception { + throw new Exception("Override not handled"); + } + + public void noOverride() throws Exception { + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java new file mode 100644 index 0000000000..aeb614e9c6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java @@ -0,0 +1,173 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import java.util.List; + +import junit.framework.TestCase; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.JavaIntrospectionHelper; +import org.apache.tuscany.core.config.processor.ProcessorUtils; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceContract; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class CoreAnnotationsProcessingTestCase extends TestCase { + + private ComponentTypeIntrospector introspector; + private AssemblyFactory factory; + + public void testServiceBasicProcessing() throws Exception { + ComponentType type = factory.createComponentType(); + introspector.introspect(TestComponentImpl.class, type); + assertEquals(1, type.getServices().size()); + ServiceContract contract = type.getServices().get(0).getServiceContract(); + assertEquals(TestComponent.class, contract.getInterface()); + assertEquals(Scope.MODULE, contract.getScope()); + } + + public void testServiceNameSet() throws Exception { + ComponentType type = factory.createComponentType(); + introspector.introspect(TestComponentImpl.class, type); + assertEquals(1, type.getServices().size()); + Service service = type.getServices().get(0); + assertEquals(JavaIntrospectionHelper.getBaseName(TestComponent.class), service.getName()); + } + + /** + * Tests the case where a class implements one interface not marked as with Remotable + */ + public void testSingleServiceProcessing() throws Exception { + ComponentType type = factory.createComponentType(); + introspector.introspect(TestLocalComponentImpl.class, type); + assertEquals(1, type.getServices().size()); + ServiceContract contract = type.getServices().get(0).getServiceContract(); + assertEquals(TestLocalComponent.class, contract.getInterface()); + assertEquals(Scope.MODULE, contract.getScope()); + } + + /** + * Tests the case where an implementation specifies a service interface of its parent as opposed to the + * single interface it directly implements + */ + public void testInteraceHierarchyServiceProcessing() throws Exception { + ComponentType type = factory.createComponentType(); + introspector.introspect(SuperFooImpl.class, type); + assertEquals(1, type.getServices().size()); + ServiceContract contract = type.getServices().get(0).getServiceContract(); + assertEquals(SuperSuperFoo.class, contract.getInterface()); + } + + /** + * Tests the case where a class implements two interfaces, with one specified using @Service + * and one marked with @Remotable + */ + public void testMutlipleServiceProcessing() throws Exception { + ComponentType type = factory.createComponentType(); + introspector.introspect(TestMultipleInterfacesComponentImpl.class, type); + assertEquals(2, type.getServices().size()); + for (Service service : type.getServices()) { + if (!service.getServiceContract().equals(TestComponent.class) && + service.getServiceContract().equals(TestLocalComponent.class)) { + fail("Expected multiple interfaces not found"); + } + } + } + + /** + * Test case when an class implements two non-Remotable interfaces and does not specify one with + * @Service + */ + public void testNonServiceProcessing() throws Exception { + ComponentType type = factory.createComponentType(); + introspector.introspect(TestNonServiceInterfacesImpl.class, type); + assertEquals(1, type.getServices().size()); + ServiceContract contract = type.getServices().get(0).getServiceContract(); + assertEquals(TestNonServiceInterfacesImpl.class, contract.getInterface()); + assertEquals(Scope.MODULE, contract.getScope()); + } + + /** + * Tests the case where a class implements two non-Remotable interfaces, with one specified using + * @Service + */ + public void testNonServiceSpecifiedProcessing() throws Exception { + ComponentType type = factory.createComponentType(); + introspector.introspect(TestNonServiceSpecifiedImpl.class, type); + assertEquals(1, type.getServices().size()); + ServiceContract contract = type.getServices().get(0).getServiceContract(); + assertEquals(TestNonServiceInterface.class, contract.getInterface()); + assertEquals(Scope.MODULE, contract.getScope()); + } + + /** + * Tests the case where a component's scope is specified by its superclass + */ + public void testParentScopeEvaluation() throws Exception { + ComponentType type = factory.createComponentType(); + introspector.introspect(ScopeTestComponent.class, type); + assertEquals(1, type.getServices().size()); + ServiceContract contract = type.getServices().get(0).getServiceContract(); + assertEquals(Scope.MODULE, contract.getScope()); + } + + /** + * FIXME JFM - temporarily disabled until non-annotated properties are fixed public void + * testPropertyProcessing() throws Exception { ComponentType type = factory.createComponentType(); + * introspector.introspect(TestComponentImpl.class, type); Listproperties = + * type.getProperties(); assertEquals(3, properties.size()); for (Property property : properties) { if + * (!property.getName().equals("foo") && !property.getName().equals("fooRequired") && + * !property.getName().equals("baz")) { fail("Property names not handled properly"); } if + * (property.getName().equals("fooRequired")) { assertTrue(property.isRequired()); } else { + * assertFalse(property.isRequired()); } } } * + */ + + public void testReferenceProcessing() throws Exception { + ComponentType type = factory.createComponentType(); + introspector.introspect(TestComponentImpl.class, type); + Listreferences = type.getReferences(); + assertEquals(5, references.size()); + for (Reference reference : references) { + if (reference.getName().equals("setBarRequired")) { + assertTrue(reference.getMultiplicity() == Multiplicity.ONE_N); + } else if (reference.getName().equals("setBar")) { + assertTrue(reference.getMultiplicity() == Multiplicity.ZERO_N); + } else if (reference.getName().equals("bazRefeference")) { + assertTrue(reference.getMultiplicity() == Multiplicity.ZERO_ONE); + } else if (reference.getName().equals("wombat")) { + assertTrue(reference.getMultiplicity() == Multiplicity.ONE_ONE); + } else if (reference.getName().equals("bar")) { + assertTrue(reference.getMultiplicity() == Multiplicity.ZERO_ONE); + } else { + fail("Reference names not handled properly"); + } + } + } + + + protected void setUp() throws Exception { + super.setUp(); + factory = new SystemAssemblyFactoryImpl(); + introspector = ProcessorUtils.createCoreIntrospector(factory); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopeTestComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopeTestComponent.java new file mode 100644 index 0000000000..1ae24b6b74 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopeTestComponent.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class ScopeTestComponent extends ScopedParent { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopedParent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopedParent.java new file mode 100644 index 0000000000..0507af1a8a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/ScopedParent.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import org.osoa.sca.annotations.Scope; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Scope("MODULE") +public class ScopedParent { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java new file mode 100644 index 0000000000..e8a5079184 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFoo.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +/** + * @version $$Rev$$ $$Date$$ + */ +public interface SuperFoo { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java new file mode 100644 index 0000000000..1d964cca8d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperFooImpl.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import org.osoa.sca.annotations.Service; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Service(SuperSuperFoo.class) +public class SuperFooImpl extends SuperSuperFooImpl implements SuperFoo{ +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java new file mode 100644 index 0000000000..893c2c5607 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFoo.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +/** + * @version $$Rev$$ $$Date$$ + */ +public interface SuperSuperFoo { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java new file mode 100644 index 0000000000..2025dd1cdd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/SuperSuperFooImpl.java @@ -0,0 +1,20 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class SuperSuperFooImpl implements SuperSuperFoo { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponent.java new file mode 100644 index 0000000000..8a462ff405 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponent.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Scope; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Remotable +@Scope("MODULE") +public interface TestComponent { + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponentImpl.java new file mode 100644 index 0000000000..691bf18b3f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestComponentImpl.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import java.util.List; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Service(interfaces = {TestComponent.class}) +public class TestComponentImpl implements TestComponent { + + @Property + protected String baz; + + @Reference (name="bazRefeference") + protected TestComponent bazRef; + + @Reference (required = true) + protected TestComponent wombat; + + @Property + public void setFoo(String foo){ + + } + + @Property(name = "fooRequired",required = true) + public void setFooRequiredRename(String foo){ + + } + + @Reference + public void bar(String bar){ + + } + + @Reference(name ="setBarRequired", required = true) + public void setBar(List bar){ + + } + + @Reference(name ="setBar", required = false) + public void setBarNonRequired(List bar){ + + } + + public void someSetter(String val){ + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponent.java new file mode 100644 index 0000000000..15b88547f7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponent.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import org.osoa.sca.annotations.Remotable; +import org.osoa.sca.annotations.Scope; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Scope("MODULE") +public interface TestLocalComponent { + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponentImpl.java new file mode 100644 index 0000000000..86aca3b1bf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestLocalComponentImpl.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import java.util.List; + +import org.osoa.sca.annotations.Service; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +/** + * @version $$Rev$$ $$Date$$ + */ + +public class TestLocalComponentImpl implements TestLocalComponent { + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestMultipleInterfacesComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestMultipleInterfacesComponentImpl.java new file mode 100644 index 0000000000..b395fd5442 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestMultipleInterfacesComponentImpl.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import org.osoa.sca.annotations.Service; + +/** + * @version $$Rev$$ $$Date$$ + */ + +@Service(interfaces = {TestLocalComponent.class}) +public class TestMultipleInterfacesComponentImpl implements TestComponent, TestLocalComponent { + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface.java new file mode 100644 index 0000000000..1a595573ae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface.java @@ -0,0 +1,20 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +/** + * @version $$Rev$$ $$Date$$ + */ +public interface TestNonServiceInterface { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface2.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface2.java new file mode 100644 index 0000000000..8aa6e6cb19 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterface2.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +/** + * @version $$Rev$$ $$Date$$ + */ +public interface TestNonServiceInterface2 { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterfacesImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterfacesImpl.java new file mode 100644 index 0000000000..4f6f07b239 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceInterfacesImpl.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import org.osoa.sca.annotations.Scope; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Scope("MODULE") +public class TestNonServiceInterfacesImpl implements TestNonServiceInterface, TestNonServiceInterface2{ +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceSpecifiedImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceSpecifiedImpl.java new file mode 100644 index 0000000000..b8c0d6a7e8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/TestNonServiceSpecifiedImpl.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.config.impl; + +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * @version $$Rev$$ $$Date$$ + */ +@Scope("MODULE") +@Service(TestNonServiceInterface.class) +public class TestNonServiceSpecifiedImpl implements TestNonServiceInterface, TestNonServiceInterface2{ +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractCompositeHierarchyTests.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractCompositeHierarchyTests.java new file mode 100644 index 0000000000..f529595dae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/AbstractCompositeHierarchyTests.java @@ -0,0 +1,109 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.mock.MockConfigContext; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Scope; +import org.osoa.sca.ModuleContext; + +import java.util.List; + +/** + * Performs testing of various hierarchical scenarios + * + * @version $Rev$ $Date$ + */ +public abstract class AbstractCompositeHierarchyTests extends TestCase { + protected List builders; + protected SystemAssemblyFactory factory; + + public void testParentContextIsolation() throws Exception { + CompositeContext parent = createContextHierachy(); + CompositeContext child = (CompositeContext) parent.getContext("test.child"); + Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + parent.registerModelObject(component); + EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); + parent.registerModelObject(ep); + parent.publish(new ModuleStart(this)); + child.publish(new ModuleStart(this)); + Assert.assertNotNull(parent.getContext("TestService1EP").getInstance(null)); + try { + ((ModuleContext) child).locateService("TestService1EP"); + fail("Expexcted " + ServiceNotFoundException.class.getName()); + } catch (ServiceNotFoundException e) { + // expect exception to be thrown + } + parent.publish(new ModuleStop(this)); + child.publish(new ModuleStop(this)); + parent.stop(); + + } + + /** + * Checks that registration of duplicate named model objects before context start throws an exception + */ + public void testRegisterSameName() throws Exception { + CompositeContext parent = new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), + new EventContextImpl(), new MockConfigContext(builders)); + parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child")); + try { + parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child")); + parent.start(); + fail("Expected " + DuplicateNameException.class.getName()); + } catch (DuplicateNameException e) { + // expected + } + } + + /** + * Checks that registration of duplicate named model objects after context start throws an exception + */ + public void testRegisterSameNameAfterStart() throws Exception { + CompositeContext parent = new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), + new EventContextImpl(), new MockConfigContext(builders)); + parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child")); + parent.start(); + CompositeContext child = (CompositeContext) parent.getContext("test.child"); + Assert.assertNotNull(child); + try { + parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child")); + fail("Expected " + DuplicateNameException.class.getName()); + } catch (DuplicateNameException e) { + // expected + } + } + + protected abstract CompositeContext createContextHierachy() throws Exception; + + protected void setUp() throws Exception { + super.setUp(); + factory = new SystemAssemblyFactoryImpl(); + builders = MockFactory.createSystemBuilders(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeContextRegisterTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeContextRegisterTestCase.java new file mode 100644 index 0000000000..b6e7f69daf --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeContextRegisterTestCase.java @@ -0,0 +1,132 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.mock.MockConfigContext; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.mock.component.GenericSystemComponent; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.List; + +/** + * Tests registration of model objects for an composite context + * + * @version $Rev$ $Date$ + */ +public class CompositeContextRegisterTestCase extends TestCase { + private SystemAssemblyFactory factory; + + public void testModuleRegistration() throws Exception { + CompositeContext moduleContext = createContext(); + Module module = MockFactory.createSystemModule(); + moduleContext.registerModelObject(module); + moduleContext.start(); + moduleContext.publish(new ModuleStart(this)); + GenericSystemComponent component = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null); + Assert.assertNotNull(component); + GenericSystemComponent ep = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null); + Assert.assertNotNull(ep); + moduleContext.publish(new ModuleStop(this)); + moduleContext.stop(); + } + + public void testModuleRegistrationAfterStart() throws Exception { + CompositeContext moduleContext = createContext(); + moduleContext.start(); + Module module = MockFactory.createSystemModule(); + moduleContext.registerModelObject(module); + moduleContext.publish(new ModuleStart(this)); + GenericSystemComponent component = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null); + Assert.assertNotNull(component); + GenericSystemComponent ep = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null); + Assert.assertNotNull(ep); + moduleContext.publish(new ModuleStop(this)); + moduleContext.stop(); + } + + public void testRegistration() throws Exception { + CompositeContext moduleContext = createContext(); + Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + moduleContext.registerModelObject(component); + EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); + moduleContext.registerModelObject(ep); + moduleContext.start(); + moduleContext.publish(new ModuleStart(this)); + GenericSystemComponent test = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null); + Assert.assertNotNull(test); + GenericSystemComponent testEP = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null); + Assert.assertNotNull(testEP); + moduleContext.publish(new ModuleStop(this)); + moduleContext.stop(); + } + + public void testRegistrationAfterStart() throws Exception { + CompositeContext moduleContext = createContext(); + Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + moduleContext.start(); + moduleContext.registerModelObject(component); + EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); + moduleContext.registerModelObject(ep); + moduleContext.publish(new ModuleStart(this)); + GenericSystemComponent test = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null); + Assert.assertNotNull(test); + GenericSystemComponent testEP = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null); + Assert.assertNotNull(testEP); + moduleContext.publish(new ModuleStop(this)); + moduleContext.stop(); + } + + public void testEPRegistrationAfterModuleStart() throws Exception { + CompositeContext moduleContext = createContext(); + Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + moduleContext.start(); + moduleContext.registerModelObject(component); + moduleContext.publish(new ModuleStart(this)); + GenericSystemComponent test = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null); + Assert.assertNotNull(test); + EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); + moduleContext.registerModelObject(ep); + GenericSystemComponent testEP = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null); + Assert.assertNotNull(testEP); + moduleContext.publish(new ModuleStop(this)); + moduleContext.stop(); + } + + protected CompositeContext createContext() { + List builders = MockFactory.createSystemBuilders(); + return new CompositeContextImpl("test.context", null, new DefaultScopeStrategy(), new EventContextImpl(), + new MockConfigContext(builders)); + } + + protected void setUp() throws Exception { + factory = new SystemAssemblyFactoryImpl(); + super.setUp(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java new file mode 100644 index 0000000000..bd56a88658 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java @@ -0,0 +1,99 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +import junit.framework.Assert; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.mock.MockConfigContext; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.ServiceUnavailableException; +import org.osoa.sca.ServiceRuntimeException; + +import java.util.List; + +/** + * Performs testing of various hierarchical scenarios + * + * @version $Rev$ $Date$ + */ +public class CompositeHierarchyTestCase extends AbstractCompositeHierarchyTests { + + /** + * FIXME model Tests adding a component, accessing it and then exposing it as an entry point after the first access + * + * @throws Exception + */ + public void testChildContextIsolation() throws Exception { + CompositeContext parent = createContextHierachy(); + CompositeContext child = (CompositeContext) parent.getContext("test.child"); + Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + + component.initialize(new AssemblyContextImpl(factory, null, null)); + child.registerModelObject(component); + parent.publish(new ModuleStart(this)); + child.publish(new ModuleStart(this)); + Assert.assertNotNull(child.getContext("TestService1").getInstance(null)); + try { + ((ModuleContext) parent).locateService("test.child/TestService1"); + fail("Expected " + ServiceUnavailableException.class.getName() + + " since [test.child/TestService1] is not an entry point"); + } catch (ServiceRuntimeException e) { + // should throw an exception since it is not an entry point + } + + // now expose the service as an entry point + // FIXME hack to get around initialization of component - just create another one ;-) + component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", + component); + child.registerModelObject(ep); + Assert.assertNotNull(child.getContext("TestService1EP").getInstance(null)); + Assert.assertNotNull(parent.getContext("test.child").getInstance(new QualifiedName("./TestService1EP"))); + + // now expose the child entry point from the parent context + EntryPoint parentEp = MockFactory.createEntryPointWithStringRef("TestService1EP", ModuleScopeSystemComponent.class, + "TestService1", "test.child/TestService1EP"); + parent.registerModelObject(parentEp); + Assert.assertNotNull(parent.getContext("TestService1EP").getInstance(null)); + + parent.publish(new ModuleStop(this)); + child.publish(new ModuleStop(this)); + parent.stop(); + } + + protected CompositeContext createContextHierachy() throws Exception { + List systemBuilders = MockFactory.createSystemBuilders(); + CompositeContext parent = new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), + new EventContextImpl(), new MockConfigContext(systemBuilders)); + Component component = MockFactory.createCompositeComponent("test.child"); + parent.registerModelObject(component); + parent.start(); + CompositeContext child = (CompositeContext) parent.getContext("test.child"); + Assert.assertNotNull(child); + return parent; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/QualifiedNameTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/QualifiedNameTestCase.java new file mode 100644 index 0000000000..4f86d1aed5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/QualifiedNameTestCase.java @@ -0,0 +1,52 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context; + +import junit.framework.TestCase; + +/** + * Tests parsing of naming patters + * + * @version $Rev$ $Date$ + */ +public class QualifiedNameTestCase extends TestCase { + + public void testSimpleName() throws Exception { + QualifiedName name = new QualifiedName("Foo"); + assertEquals("Foo", name.getPartName()); + assertEquals(null, name.getPortName()); + } + + public void testCompoundName() throws Exception { + QualifiedName name = new QualifiedName("Foo/Bar"); + assertEquals("Foo", name.getPartName()); + assertEquals("Bar", name.getPortName()); + } + + public void testCompoundMultiName() throws Exception { + QualifiedName name = new QualifiedName("Foo/Bar/Baz"); + assertEquals("Foo", name.getPartName()); + assertEquals("Bar/Baz", name.getPortName()); + } + + public void testInvalidName() throws Exception { + try { + QualifiedName name = new QualifiedName("/Foo/Bar"); + fail("Invalid name exception not thrown"); + } catch (InvalidNameException e) { + + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategyTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategyTestCase.java new file mode 100644 index 0000000000..c9e6736833 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/context/scope/DefaultScopeStrategyTestCase.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.context.scope; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Basic scope strategy tests, including downscope referencing + * + * @version $Rev$ $Date$ + */ +public class DefaultScopeStrategyTestCase extends TestCase { + + public void testDownScopeReferences() throws Exception{ + DefaultScopeStrategy strategy = new DefaultScopeStrategy(); + + Assert.assertTrue(!strategy.downScopeReference(Scope.MODULE,Scope.MODULE)); + Assert.assertTrue(strategy.downScopeReference(Scope.MODULE,Scope.SESSION)); + Assert.assertTrue(strategy.downScopeReference(Scope.MODULE,Scope.REQUEST)); + Assert.assertTrue(strategy.downScopeReference(Scope.MODULE,Scope.INSTANCE)); + + Assert.assertTrue(!strategy.downScopeReference(Scope.SESSION,Scope.MODULE)); + Assert.assertTrue(!strategy.downScopeReference(Scope.SESSION,Scope.SESSION)); + Assert.assertTrue(strategy.downScopeReference(Scope.SESSION,Scope.REQUEST)); + Assert.assertTrue(strategy.downScopeReference(Scope.SESSION,Scope.INSTANCE)); + + Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.MODULE)); + Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.SESSION)); + Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.REQUEST)); + Assert.assertTrue(strategy.downScopeReference(Scope.REQUEST,Scope.INSTANCE)); + + Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.MODULE)); + Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.SESSION)); + Assert.assertTrue(!strategy.downScopeReference(Scope.REQUEST,Scope.REQUEST)); + Assert.assertTrue(!strategy.downScopeReference(Scope.INSTANCE,Scope.INSTANCE)); + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java new file mode 100644 index 0000000000..765d6efee4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ContextFactorySupportTestCase.java @@ -0,0 +1,80 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import junit.framework.TestCase; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.model.assembly.Implementation; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.impl.AtomicImplementationImpl; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class ContextFactorySupportTestCase extends TestCase { + + public void testGenericReflection() throws Exception { + TestFactoryBuilder b = new TestFactoryBuilder(); + assertEquals(TestImplementation.class, b.getImplementationClass()); + } + + public void testNegativeGenericReflection() throws Exception { + try { + new NonGenericFactoryBuilder(); + fail("AssertionError expected on non-genericized subclass of " + ContextFactoryBuilderSupport.class.getName()); + } catch (AssertionError e) { + // indicates success + } + } + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + + private class TestFactoryBuilder extends ContextFactoryBuilderSupport { + + + public Class getImplementationClass() { + return implementationClass; + } + + protected ContextFactory createContextFactory(String componentName, TestImplementation implementation, Scope scope) { + return null; + } + } + + private class NonGenericFactoryBuilder extends ContextFactoryBuilderSupport { + + + public Class getImplementationClass() { + return implementationClass; + } + + protected ContextFactory createContextFactory(String componentName, Implementation implementation, Scope scope) { + return null; + } + } + + private class TestImplementation extends AtomicImplementationImpl { + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java new file mode 100644 index 0000000000..2f911fefa5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/EntryPointBuilderSupportTestCase.java @@ -0,0 +1,78 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import junit.framework.TestCase; +import org.apache.tuscany.core.extension.EntryPointContextFactory; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.EntryPoint; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class EntryPointBuilderSupportTestCase extends TestCase { + + public void testGenericReflection() throws Exception { + EntryPointBuilderSupportTestCase.TestEntryPointBuilder b = new EntryPointBuilderSupportTestCase.TestEntryPointBuilder(); + assertEquals(EntryPointBuilderSupportTestCase.TestBinding.class, b.getImplementationClass()); + } + + public void testNegativeGenericReflection() throws Exception { + try { + new EntryPointBuilderSupportTestCase.NonGenericFactoryBuilder(); + fail("AssertionError expected on non-genericized subclass of " + ContextFactoryBuilderSupport.class.getName()); + } catch (AssertionError e) { + // indicates success + } + } + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + + private class TestEntryPointBuilder extends EntryPointBuilderSupport { + + public Class getImplementationClass() { + return bindingClass; + } + + protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) { + return null; + } + } + + private class NonGenericFactoryBuilder extends EntryPointBuilderSupport { + + public Class getImplementationClass() { + return bindingClass; + } + + protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) { + return null; + } + } + + private interface TestBinding extends Binding { + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java new file mode 100644 index 0000000000..a1c758c526 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupportTestCase.java @@ -0,0 +1,80 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import junit.framework.TestCase; +import org.apache.tuscany.core.extension.ExternalServiceContextFactory; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.ExternalService; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class ExternalServiceBuilderSupportTestCase extends TestCase { + + public void testGenericReflection() throws Exception { + ExternalServiceBuilderSupportTestCase.TestExternalServiceBuilder b = new ExternalServiceBuilderSupportTestCase.TestExternalServiceBuilder(); + assertEquals(ExternalServiceBuilderSupportTestCase.TestBinding.class, b.getImplementationClass()); + } + + public void testNegativeGenericReflection() throws Exception { + try { + new ExternalServiceBuilderSupportTestCase.NonGenericFactoryBuilder(); + fail("AssertionError expected on non-genericized subclass of " + ContextFactoryBuilderSupport.class.getName()); + } catch (AssertionError e) { + // indicates success + } + } + + protected void setUp() throws Exception { + super.setUp(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + + private class TestExternalServiceBuilder extends ExternalServiceBuilderSupport { + + + public Class getImplementationClass() { + return bindingClass; + } + + protected ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService) { + return null; + } + } + + private class NonGenericFactoryBuilder extends ExternalServiceBuilderSupport { + + + public Class getImplementationClass() { + return bindingClass; + } + + + protected ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService) { + return null; + } + } + + private interface TestBinding extends Binding { + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java new file mode 100644 index 0000000000..0fd80c51af --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/extension/WireBuilderSupportTestCase.java @@ -0,0 +1,261 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.extension; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import junit.framework.TestCase; +import org.apache.tuscany.core.builder.ContextCreationException; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.core.wire.jdk.JDKTargetWireFactory; +import org.apache.tuscany.core.wire.mock.MockScopeContext; +import org.apache.tuscany.model.assembly.Implementation; +import org.apache.tuscany.model.assembly.Scope; + +/** + * @version $$Rev$$ $$Date$$ + */ +public class WireBuilderSupportTestCase extends TestCase { + private Method m; + + /** + * Tests that {@link WireBuilderSupport} only processes connect operations and sets target invokers for + * the correct target type. + *

+ * Verifies TUSCANY-218 + * + * @throws Exception + */ + public void testTargetInvokerSet() throws Exception { + FooWireBuilder fooBuilder = new FooWireBuilder(); + BarWireBuilder barBuilder = new BarWireBuilder(); + DefaultWireBuilder defaultBuilder = new DefaultWireBuilder(); + defaultBuilder.addWireBuilder(fooBuilder); + defaultBuilder.addWireBuilder(barBuilder); + TargetWireFactory targetFooFactory = new JDKTargetWireFactory(); + Map fooConfigs = new HashMap(); + TargetInvocationConfiguration fooInvocation = new TargetInvocationConfiguration(m); + fooConfigs.put(m, fooInvocation); + Map barConfigs = new HashMap(); + TargetInvocationConfiguration barInvocation = new TargetInvocationConfiguration(m); + barConfigs.put(m, barInvocation); + targetFooFactory.setConfiguration(new WireTargetConfiguration(null, fooConfigs, null, null)); + TargetWireFactory targetBarFactory = new JDKTargetWireFactory(); + targetBarFactory.setConfiguration(new WireTargetConfiguration(null, barConfigs, null, null)); + ScopeContext ctx = new MockScopeContext(); + defaultBuilder.completeTargetChain(targetFooFactory, FooContextFactory.class, ctx); + defaultBuilder.completeTargetChain(targetBarFactory, BarContextFactory.class, ctx); + assertEquals(FooInvoker.class, targetFooFactory.getConfiguration().getInvocationConfigurations().get(m).getTargetInvoker().getClass()); + assertEquals(BarInvoker.class, targetBarFactory.getConfiguration().getInvocationConfigurations().get(m).getTargetInvoker().getClass()); + + } + + + protected void setUp() throws Exception { + super.setUp(); + m = SomeInterface.class.getMethod("test", (Class[]) null); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + private interface SomeInterface { + void test(); + } + + private interface Foo extends Implementation { + + } + + private interface Bar extends Implementation { + + } + + private class FooWireBuilder extends WireBuilderSupport { + + protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) { + return new FooInvoker(); + } + } + + private class BarWireBuilder extends WireBuilderSupport { + + protected TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope) { + return new BarInvoker(); + } + } + + private class FooInvoker implements TargetInvoker { + + public Object invokeTarget(Object payload) throws InvocationTargetException { + return null; + } + + public boolean isCacheable() { + return false; + } + + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public Message invoke(Message msg) { + return null; + } + + public void setNext(Interceptor next) { + + } + } + + + private class BarInvoker implements TargetInvoker { + + public Object invokeTarget(Object payload) throws InvocationTargetException { + return null; + } + + public boolean isCacheable() { + return false; + } + + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public Message invoke(Message msg) { + return null; + } + + public void setNext(Interceptor next) { + + } + } + + private class FooContextFactory implements ContextFactory { + + public AtomicContext createContext() throws ContextCreationException { + return null; + } + + public Scope getScope() { + return null; + } + + public String getName() { + return null; + } + + public void addProperty(String propertyName, Object value) { + + } + + public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { + + } + + public TargetWireFactory getTargetWireFactory(String serviceName) { + return null; + } + + public Map getTargetWireFactories() { + return null; + } + + public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { + + } + + public List getSourceWireFactories() { + return null; + } + + public void prepare(CompositeContext parent) { + + } + + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) { + + } + } + + + private class BarContextFactory implements ContextFactory { + public Context createContext() throws ContextCreationException { + return null; + } + + public Scope getScope() { + return null; + } + + public String getName() { + return null; + } + + public void addProperty(String propertyName, Object value) { + + } + + public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { + + } + + public TargetWireFactory getTargetWireFactory(String serviceName) { + return null; + } + + public Map getTargetWireFactories() { + return null; + } + + public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { + + } + + public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) { + + } + + public List getSourceWireFactories() { + return null; + } + + public void prepare(CompositeContext parent) { + + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/integration/IntraCompositeWireIntegrationTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/integration/IntraCompositeWireIntegrationTestCase.java new file mode 100644 index 0000000000..44be759b69 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/integration/IntraCompositeWireIntegrationTestCase.java @@ -0,0 +1,107 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.integration; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.mock.component.Source; +import org.apache.tuscany.core.mock.component.Target; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.SystemModule; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +/** + * Tests intra-composite system wires are properly constructed in the runtime + * + * @version $Rev$ $Date$ + */ +public class IntraCompositeWireIntegrationTestCase extends TestCase { + + + public void testWireConstruction2() throws Exception { + RuntimeContext runtime = MockFactory.createCoreRuntime(); + ModuleComponent moduleComponent = createSystemCompositeComponent("test.system"); + Module module = MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.MODULE); + moduleComponent.setImplementation(module); + runtime.getSystemContext().registerModelObject(moduleComponent); + CompositeContext context = (CompositeContext) runtime.getSystemContext().getContext("test.system"); + context.publish(new ModuleStart(this)); + //context.registerModelObject(module); + Source source = (Source) ((AtomicContext)context.getContext("source")).getTargetInstance(); + Assert.assertNotNull(source); + Target targetRef = source.getTarget(); + Assert.assertNotNull(targetRef); + Target target = (Target) ((AtomicContext)context.getContext("target")).getTargetInstance(); + Assert.assertSame(target, targetRef); + Source source2 = (Source) ((AtomicContext)context.getContext("source")).getTargetInstance(); + Assert.assertSame(target, source2.getTarget()); + context.publish(new ModuleStop(this)); + context.stop(); + } + + private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); + + /** + * Creates an composite component with the given name + */ + public static ModuleComponent createSystemCompositeComponent(String name) { + ModuleComponent sc = systemFactory.createModuleComponent(); + SystemModule impl = systemFactory.createSystemModule(); + impl.setImplementationClass(SystemCompositeContextImpl.class); + sc.setImplementation(impl); + Service s = systemFactory.createService(); + JavaServiceContract ji = systemFactory.createJavaServiceContract(); + s.setServiceContract(ji); + ji.setScope(Scope.AGGREGATE); + impl.setComponentType(systemFactory.createComponentType()); + impl.getComponentType().getServices().add(s); + sc.setName(name); + sc.setImplementation(impl); + return sc; + } + + + public void testWireConstruction() throws ConfigurationException { + RuntimeContext runtime = MockFactory.createCoreRuntime(); + runtime.getSystemContext().registerModelObject(MockFactory.createSystemCompositeComponent("test.system")); + CompositeContext context = (CompositeContext) runtime.getSystemContext().getContext("test.system"); + + context.publish(new ModuleStart(this)); + context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE,Scope.MODULE)); + Source source = (Source) ((AtomicContext)context.getContext("source")).getTargetInstance(); + Assert.assertNotNull(source); + Target targetRef = source.getTarget(); + Assert.assertNotNull(targetRef); + Target target = (Target) ((AtomicContext)context.getContext("target")).getTargetInstance(); + Assert.assertSame(target, targetRef); + Source source2 = (Source) ((AtomicContext)context.getContext("source")).getTargetInstance(); + Assert.assertSame(target, source2.getTarget()); + context.publish(new ModuleStop(this)); + context.stop(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java new file mode 100644 index 0000000000..c17d96a145 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/JNDIPropertyFactoryTestCase.java @@ -0,0 +1,210 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import static javax.naming.Context.INITIAL_CONTEXT_FACTORY; +import java.io.StringReader; +import java.util.Hashtable; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NamingEnumeration; +import javax.naming.Binding; +import javax.naming.NameParser; +import javax.naming.spi.InitialContextFactory; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.impl.JNDIPropertyFactory; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.Property; +import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; + +/** + * @version $Rev$ $Date$ + */ +@SuppressWarnings({"AccessOfSystemProperties"}) +public class JNDIPropertyFactoryTestCase extends TestCase { + private JNDIPropertyFactory factory; + private XMLInputFactory xmlFactory; + private Property property; + private String oldICF; + + public void testLookup() throws XMLStreamException, ConfigurationLoadException { + String instance = getInstance(String.class, "foo:/hello"); + assertEquals("Hello World", instance); + } + + private T getInstance(Class type, String xml) throws XMLStreamException, ConfigurationLoadException { + property.setType(type); + XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml)); + reader.next(); + ObjectFactory objectFactory = (ObjectFactory) factory.createObjectFactory(reader, property); + return objectFactory.getInstance(); + } + + protected void setUp() throws Exception { + super.setUp(); + factory = new JNDIPropertyFactory(); + xmlFactory = XMLInputFactory.newInstance(); + AssemblyFactory assemblyFactory = new AssemblyFactoryImpl(); + property = assemblyFactory.createProperty(); + + oldICF = System.getProperty(INITIAL_CONTEXT_FACTORY); + System.setProperty(INITIAL_CONTEXT_FACTORY, MockContextFactory.class.getName()); + } + + protected void tearDown() throws Exception { + if (oldICF != null) { + System.getProperty(INITIAL_CONTEXT_FACTORY, oldICF); + } + super.tearDown(); + } + + public static class MockContextFactory implements InitialContextFactory { + public Context getInitialContext(Hashtable environment) throws NamingException { + return new MockContext(); + } + } + + public static class MockContext implements Context { + public Object lookup(String name) throws NamingException { + if ("foo:/hello".equals(name)) { + return "Hello World"; + } + throw new AssertionError(); + } + + public Object lookup(Name name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public void bind(Name name, Object obj) throws NamingException { + throw new UnsupportedOperationException(); + } + + public void bind(String name, Object obj) throws NamingException { + throw new UnsupportedOperationException(); + } + + public void rebind(Name name, Object obj) throws NamingException { + throw new UnsupportedOperationException(); + } + + public void rebind(String name, Object obj) throws NamingException { + throw new UnsupportedOperationException(); + } + + public void unbind(Name name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public void unbind(String name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public void rename(Name oldName, Name newName) throws NamingException { + throw new UnsupportedOperationException(); + } + + public void rename(String oldName, String newName) throws NamingException { + throw new UnsupportedOperationException(); + } + + public NamingEnumeration list(Name name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public NamingEnumeration list(String name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public NamingEnumeration listBindings(Name name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public NamingEnumeration listBindings(String name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public void destroySubcontext(Name name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public void destroySubcontext(String name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public Context createSubcontext(Name name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public Context createSubcontext(String name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public Object lookupLink(Name name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public Object lookupLink(String name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public NameParser getNameParser(Name name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public NameParser getNameParser(String name) throws NamingException { + throw new UnsupportedOperationException(); + } + + public Name composeName(Name name, Name prefix) throws NamingException { + throw new UnsupportedOperationException(); + } + + public String composeName(String name, String prefix) throws NamingException { + throw new UnsupportedOperationException(); + } + + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + throw new UnsupportedOperationException(); + } + + public Object removeFromEnvironment(String propName) throws NamingException { + throw new UnsupportedOperationException(); + } + + public Hashtable getEnvironment() throws NamingException { + throw new UnsupportedOperationException(); + } + + public void close() throws NamingException { + throw new UnsupportedOperationException(); + } + + public String getNameInNamespace() throws NamingException { + throw new UnsupportedOperationException(); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/MockReaderSupport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/MockReaderSupport.java new file mode 100644 index 0000000000..542a4d7b2b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/MockReaderSupport.java @@ -0,0 +1,210 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.Location; +import javax.xml.namespace.QName; +import javax.xml.namespace.NamespaceContext; + +/** + * Base class for a mock XMLStreamReader. + * + * @version $Rev$ $Date$ + */ +public class MockReaderSupport implements XMLStreamReader { + public QName getName() { + throw new UnsupportedOperationException(); + } + + public Object getProperty(String name) throws IllegalArgumentException { + throw new UnsupportedOperationException(); + } + + public int next() throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public void require(int i, String name, String name1) throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public String getElementText() throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public int nextTag() throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public boolean hasNext() throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public void close() throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public String getNamespaceURI(String name) { + throw new UnsupportedOperationException(); + } + + public boolean isStartElement() { + throw new UnsupportedOperationException(); + } + + public boolean isEndElement() { + throw new UnsupportedOperationException(); + } + + public boolean isCharacters() { + throw new UnsupportedOperationException(); + } + + public boolean isWhiteSpace() { + throw new UnsupportedOperationException(); + } + + public String getAttributeValue(String name, String name1) { + throw new UnsupportedOperationException(); + } + + public int getAttributeCount() { + throw new UnsupportedOperationException(); + } + + public QName getAttributeName(int i) { + throw new UnsupportedOperationException(); + } + + public String getAttributeNamespace(int i) { + throw new UnsupportedOperationException(); + } + + public String getAttributeLocalName(int i) { + throw new UnsupportedOperationException(); + } + + public String getAttributePrefix(int i) { + throw new UnsupportedOperationException(); + } + + public String getAttributeType(int i) { + throw new UnsupportedOperationException(); + } + + public String getAttributeValue(int i) { + throw new UnsupportedOperationException(); + } + + public boolean isAttributeSpecified(int i) { + throw new UnsupportedOperationException(); + } + + public int getNamespaceCount() { + throw new UnsupportedOperationException(); + } + + public String getNamespacePrefix(int i) { + throw new UnsupportedOperationException(); + } + + public String getNamespaceURI(int i) { + throw new UnsupportedOperationException(); + } + + public NamespaceContext getNamespaceContext() { + throw new UnsupportedOperationException(); + } + + public int getEventType() { + throw new UnsupportedOperationException(); + } + + public String getText() { + throw new UnsupportedOperationException(); + } + + public char[] getTextCharacters() { + throw new UnsupportedOperationException(); + } + + public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public int getTextStart() { + throw new UnsupportedOperationException(); + } + + public int getTextLength() { + throw new UnsupportedOperationException(); + } + + public String getEncoding() { + throw new UnsupportedOperationException(); + } + + public boolean hasText() { + throw new UnsupportedOperationException(); + } + + public Location getLocation() { + throw new UnsupportedOperationException(); + } + + public String getLocalName() { + throw new UnsupportedOperationException(); + } + + public boolean hasName() { + throw new UnsupportedOperationException(); + } + + public String getNamespaceURI() { + throw new UnsupportedOperationException(); + } + + public String getPrefix() { + throw new UnsupportedOperationException(); + } + + public String getVersion() { + throw new UnsupportedOperationException(); + } + + public boolean isStandalone() { + throw new UnsupportedOperationException(); + } + + public boolean standaloneSet() { + throw new UnsupportedOperationException(); + } + + public String getCharacterEncodingScheme() { + throw new UnsupportedOperationException(); + } + + public String getPITarget() { + throw new UnsupportedOperationException(); + } + + public String getPIData() { + throw new UnsupportedOperationException(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryTestCase.java new file mode 100644 index 0000000000..177e4e5005 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StAXLoaderRegistryTestCase.java @@ -0,0 +1,145 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import java.util.List; +import java.util.ArrayList; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamException; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyInitializationException; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; + +/** + * @version $Rev$ $Date$ + */ +public class StAXLoaderRegistryTestCase extends TestCase { + private StAXLoaderRegistryImpl registry; + private MockElementLoader loader; + private MockObject mockObject; + private MockReader reader; + private MockMonitor monitor; + private QName qname; + private ResourceLoaderImpl rl; + private LoaderContext loaderContext; + + public void testRegistrationEvents() throws XMLStreamException, ConfigurationLoadException { + reader.name = qname; + registry.registerLoader(qname, loader); + assertTrue(monitor.registered.contains(qname)); + assertEquals(1, monitor.registered.size()); + assertTrue(monitor.unregistered.isEmpty()); + assertTrue(monitor.loading.isEmpty()); + + registry.unregisterLoader(qname, loader); + assertTrue(monitor.registered.contains(qname)); + assertEquals(1, monitor.registered.size()); + assertTrue(monitor.unregistered.contains(qname)); + assertEquals(1, monitor.unregistered.size()); + assertTrue(monitor.loading.isEmpty()); + } + + public void testSuccessfulLoad() throws XMLStreamException, ConfigurationLoadException { + reader.name = qname; + registry.registerLoader(qname, loader); + assertSame(mockObject, registry.load(reader, loaderContext)); + assertEquals(1, monitor.loading.size()); + assertTrue(monitor.loading.contains(qname)); + } + + public void testFailedLoad() throws XMLStreamException, ConfigurationLoadException { + registry.registerLoader(qname, loader); + reader.name = new QName("foo"); + try { + registry.load(reader, loaderContext); + fail(); + } catch (ConfigurationLoadException e) { + assertEquals(1, monitor.loading.size()); + assertTrue(monitor.loading.contains(reader.name)); + } + } + + protected void setUp() throws Exception { + super.setUp(); + qname = new QName("test"); + monitor = new MockMonitor(); + registry = new StAXLoaderRegistryImpl(); + registry.setMonitor(monitor); + mockObject = new MockObject(); + loader = new MockElementLoader(); + reader = new MockReader(); + rl = new ResourceLoaderImpl(getClass().getClassLoader()); + loaderContext = new LoaderContext(rl); + } + + public static class MockMonitor implements StAXLoaderRegistryImpl.Monitor { + private List registered = new ArrayList(); + private List unregistered = new ArrayList(); + private List loading = new ArrayList(); + + public void registeringLoader(QName xmlType) { + registered.add(xmlType); + } + + public void unregisteringLoader(QName xmlType) { + unregistered.add(xmlType); + } + + public void elementLoad(QName xmlType) { + loading.add(xmlType); + } + } + + @SuppressWarnings({"NonStaticInnerClassInSecureContext"}) + public class MockElementLoader implements StAXElementLoader { + public AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assertEquals(qname, reader.getName()); + assertSame(rl, loaderContext.getResourceLoader()); + return mockObject; + } + } + + public static class MockObject implements AssemblyObject { + public void initialize(AssemblyContext modelContext) throws AssemblyInitializationException { + throw new UnsupportedOperationException(); + } + + public void freeze() { + throw new UnsupportedOperationException(); + } + + public boolean accept(AssemblyVisitor visitor) { + throw new UnsupportedOperationException(); + } + } + + private static class MockReader extends MockReaderSupport { + private QName name; + + public QName getName() { + return name; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java new file mode 100644 index 0000000000..0efe1ae82a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/StringParserPropertyFactoryTestCase.java @@ -0,0 +1,111 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader; + +import junit.framework.TestCase; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.loader.impl.StringParserPropertyFactory; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.Property; +import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import java.beans.PropertyEditorManager; +import java.beans.PropertyEditorSupport; +import java.io.StringReader; +import java.net.URI; +import java.util.Arrays; + +/** + * @version $Rev$ $Date$ + */ +public class StringParserPropertyFactoryTestCase extends TestCase { + private StringParserPropertyFactory factory; + private XMLInputFactory xmlFactory; + private Property property; + + public void testSimpleString() throws XMLStreamException, ConfigurationLoadException { + String instance = getInstance(String.class, "Hello World"); + assertEquals("Hello World", instance); + } + + public void testByteArray() throws XMLStreamException, ConfigurationLoadException { + byte[] instance = getInstance(byte[].class, "01020304"); + assertTrue(Arrays.equals(new byte[]{1, 2, 3, 4}, instance)); + } + + public void testInteger() throws XMLStreamException, ConfigurationLoadException { + Integer instance = getInstance(Integer.class, "1234"); + assertEquals(Integer.valueOf(1234), instance); + } + + public void testInt() throws XMLStreamException, ConfigurationLoadException { + int instance = getInstance(Integer.TYPE, "1234"); + assertEquals(1234, instance); + } + + public void testBoolean() throws XMLStreamException, ConfigurationLoadException { + Boolean instance = getInstance(Boolean.class, "true"); + assertSame(Boolean.TRUE, instance); + } + + public void testConstructor() throws XMLStreamException, ConfigurationLoadException { + // java.net.URI has a ctr that takes a String + URI instance = getInstance(URI.class, "http://www.apache.org"); + assertEquals(URI.create("http://www.apache.org"), instance); + } + + public void testPropertyEditor() throws XMLStreamException, ConfigurationLoadException { + // register a property editor for java.lang.Class + PropertyEditorManager.registerEditor(Class.class, ClassEditor.class); + try { + Class instance = getInstance(Class.class, "java.lang.Integer"); + assertEquals(Integer.class, instance); + } finally{ + PropertyEditorManager.registerEditor(Class.class, null); + } + } + + private T getInstance(Class type, String xml) throws XMLStreamException, ConfigurationLoadException { + property.setType(type); + XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml)); + reader.next(); + ObjectFactory objectFactory = (ObjectFactory) factory.createObjectFactory(reader, property); + return objectFactory.getInstance(); + } + + protected void setUp() throws Exception { + super.setUp(); + factory = new StringParserPropertyFactory(); + xmlFactory = XMLInputFactory.newInstance(); + AssemblyFactory assemblyFactory = new AssemblyFactoryImpl(); + property = assemblyFactory.createProperty(); + } + + public static class ClassEditor extends PropertyEditorSupport { + public void setAsText(String text) throws IllegalArgumentException { + try { + setValue(Class.forName(text)); + } catch (ClassNotFoundException e) { + throw new IllegalArgumentException(text); + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java new file mode 100644 index 0000000000..37056b3283 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java @@ -0,0 +1,151 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import java.util.List; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.extension.config.ImplementationProcessor; +import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector; +import org.apache.tuscany.core.config.processor.ProcessorUtils; +import org.apache.tuscany.core.injection.SingletonObjectFactory; +import org.apache.tuscany.core.loader.StAXPropertyFactory; +import org.apache.tuscany.core.loader.impl.StringParserPropertyFactory; +import org.apache.tuscany.core.system.assembly.SystemImplementation; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ConfiguredProperty; +import org.apache.tuscany.model.assembly.Property; +import org.apache.tuscany.model.assembly.AtomicComponent; + +/** + * @version $Rev$ $Date$ + */ +public class ComponentLoaderTestCase extends LoaderTestSupport { + private ComponentLoader loader; + private ComponentTypeIntrospector introspector; + + public void testStringProperty() throws XMLStreamException, ConfigurationLoadException { + String xml = "HelloWorld"; + Component component = createFooComponent(); + loadProperties(xml, component); + ConfiguredProperty prop = component.getConfiguredProperty("propString"); + assertEquals("HelloWorld", prop.getValue()); + } + + public void testIntProperty() throws XMLStreamException, ConfigurationLoadException { + String xml = "1234"; + Component component = createFooComponent(); + loadProperties(xml, component); + ConfiguredProperty prop = component.getConfiguredProperty("propInt"); + assertEquals(1234, prop.getValue()); + } + + public void testIntegerProperty() throws XMLStreamException, ConfigurationLoadException { + String xml = "1234"; + Component component = createFooComponent(); + loadProperties(xml, component); + ConfiguredProperty prop = component.getConfiguredProperty("propInteger"); + assertEquals(Integer.valueOf(1234), prop.getValue()); + } + + public void testCustomProperty() throws XMLStreamException, ConfigurationLoadException { + String xml = "Hello"; + Component component = createFooComponent(); + loadProperties(xml, component); + ConfiguredProperty prop = component.getConfiguredProperty("propFoo"); + Foo instance = (Foo) prop.getValue(); + assertEquals("Hello", instance.name); + } + + private void loadProperties(String xml, Component component) throws XMLStreamException, ConfigurationLoadException { + XMLStreamReader reader = getReader(xml); + loader.loadProperties(reader, resourceLoader, component); + component.initialize(modelContext); + } + + private Component createFooComponent() { + SystemImplementation impl = assemblyFactory.createSystemImplementation(); + impl.setImplementationClass(ServiceImpl.class); + try { + impl.setComponentType(introspector.introspect(ServiceImpl.class)); + } catch (ConfigurationException e) { + throw new AssertionError(); + } + impl.initialize(null); + AtomicComponent component = assemblyFactory.createSimpleComponent(); + component.setImplementation(impl); + return component; + } + + protected void setUp() throws Exception { + super.setUp(); + loader = new ComponentLoader(); + loader.setFactory(assemblyFactory); + loader.setDefaultPropertyFactory(new StringParserPropertyFactory()); + introspector = ProcessorUtils.createCoreIntrospector(assemblyFactory); + } + + public static interface Service { + } + + public static class ServiceImpl implements Service { + public String propString; + public int propInt; + public Integer propInteger; + public Foo propFoo; + } + + public static class Foo { + public Foo() { + } + + private String name; + private Foo foo; + + public void setName(String val) { + name = val; + } + + public void setFoo(Foo val) { + foo = val; + } +/* + + private MyJaxBThing jaxBThing; + + public void setMyJaxBThing(MyJaxBThing thing) { + jaxBthing = thing; + } +*/ + } + + public static class FooFactory implements StAXPropertyFactory { + public ObjectFactory createObjectFactory(XMLStreamReader reader, Property property) throws XMLStreamException, ConfigurationLoadException { + reader.nextTag(); + String name = reader.getElementText(); + reader.next(); + Foo foo = new Foo(); + foo.setName(name); + return new SingletonObjectFactory(foo); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoaderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoaderTestCase.java new file mode 100644 index 0000000000..43b5bec143 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentTypeLoaderTestCase.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Service; + +/** + * @version $Rev$ $Date$ + */ +public class ComponentTypeLoaderTestCase extends LoaderTestSupport { + + public void testMinimal() throws XMLStreamException, ConfigurationLoadException { + XMLStreamReader reader = getReader(""); + ComponentType type = (ComponentType) registry.load(reader, loaderContext); + type.initialize(null); + assertNotNull(type); + assertEquals(1, type.getServices().size()); + Service service = type.getService("service1"); + assertEquals("service1", service.getName()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + } + + protected void setUp() throws Exception { + super.setUp(); + registerLoader(new ComponentTypeLoader()); + registerLoader(new ServiceLoader()); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/EntryPointLoaderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/EntryPointLoaderTestCase.java new file mode 100644 index 0000000000..8f207261fb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/EntryPointLoaderTestCase.java @@ -0,0 +1,63 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.ENTRY_POINT; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +/** + * @version $Rev$ $Date$ + */ +public class EntryPointLoaderTestCase extends LoaderTestSupport { + + public void testMinimal() throws XMLStreamException, ConfigurationLoadException { + String xml = ""; + XMLStreamReader reader = getReader(xml); + EntryPoint ep = (EntryPoint) registry.load(reader, loaderContext); + reader.require(XMLStreamConstants.END_ELEMENT, ENTRY_POINT.getNamespaceURI(), ENTRY_POINT.getLocalPart()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + assertNotNull(ep); + assertEquals("test", ep.getName()); + } + + public void testInterface() throws XMLStreamException, ConfigurationLoadException { + String interfaceName = MockService.class.getName(); + String xml = ""; + XMLStreamReader reader = getReader(xml); + EntryPoint ep = (EntryPoint) registry.load(reader, loaderContext); + reader.require(XMLStreamConstants.END_ELEMENT, ENTRY_POINT.getNamespaceURI(), ENTRY_POINT.getLocalPart()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + assertNotNull(ep); + assertEquals("test", ep.getName()); + ConfiguredService configuredService = ep.getConfiguredService(); + JavaServiceContract serviceContract = (JavaServiceContract) configuredService.getPort().getServiceContract(); + assertEquals(interfaceName, serviceContract.getInterfaceName()); + } + + protected void setUp() throws Exception { + super.setUp(); + registerLoader(new EntryPointLoader()); + registerLoader(new InterfaceJavaLoader()); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoaderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoaderTestCase.java new file mode 100644 index 0000000000..1fc5b367d5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ExternalServiceLoaderTestCase.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.EXTERNAL_SERVICE; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamConstants; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +/** + * @version $Rev$ $Date$ + */ +public class ExternalServiceLoaderTestCase extends LoaderTestSupport { + + public void testMinimal() throws XMLStreamException, ConfigurationLoadException { + String xml = ""; + XMLStreamReader reader = getReader(xml); + ExternalService es = (ExternalService) registry.load(reader, loaderContext); + assertNotNull(es); + assertEquals("test", es.getName()); + reader.require(XMLStreamConstants.END_ELEMENT, EXTERNAL_SERVICE.getNamespaceURI(), EXTERNAL_SERVICE.getLocalPart()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + } + + public void testInterface() throws XMLStreamException, ConfigurationLoadException { + String interfaceName = MockService.class.getName(); + String xml = ""; + XMLStreamReader reader = getReader(xml); + ExternalService es = (ExternalService) registry.load(reader, loaderContext); + reader.require(XMLStreamConstants.END_ELEMENT, EXTERNAL_SERVICE.getNamespaceURI(), EXTERNAL_SERVICE.getLocalPart()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + assertNotNull(es); + assertEquals("test", es.getName()); + ConfiguredService configuredService = es.getConfiguredService(); + JavaServiceContract serviceContract = (JavaServiceContract) configuredService.getPort().getServiceContract(); + assertEquals(interfaceName, serviceContract.getInterfaceName()); + } + + protected void setUp() throws Exception { + super.setUp(); + registerLoader(new ExternalServiceLoader()); + registerLoader(new InterfaceJavaLoader()); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderInterfaceStylesTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderInterfaceStylesTestCase.java new file mode 100644 index 0000000000..8b4f840f71 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderInterfaceStylesTestCase.java @@ -0,0 +1,101 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.INTERFACE_WSDL; + +import java.io.InputStream; +import java.net.URL; + +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; +import org.apache.tuscany.core.loader.impl.WSDLDefinitionRegistryImpl; +import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.helper.XSDHelper; + +/** + * @version $Rev$ $Date$ + */ +public class InterfaceWSDLLoaderInterfaceStylesTestCase extends LoaderTestSupport { + private WSDLDefinitionRegistryImpl wsdlRegistry; + private ResourceLoader resourceLoader; + private ClassLoader oldCL; + + public void testInterface() throws Exception { + wsdlRegistry.loadDefinition("http://www.interfacestyles.org", getClass().getResource("interfacestyles.wsdl"), resourceLoader); + String xml = ""; + XMLStreamReader reader = getReader(xml); + WSDLServiceContract sc = (WSDLServiceContract) registry.load(reader, loaderContext); + reader.require(XMLStreamConstants.END_ELEMENT, INTERFACE_WSDL.getNamespaceURI(), INTERFACE_WSDL.getLocalPart()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + assertNotNull(sc); + + sc.initialize(modelContext); + + Class scInterface = sc.getInterface(); + assertNotNull(scInterface); + + assertNotNull(scInterface.getMethod("getAccountReportWrapped0", new Class[0])); + assertNotNull(scInterface.getMethod("getAccountReportWrapped1", new Class[] {String.class})); + assertNotNull(scInterface.getMethod("getAccountReportWrappedN", new Class[] {String.class, int.class})); + assertNotNull(scInterface.getMethod("getAccountReportBare0", new Class[0])); + assertNotNull(scInterface.getMethod("getAccountReportBare1Simple", new Class[]{String.class})); + assertNotNull(scInterface.getMethod("getAccountReportBare1Complex", new Class[]{Object.class})); + + } + + protected void setUp() throws Exception { + oldCL = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); + resourceLoader = new ResourceLoaderImpl(getClass().getClassLoader()); + super.setUp(); + + wsdlRegistry = new WSDLDefinitionRegistryImpl(); + wsdlRegistry.setMonitor(NULL_MONITOR); + URL wsdlURL = getClass().getResource("interfacestyles.wsdl"); + wsdlRegistry.loadDefinition("http://www.interfacestyles.org", wsdlURL, resourceLoader); + InterfaceWSDLLoader loader = new InterfaceWSDLLoader(); + loader.setWsdlRegistry(wsdlRegistry); + registerLoader(loader); + + InputStream xsdInputStream = wsdlURL.openStream(); + try { + XSDHelper xsdHelper = SDOUtil.createXSDHelper(modelContext.getTypeHelper()); + xsdHelper.define(xsdInputStream, null); + } finally { + xsdInputStream.close(); + } + } + + protected void tearDown() throws Exception { + Thread.currentThread().setContextClassLoader(oldCL); + super.tearDown(); + } + + private static final WSDLDefinitionRegistryImpl.Monitor NULL_MONITOR = new WSDLDefinitionRegistryImpl.Monitor() { + public void readingWSDL(String namespace, URL location) { + } + + public void cachingDefinition(String namespace, URL location) { + } + }; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderTestCase.java new file mode 100644 index 0000000000..f97f13a1f7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/InterfaceWSDLLoaderTestCase.java @@ -0,0 +1,88 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import java.net.URL; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import static org.apache.tuscany.core.loader.assembly.AssemblyConstants.INTERFACE_WSDL; +import org.apache.tuscany.core.loader.impl.WSDLDefinitionRegistryImpl; +import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; + +/** + * @version $Rev$ $Date$ + */ +public class InterfaceWSDLLoaderTestCase extends LoaderTestSupport { + private WSDLDefinitionRegistryImpl wsdlRegistry; + private ResourceLoader resourceLoader; + + public void testMinimal() throws XMLStreamException, ConfigurationLoadException { + String xml = ""; + XMLStreamReader reader = getReader(xml); + WSDLServiceContract sc = (WSDLServiceContract) registry.load(reader, loaderContext); + reader.require(XMLStreamConstants.END_ELEMENT, INTERFACE_WSDL.getNamespaceURI(), INTERFACE_WSDL.getLocalPart()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + assertNotNull(sc); + } + + public void testInterface() throws Exception { + wsdlRegistry.loadDefinition("http://www.example.org", getClass().getResource("example.wsdl"), resourceLoader); + String xml = ""; + XMLStreamReader reader = getReader(xml); + WSDLServiceContract sc = (WSDLServiceContract) registry.load(reader, loaderContext); + reader.require(XMLStreamConstants.END_ELEMENT, INTERFACE_WSDL.getNamespaceURI(), INTERFACE_WSDL.getLocalPart()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + assertNotNull(sc); + } + + public void testInterfaceWithLocation() throws Exception { + wsdlRegistry.loadDefinition("http://www.example.org", getClass().getResource("example.wsdl"), resourceLoader); + String xml = ""; + XMLStreamReader reader = getReader(xml); + WSDLServiceContract sc = (WSDLServiceContract) registry.load(reader, loaderContext); + reader.require(XMLStreamConstants.END_ELEMENT, INTERFACE_WSDL.getNamespaceURI(), INTERFACE_WSDL.getLocalPart()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + assertNotNull(sc); + } + + protected void setUp() throws Exception { + super.setUp(); + wsdlRegistry = new WSDLDefinitionRegistryImpl(); + wsdlRegistry.setMonitor(NULL_MONITOR); + resourceLoader = new ResourceLoaderImpl(getClass().getClassLoader()); + wsdlRegistry.loadDefinition("http://www.example.org", getClass().getResource("example.wsdl"), resourceLoader); + InterfaceWSDLLoader loader = new InterfaceWSDLLoader(); + loader.setWsdlRegistry(wsdlRegistry); + registerLoader(loader); + } + + private static final WSDLDefinitionRegistryImpl.Monitor NULL_MONITOR = new WSDLDefinitionRegistryImpl.Monitor() { + public void readingWSDL(String namespace, URL location) { + } + + public void cachingDefinition(String namespace, URL location) { + } + }; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/LoaderTestSupport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/LoaderTestSupport.java new file mode 100644 index 0000000000..4e2aea5e83 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/LoaderTestSupport.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import java.io.StringReader; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; + +/** + * Base class for loader tests with common fixture elements. + * + * @version $Rev$ $Date$ + */ +public abstract class LoaderTestSupport extends TestCase { + protected SystemAssemblyFactory assemblyFactory; + protected ResourceLoader resourceLoader; + protected LoaderContext loaderContext; + protected AssemblyContext modelContext; + protected XMLInputFactory xmlFactory; + protected StAXLoaderRegistryImpl registry; + + protected static final StAXLoaderRegistryImpl.Monitor NULL_MONITOR = new StAXLoaderRegistryImpl.Monitor() { + public void registeringLoader(QName xmlType) { + } + + public void unregisteringLoader(QName xmlType) { + } + + public void elementLoad(QName xmlType) { + } + }; + + protected void setUp() throws Exception { + super.setUp(); + assemblyFactory = new SystemAssemblyFactoryImpl(); + resourceLoader = new ResourceLoaderImpl(getClass().getClassLoader()); + loaderContext = new LoaderContext(resourceLoader); + modelContext = new AssemblyContextImpl(assemblyFactory, null, resourceLoader); + xmlFactory = XMLInputFactory.newInstance(); + registry = new StAXLoaderRegistryImpl(); + registry.setMonitor(NULL_MONITOR); + } + + protected XMLStreamReader getReader(String xml) throws XMLStreamException { + XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml)); + reader.next(); + return reader; + } + + protected void registerLoader(AbstractLoader loader) { + loader.setFactory(assemblyFactory); + loader.setRegistry(registry); + loader.start(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/MockService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/MockService.java new file mode 100644 index 0000000000..c1ea3dbc1e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/MockService.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +/** + * @version $Rev$ $Date$ + */ +public interface MockService { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WSDLDefinitionRegistryTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WSDLDefinitionRegistryTestCase.java new file mode 100644 index 0000000000..5543a41f91 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WSDLDefinitionRegistryTestCase.java @@ -0,0 +1,76 @@ +/** + * + * Copyright 2006 The Apache Software Foundation or its licensors as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import java.net.URL; +import java.io.IOException; + +import javax.wsdl.Definition; +import javax.wsdl.WSDLException; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; +import org.apache.tuscany.core.loader.impl.WSDLDefinitionRegistryImpl; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; + +/** + * @version $Rev$ $Date$ + */ +public class WSDLDefinitionRegistryTestCase extends TestCase { + private static final String NS = "http://www.example.org"; + private WSDLDefinitionRegistryImpl wsdlRegistry; + private ResourceLoader rl; + + + public void testLoadFromAbsoluteWSDLLocation() { + try { + Definition def = wsdlRegistry.loadDefinition(NS + ' ' + rl.getResource("org/apache/tuscany/core/loader/assembly/example.wsdl"), rl); + assertNotNull(def.getPortType(new QName(NS, "HelloWorld"))); + } catch (IOException e) { + fail(e.getMessage()); + } catch (WSDLException e) { + fail(e.getMessage()); + } + } + + public void testLoadFromRelativeWSDLLocation() { + try { + Definition def = wsdlRegistry.loadDefinition(NS + " org/apache/tuscany/core/loader/assembly/example.wsdl", rl); + assertNotNull(def.getPortType(new QName(NS, "HelloWorld"))); + } catch (IOException e) { + fail(e.getMessage()); + } catch (WSDLException e) { + fail(e.getMessage()); + } + } + + protected void setUp() throws Exception { + super.setUp(); + wsdlRegistry = new WSDLDefinitionRegistryImpl(); + wsdlRegistry.setMonitor(NULL_MONITOR); + rl = new ResourceLoaderImpl(getClass().getClassLoader()); + } + + private static final WSDLDefinitionRegistryImpl.Monitor NULL_MONITOR = new WSDLDefinitionRegistryImpl.Monitor() { + public void readingWSDL(String namespace, URL location) { + } + + public void cachingDefinition(String namespace, URL location) { + } + }; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WireLoaderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WireLoaderTestCase.java new file mode 100644 index 0000000000..3a0331150d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/WireLoaderTestCase.java @@ -0,0 +1,60 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.loader.assembly; + +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.Wire; + +/** + * @version $Rev$ $Date$ + */ +public class WireLoaderTestCase extends LoaderTestSupport { + + public void testMinimal() throws XMLStreamException, ConfigurationLoadException { + String xml = "foo/fooServicebar"; + XMLStreamReader reader = getReader(xml); + Wire wire = (Wire) registry.load(reader, loaderContext); + reader.require(XMLStreamConstants.END_ELEMENT, AssemblyConstants.WIRE.getNamespaceURI(), AssemblyConstants.WIRE.getLocalPart()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + assertNotNull(wire); + assertEquals("foo", wire.getSource().getPartName()); + assertEquals("fooService", wire.getSource().getServiceName()); + assertEquals("bar", wire.getTarget().getPartName()); + } + + public void testCompound() throws XMLStreamException, ConfigurationLoadException { + String xml = "foo/fooServicebar/bazService"; + XMLStreamReader reader = getReader(xml); + Wire wire = (Wire) registry.load(reader, loaderContext); + reader.require(XMLStreamConstants.END_ELEMENT, AssemblyConstants.WIRE.getNamespaceURI(), AssemblyConstants.WIRE.getLocalPart()); + assertEquals(XMLStreamConstants.END_DOCUMENT, reader.next()); + assertNotNull(wire); + assertEquals("foo", wire.getSource().getPartName()); + assertEquals("fooService", wire.getSource().getServiceName()); + assertEquals("bar", wire.getTarget().getPartName()); + assertEquals("bazService", wire.getTarget().getServiceName()); + } + + protected void setUp() throws Exception { + super.setUp(); + registerLoader(new WireLoader()); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockConfigContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockConfigContext.java new file mode 100644 index 0000000000..820e4d36d8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockConfigContext.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.mock; + +import org.apache.tuscany.core.builder.BuilderConfigException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.impl.AssemblyVisitorImpl; +import org.apache.tuscany.core.context.ConfigurationContext; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.wire.SourceWireFactory; +import org.apache.tuscany.core.wire.TargetWireFactory; +import org.apache.tuscany.model.assembly.AssemblyObject; + +import java.util.ArrayList; +import java.util.List; + +/** + * A mock configuration context + * + * @version $Rev$ $Date$ + */ +public class MockConfigContext implements ConfigurationContext { + + private List builders = new ArrayList(); + + public MockConfigContext(List builders) { + this.builders = builders; + } + + public void build(AssemblyObject model) throws BuilderConfigException { + AssemblyVisitorImpl visitor = new AssemblyVisitorImpl(builders); + visitor.start(model); + } + + public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, + ScopeContext targetScopeContext) throws BuilderConfigException { + } + + public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) throws BuilderConfigException { + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java new file mode 100644 index 0000000000..87e92d783c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java @@ -0,0 +1,413 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.mock; + +import java.util.ArrayList; +import java.util.List; +import java.lang.reflect.Method; + +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.core.config.ComponentTypeIntrospector; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector; +import org.apache.tuscany.core.config.processor.ProcessorUtils; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.extension.config.ImplementationProcessor; +import org.apache.tuscany.core.extension.config.extensibility.DestroyInvokerExtensibilityElement; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; +import org.apache.tuscany.core.mock.component.Source; +import org.apache.tuscany.core.mock.component.SourceImpl; +import org.apache.tuscany.core.mock.component.Target; +import org.apache.tuscany.core.mock.component.TargetImpl; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.runtime.RuntimeContextImpl; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.SystemBinding; +import org.apache.tuscany.core.system.assembly.SystemModule; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.core.system.builder.SystemContextFactoryBuilder; +import org.apache.tuscany.core.system.builder.SystemEntryPointBuilder; +import org.apache.tuscany.core.system.builder.SystemExternalServiceBuilder; +import org.apache.tuscany.core.system.context.SystemCompositeContextImpl; +import org.apache.tuscany.core.injection.MethodEventInvoker; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.Part; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +/** + * Generates test components, modules, and runtime artifacts + * + * @version $Rev$ $Date$ + */ +public class MockFactory { + + private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); + private static AssemblyContext assemblyContext = new AssemblyContextImpl(systemFactory, null, null); + private static ComponentTypeIntrospector introspector; + private static ComponentType systemComponentType; + private static ComponentType compositeComponentType; + + private MockFactory() { + } + + public static ComponentType getComponentType() throws ConfigurationLoadException { + if (systemComponentType == null) { + systemComponentType = getIntrospector().introspect(SystemCompositeContextImpl.class); + } + return systemComponentType; + } + + public static ComponentType getCompositeComponentType() throws ConfigurationLoadException { + if (compositeComponentType == null) { + compositeComponentType = getIntrospector().introspect(CompositeContextImpl.class); + } + return compositeComponentType; + } + + public static ComponentTypeIntrospector getIntrospector() { + if (introspector == null) { + introspector = ProcessorUtils.createCoreIntrospector(systemFactory); + } + return introspector; + } + + /** + * Creates an composite component with the given name + */ + public static ModuleComponent createCompositeComponent(String name) throws ConfigurationLoadException { + ModuleComponent sc = systemFactory.createModuleComponent(); + Module impl = systemFactory.createModule(); + impl.setName(name); + //impl.setImplementationClass(CompositeContextImpl.class); + sc.setImplementation(impl); + impl.setImplementationClass(CompositeContextImpl.class); + impl.setComponentType(getCompositeComponentType()); + Service s = systemFactory.createService(); + JavaServiceContract ji = systemFactory.createJavaServiceContract(); + s.setServiceContract(ji); + ji.setScope(Scope.AGGREGATE); +// impl.setComponentType(systemFactory.createComponentType()); + impl.getComponentType().getServices().add(s); + sc.setName(name); + sc.setImplementation(impl); + return sc; + } + + /** + * Creates an composite component with the given name + */ + public static ModuleComponent createSystemCompositeComponent(String name) throws ConfigurationLoadException { + ModuleComponent sc = systemFactory.createModuleComponent(); + SystemModule impl = systemFactory.createSystemModule(); + impl.setName(name); + impl.setImplementationClass(SystemCompositeContextImpl.class); + impl.setComponentType(getComponentType()); + sc.setImplementation(impl); + Service s = systemFactory.createService(); + JavaServiceContract ji = systemFactory.createJavaServiceContract(); + s.setServiceContract(ji); + ji.setScope(Scope.AGGREGATE); + //impl.setComponentType(systemFactory.createComponentType()); + impl.getComponentType().getServices().add(s); + sc.setName(name); + sc.setImplementation(impl); + return sc; + } + + /** + * Creates a basic entry point with no configured reference using the system binding + * + * @param name the name of the entry point + * @param interfaz the inteface exposed by the entry point + * @param refName the name of the entry point reference + */ + public static EntryPoint createEPSystemBinding(String name, Class interfaz, String refName) { + return createEPSystemBinding(name, interfaz, refName, null); + } + + /** + * Creates an entry point wired to the given target (e.g. component, external service) using the system + * binding + * + * @param name the name of the entry point + * @param interfaz the inteface exposed by the entry point + * @param refName the name of the entry point reference + * @param target the target the entry point is wired to + */ + public static EntryPoint createEPSystemBinding(String name, Class interfaz, String refName, Part target) { + JavaServiceContract contract = systemFactory.createJavaServiceContract(); + contract.setInterface(interfaz); + + EntryPoint ep = systemFactory.createEntryPoint(); + ep.setName(name); + + Reference ref = systemFactory.createReference(); + ref.setName(refName); + ref.setServiceContract(contract); + ConfiguredReference configuredReference = systemFactory.createConfiguredReference(); + configuredReference.setPort(ref); + Service service = systemFactory.createService(); + service.setServiceContract(contract); + + ConfiguredService cService = systemFactory.createConfiguredService(); + cService.setPort(service); + cService.initialize(assemblyContext); + + configuredReference.getTargetConfiguredServices().add(cService); + ep.setConfiguredReference(configuredReference); + + Service epService = systemFactory.createService(); + epService.setServiceContract(contract); + + ConfiguredService epCService = systemFactory.createConfiguredService(); + epCService.initialize(assemblyContext); + epCService.setPort(epService); + + ep.setConfiguredService(epCService); + SystemBinding binding = systemFactory.createSystemBinding(); + ep.getBindings().add(binding); + if (target != null) { + if (target instanceof Component) { + ((Component) target).getConfiguredServices().add(cService); + // cService. + } else if (target instanceof ExternalService) { + ((ExternalService) target).setConfiguredService(cService); + } + target.initialize(assemblyContext); + } + ep.initialize(null); + return ep; + } + + /** + * Creates an entry point that should be wired to the given target (e.g. component, external service) + * using the system binding. The system assembly process should resolve the target name to an actual + * target configuration. + * + * @param name the name of the entry point + * @param interfaz the inteface exposed by the entry point + * @param refName the name of the entry point reference + * @param componentName the name of the target to resolve + */ + public static EntryPoint createEntryPointWithStringRef(String name, Class interfaz, String refName, String componentName) { + EntryPoint ep = createEPSystemBinding(name, interfaz, refName, null); + ConfiguredReference cRef = systemFactory.createConfiguredReference(); + Reference ref = systemFactory.createReference(); + cRef.setPort(ref); + Service service = systemFactory.createService(); + service.setName(componentName); + ConfiguredService cService = systemFactory.createConfiguredService(); + cService.setPort(service); + cRef.getTargetConfiguredServices().add(cService); + cRef.initialize(assemblyContext); + cService.initialize(assemblyContext); + JavaServiceContract contract = systemFactory.createJavaServiceContract(); + contract.setInterface(interfaz); + ref.setServiceContract(contract); + ep.setConfiguredReference(cRef); + ep.initialize(assemblyContext); + return ep; + } + + /** + * Creates an external service configured with a {@link SystemBinding} + */ + public static ExternalService createESSystemBinding(String name, String refName) { + ExternalService es = systemFactory.createExternalService(); + es.setName(name); + ConfiguredService configuredService = systemFactory.createConfiguredService(); + es.setConfiguredService(configuredService); + SystemBinding binding = systemFactory.createSystemBinding(); + binding.setTargetName(refName); + es.getBindings().add(binding); + es.initialize(null); + return es; + } + + /** + * Creates an external service that specifies an autowire of the given type + */ + public static ExternalService createAutowirableExternalService(String name, Class type) { + ExternalService es = systemFactory.createExternalService(); + es.setName(name); + JavaServiceContract inter = systemFactory.createJavaServiceContract(); + inter.setInterface(type); + Service service = systemFactory.createService(); + service.setServiceContract(inter); + ConfiguredService cService = systemFactory.createConfiguredService(); + cService.setPort(service); + cService.initialize(assemblyContext); + es.setConfiguredService(cService); + es.getBindings().add(systemFactory.createSystemBinding()); + es.initialize(null); + return es; + } + + /** + * Creates a test system module with a module-scoped component and entry point + */ + public static Module createSystemModule() throws ConfigurationLoadException { + Module module = systemFactory.createSystemModule(); + module.setName("system.module"); + + // create test component + Component component = systemFactory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, + ModuleScopeSystemComponentImpl.class, Scope.MODULE); + component.getImplementation().setComponentType(getIntrospector().introspect(ModuleScopeSystemComponent.class)); + module.getComponents().add(component); + + // create the entry point + EntryPoint ep = createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "target", component); + module.getEntryPoints().add(ep); + + module.initialize(assemblyContext); + module.setImplementationClass(SystemCompositeContextImpl.class); + module.setComponentType(getComponentType()); + return module; + } + + public static Component createSystemComponent(String name, Class service, Class impl, Scope scope) throws ConfigurationLoadException { + Component c = systemFactory.createSystemComponent(name, service, impl, scope); + c.getImplementation().setComponentType(getIntrospector().introspect(impl)); + for (Service s : c.getImplementation().getComponentType().getServices()) { + s.getServiceContract().setScope(scope); //hack + } + + return c; + } + + /** + * Creates a test system module with source and target components wired together. + * + * @see org.apache.tuscany.core.mock.component.Source + * @see org.apache.tuscany.core.mock.component.Target + */ + public static Module createSystemModuleWithWiredComponents(String moduleName, Scope sourceScope, Scope targetScope) throws ConfigurationLoadException { + + // create the target component + Component target = systemFactory.createSystemComponent("target", Target.class, TargetImpl.class, targetScope); + target.initialize(assemblyContext); + + // create the source componentType + Component source = systemFactory.createSystemComponent("source", Source.class, SourceImpl.class, sourceScope); + ComponentType sourceComponentType = source.getImplementation().getComponentType(); + List references = sourceComponentType.getReferences(); + List configuredReferences = source.getConfiguredReferences(); + + // wire source to target + references.add(systemFactory.createReference("setTarget", Target.class)); + ConfiguredReference configuredReference = systemFactory.createConfiguredReference("setTarget", "target"); + configuredReferences.add(configuredReference); + + // wire multiplicity using a setter + references.add(systemFactory.createReference("setTargets", Target.class, Multiplicity.ONE_N)); + configuredReference = systemFactory.createConfiguredReference("setTargets", "target"); + configuredReferences.add(configuredReference); + + // wire multiplicity using a field + references.add(systemFactory.createReference("targetsThroughField", Target.class, Multiplicity.ONE_N)); + configuredReference = systemFactory.createConfiguredReference("targetsThroughField", "target"); + configuredReferences.add(configuredReference); + + // wire multiplicity using a setter + references.add(systemFactory.createReference("setArrayOfTargets", Target.class, Multiplicity.ONE_N)); + configuredReference = systemFactory.createConfiguredReference("setArrayOfTargets", "target"); + configuredReferences.add(configuredReference); + + source.initialize(assemblyContext); + + Module module = systemFactory.createSystemModule(); + module.setImplementationClass(SystemCompositeContextImpl.class); + module.setComponentType(getComponentType()); + module.setName(moduleName); + module.getComponents().add(source); + module.getComponents().add(target); + module.initialize(assemblyContext); + return module; + } + + /** + * Creates a test system module component with source and target components wired together. + * + * @see org.apache.tuscany.core.mock.component.Source + * @see org.apache.tuscany.core.mock.component.Target + */ + public static ModuleComponent createSystemModuleComponentWithWiredComponents(String moduleComponentName, Scope sourceScope, + Scope targetScope) throws ConfigurationLoadException { + ModuleComponent mc = systemFactory.createModuleComponent(); + mc.setName(moduleComponentName); + mc.setImplementation(createSystemModuleWithWiredComponents(moduleComponentName + ".module", sourceScope, targetScope)); + return mc; + } + + /** + * Creates a test system module component with a module-scoped component and entry point + */ + public static Module createSystemChildModule() throws ConfigurationLoadException { + Module module = systemFactory.createSystemModule(); + module.setName("system.test.module"); + module.setImplementationClass(SystemCompositeContextImpl.class); + module.setComponentType(getComponentType()); + + // create test component + Component component = systemFactory.createSystemComponent("TestService2", ModuleScopeSystemComponent.class, + ModuleScopeSystemComponentImpl.class, Scope.MODULE); + module.getComponents().add(component); + + // create the entry point + EntryPoint ep = createEPSystemBinding("TestService2EP", ModuleScopeSystemComponent.class, "target", component); + module.getEntryPoints().add(ep); + + module.initialize(assemblyContext); + return module; + } + + /** + * Returns a collection of bootstrap configuration builders + */ + public static List createSystemBuilders() { + List builders = new ArrayList(); + builders.add((new SystemContextFactoryBuilder(null))); + builders.add(new SystemEntryPointBuilder()); + builders.add(new SystemExternalServiceBuilder()); + return builders; + } + + /** + * Creates a default {@link RuntimeContext} configured with support for Java component implementations + */ + public static RuntimeContext createCoreRuntime() { + NullMonitorFactory monitorFactory = new NullMonitorFactory(); + RuntimeContext runtime = new RuntimeContextImpl(monitorFactory, BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory), null); + runtime.start(); + return runtime; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java new file mode 100644 index 0000000000..fb1cb86873 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.mock.component; + +import org.apache.tuscany.core.system.annotation.Autowire; + +import java.util.List; + +/** + * Mock system component implementation used in autowire tests + * + * @version $Rev$ $Date$ + */ +public class AutowireSourceImpl implements Source { + + @Autowire + protected Target target; + + private List targets; + + private List targetsThroughField; + + public void setTarget(Target target) { + this.target = target; + } + + public Target getTarget() { + return target; + } + + public List getTargets() { + return targets; + } + + public void setTargets(List targets) { + this.targets = targets; + } + + public List getTargetsThroughField() { + return targetsThroughField; + } + + private Target[] targetsArray; + + public Target[] getArrayOfTargets() { + return targetsArray; + } + + public void setArrayOfTargets(Target[] targets) { + targetsArray = targets; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/GenericSystemComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/GenericSystemComponent.java new file mode 100644 index 0000000000..1fd02de992 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/GenericSystemComponent.java @@ -0,0 +1,22 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.mock.component; + +public interface GenericSystemComponent { + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponent.java new file mode 100644 index 0000000000..dabbd9e4ef --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponent.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.mock.component; + +import org.osoa.sca.annotations.Scope; + +/** + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public interface ModuleScopeSystemComponent extends GenericSystemComponent { + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponentImpl.java new file mode 100644 index 0000000000..58afde9354 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/ModuleScopeSystemComponentImpl.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.mock.component; + +/** + * @version $Rev$ $Date$ + */ +public class ModuleScopeSystemComponentImpl implements ModuleScopeSystemComponent { + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java new file mode 100644 index 0000000000..6ce1059db1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Source.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.mock.component; + +import java.util.List; + +/** + * Implementations are used in wiring tests + * + * @version $Rev$ $Date$ + */ +public interface Source { + + public Target getTarget(); + + public List getTargets(); + + public List getTargetsThroughField(); + + public Target[] getArrayOfTargets(); + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java new file mode 100644 index 0000000000..075e70699e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/SourceImpl.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.mock.component; + +import java.util.List; + +import org.osoa.sca.annotations.Destroy; + +/** + * Mock system component implementation used in wiring tests + * + * @version $Rev$ $Date$ + */ +public class SourceImpl implements Source { + + private Target target; + + private List targets; + + private List targetsThroughField; + + @Destroy + public void foo(){ + } + + public void setTarget(Target target) { + this.target = target; + } + + public Target getTarget() { + return target; + } + + public List getTargets() { + return targets; + } + + public void setTargets(List targets) { + this.targets = targets; + } + + public List getTargetsThroughField() { + return targetsThroughField; + } + + private Target[] targetsArray; + + public Target[] getArrayOfTargets() { + return targetsArray; + } + + public void setArrayOfTargets(Target[] targets) { + targetsArray = targets; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java new file mode 100644 index 0000000000..fb3642a495 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/Target.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.mock.component; + +/** + * Implementations are used in wiring tests + * + * @version $Rev$ $Date$ + */ +public interface Target { + + public String getString(); + + public void setString(String val); +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java new file mode 100644 index 0000000000..323bee0713 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/TargetImpl.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.mock.component; + +/** + * Mock system component implementation used in wiring tests + * + * @version $Rev$ $Date$ + */ +public class TargetImpl implements Target { + + private String theString; + + public String getString() { + return theString; + } + + public void setString(String val) { + theString = val; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeBootTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeBootTestCase.java new file mode 100644 index 0000000000..c4e1ea9962 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeBootTestCase.java @@ -0,0 +1,99 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.runtime; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Lifecycle; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.mock.MockFactory; + +/** + * Tests runtime boot scenarios + * + * @version $Rev$ $Date$ + */ +public class RuntimeBootTestCase extends TestCase { + private RuntimeContext runtime; + private NullMonitorFactory monitorFactory; + private ContextFactoryBuilderRegistry builderRegistry; + private DefaultWireBuilder wireBuilder; + + public void testContextParents() { + CompositeContext rootContext = runtime.getRootContext(); + assertNotNull(rootContext); + assertEquals("tuscany.root", rootContext.getName()); + assertSame(runtime, rootContext.getParent()); + assertSame(rootContext, runtime.getContext("tuscany.root")); + + CompositeContext systemContext = runtime.getSystemContext(); + assertNotNull(systemContext); + assertEquals("tuscany.system", systemContext.getName()); + assertSame(runtime, systemContext.getParent()); + assertSame(systemContext, runtime.getContext("tuscany.system")); + } + + public void testRuntimeLifecycle() { + assertEquals(Lifecycle.RUNNING, runtime.getLifecycleState()); + runtime.stop(); + + assertEquals(Lifecycle.STOPPED, runtime.getLifecycleState()); + } + + public void testIncrementalBoot() throws Exception{ + + // start the runtime context + RuntimeContext runtimeContext = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder); + runtimeContext.start(); + + CompositeContext system = runtimeContext.getSystemContext(); + Assert.assertNotNull(system); + // register system components + system.registerModelObject(MockFactory.createSystemModule()); + // start the module scope + system.publish(new ModuleStart(this)); + // register the first module + + // register the second module + + // start the modules + + system.publish(new ModuleStop(this)); + runtimeContext.stop(); + Assert.assertEquals(Lifecycle.STOPPED,system.getLifecycleState()); + } + + protected void setUp() throws Exception { + super.setUp(); + + monitorFactory = new NullMonitorFactory(); + builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); + wireBuilder = new DefaultWireBuilder(); + runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder); + runtime.start(); + } + + protected void tearDown() throws Exception { + runtime.stop(); + super.tearDown(); + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java new file mode 100644 index 0000000000..d9596239fa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java @@ -0,0 +1,286 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.runtime; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Lifecycle; +import org.apache.tuscany.core.context.ServiceNotFoundException; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.core.system.context.TestBuilder; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +/** + * Performs basic tests on the runtime context + * + * @version $Rev$ $Date$ + */ +public class RuntimeContextImplTestCase extends TestCase { + + private SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); + + private ContextFactoryBuilderRegistry builderRegistry; + + private SystemAssemblyFactory factory; + private MonitorFactory monitorFactory; + private RuntimeContext runtime; + + /** + * Tests explicit wiring of an external service to a system entry point that is wired to a child system + * module entry point + */ + public void testSystemExplicitWiring() throws Exception { + CompositeContext root = runtime.getRootContext(); + Assert.assertNotNull(root); + Assert.assertTrue(root.getLifecycleState() == Lifecycle.RUNNING); + + CompositeContext system = runtime.getSystemContext(); + Assert.assertNotNull(system); + system.registerModelObject(MockFactory.createSystemModule()); + + // register a child system context + system.registerModelObject(MockFactory.createSystemCompositeComponent("system.child")); + CompositeContext systemChild = (CompositeContext) system.getContext("system.child"); + systemChild.registerModelObject(MockFactory.createSystemChildModule()); + + // register a top-level system entry point that exposes the child entry point + EntryPoint ep = MockFactory.createEPSystemBinding("TestService2EP", ModuleScopeSystemComponent.class, "ref"); + ep.getBindings().add(systemFactory.createSystemBinding()); + Service service = systemFactory.createService(); + service.setName("system.child/TestService2EP"); + ep.getConfiguredReference().getTargetConfiguredServices().get(0).setPort(service); + JavaServiceContract inter = systemFactory.createJavaServiceContract(); + inter.setInterface(ModuleScopeSystemComponentImpl.class); + service.setServiceContract(inter); + system.registerModelObject(ep); + system.publish(new ModuleStart(this)); + Assert.assertNotNull(system.getContext("TestService1").getInstance(null)); + Assert.assertNotNull(system.getContext("TestService2EP").getInstance(null)); + + // create a test module and wire an external service to the system entry point + Component moduleComponent = MockFactory.createCompositeComponent("test.module"); + runtime.registerModelObject(moduleComponent); + CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("test.module"); + Assert.assertNotNull(moduleContext); + ExternalService es = MockFactory.createESSystemBinding("TestService2ES", "tuscany.system/TestService2EP"); + moduleContext.registerModelObject(es); + moduleContext.publish(new ModuleStart(this)); + Assert.assertNotNull(moduleContext.getContext("TestService2ES").getInstance(null)); + + moduleContext.publish(new ModuleStop(this)); + system.publish(new ModuleStop(this)); + } + + /** + * Tests autowiring an external service to a system entry point + */ + public void testSystemAutoWiring() throws Exception { + CompositeContext root = runtime.getRootContext(); + Assert.assertNotNull(root); + Assert.assertTrue(root.getLifecycleState() == Lifecycle.RUNNING); + + CompositeContext system = runtime.getSystemContext(); + Assert.assertNotNull(system); + system.registerModelObject(MockFactory.createSystemModule()); + + // create a test module and wire an external service to the system entry point + Component moduleComponent = MockFactory.createCompositeComponent("test.module"); + runtime.registerModelObject(moduleComponent); + CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("test.module"); + Assert.assertNotNull(moduleContext); + ExternalService es = MockFactory.createAutowirableExternalService("TestService2ES", ModuleScopeSystemComponent.class); + moduleContext.registerModelObject(es); + + system.publish(new ModuleStart(this)); + moduleContext.publish(new ModuleStart(this)); + // test that the autowire was resolved + Assert.assertNotNull(moduleContext.getContext("TestService2ES").getInstance(null)); + + moduleContext.publish(new ModuleStop(this)); + system.publish(new ModuleStop(this)); + } + + public void testServiceNotFound() throws Exception { + // create a test module + Component moduleComponent = MockFactory.createCompositeComponent("module"); + runtime.registerModelObject(moduleComponent); + CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("module"); + moduleContext.publish(new ModuleStart(this)); + try { + moduleContext.locateService("TestService"); + fail("Expected " + ServiceNotFoundException.class.getName()); + } catch (ServiceNotFoundException e) { + // expected + } + moduleContext.publish(new ModuleStop(this)); + } + + public void testExternalServiceReferenceNotFound() throws Exception { + CompositeContext system = runtime.getSystemContext(); + + // create a test module + Component moduleComponent = MockFactory.createCompositeComponent("module"); + runtime.registerModelObject(moduleComponent); + CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("module"); + ExternalService es = MockFactory.createESSystemBinding("TestServiceES", "tuscany.system/TestService1xEP"); + moduleContext.registerModelObject(es); + + // start the modules and test inter-module system wires + system.publish(new ModuleStart(this)); + moduleContext.publish(new ModuleStart(this)); + try { + moduleContext.locateService("TestServiceES"); + fail("Expected " + ServiceNotFoundException.class.getName()); + } catch (ServiceNotFoundException e) { + // expected + } + moduleContext.publish(new ModuleStop(this)); + system.publish(new ModuleStop(this)); + } + + public void testEntryPointReferenceNotFound() throws Exception { + // create a test module + Component moduleComponent = MockFactory.createCompositeComponent("module"); + runtime.registerModelObject(moduleComponent); + + Component component = factory.createSystemComponent("NoService", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + // do not register the above component! + + CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("module"); + EntryPoint epSystemBinding = MockFactory.createEPSystemBinding("TestServiceEP", ModuleScopeSystemComponent.class, "NoReference", component); + moduleContext.registerModelObject(epSystemBinding); + + moduleContext.publish(new ModuleStart(this)); + try { + moduleContext.locateService("TestServiceEP"); + fail("Expected " + ServiceNotFoundException.class.getName()); + } catch (ServiceNotFoundException e) { + // expected + } + moduleContext.publish(new ModuleStop(this)); + } + + /** + * Test two module components that have external services wired to entry points contained in each + */ + public void testCircularWires() throws Exception { + // create a test modules + Component module1 = MockFactory.createCompositeComponent("module1"); + runtime.registerModelObject(module1); + Component module2 = MockFactory.createCompositeComponent("module2"); + runtime.registerModelObject(module2); + + CompositeContextImpl moduleContext1 = (CompositeContextImpl) runtime.getContext("module1"); + CompositeContextImpl moduleContext2 = (CompositeContextImpl) runtime.getContext("module2"); + + Component component1 = factory.createSystemComponent("Component1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + EntryPoint entryPoint1 = MockFactory.createEPSystemBinding("EntryPoint1", ModuleScopeSystemComponent.class, "Component1", component1); + ExternalService externalService1 = MockFactory.createESSystemBinding("ExternalService1", "module2/EntryPoint2"); + moduleContext1.registerModelObject(component1); + moduleContext1.registerModelObject(entryPoint1); + moduleContext1.registerModelObject(externalService1); + + Component component2 = factory.createSystemComponent("Component2", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + EntryPoint entryPoint2 = MockFactory.createEPSystemBinding("EntryPoint2", ModuleScopeSystemComponent.class, "Component2", component2); + ExternalService externalService2 = MockFactory.createESSystemBinding("ExternalService2", "module1/EntryPoint1"); + moduleContext2.registerModelObject(component2); + moduleContext2.registerModelObject(entryPoint2); + moduleContext2.registerModelObject(externalService2); + + moduleContext1.publish(new ModuleStart(this)); + moduleContext2.publish(new ModuleStart(this)); + Assert.assertNotNull(moduleContext2.getContext("ExternalService2").getInstance(null)); + Assert.assertNotNull(moduleContext1.getContext("ExternalService1").getInstance(null)); + } + + /** + * Tests that a circular reference between an external service in one module and an entry point in another + * is caught as an error condition FIXME this must be implemented + */ + public void testInterModuleCircularReference() throws Exception { + // create a test modules + Component module1 = MockFactory.createCompositeComponent("module1"); + runtime.registerModelObject(module1); + Component module2 = MockFactory.createCompositeComponent("module2"); + runtime.registerModelObject(module2); + + CompositeContextImpl moduleContext1 = (CompositeContextImpl) runtime.getContext("module1"); + CompositeContextImpl moduleContext2 = (CompositeContextImpl) runtime.getContext("module2"); + ExternalService externalService1 = MockFactory.createESSystemBinding("ExternalService1", "module2/EntryPoint2"); + EntryPoint entryPoint1 = MockFactory.createEPSystemBinding("EntryPoint1", ModuleScopeSystemComponent.class, + "ExternalService1", externalService1); + ExternalService externalService2 = MockFactory.createESSystemBinding("ExternalService2", "module1/EntryPoint1"); + EntryPoint entryPoint2 = MockFactory.createEPSystemBinding("EntryPoint2", ModuleScopeSystemComponent.class, + "ExternalService2", externalService2); + try { + // FIXME this should throw a circular reference exception + moduleContext1.registerModelObject(externalService1); + moduleContext1.registerModelObject(entryPoint1); + moduleContext2.registerModelObject(externalService2); + moduleContext2.registerModelObject(entryPoint2); + // FIXME implement fail("Expected " + ConfigurationException.class.getName()); + } catch (ConfigurationException e) { + // expected + } + } + + public void testRuntimeBuilderAutowire() throws Exception { + + + CompositeContext system = runtime.getSystemContext(); + Component builder = factory.createSystemComponent("TestBuilder", ContextFactoryBuilder.class, TestBuilder.class, Scope.MODULE); + builder.getImplementation().setComponentType(MockFactory.getIntrospector().introspect(TestBuilder.class)); + system.registerModelObject(builder); + system.publish(new ModuleStart(this)); + Component module1 = MockFactory.createCompositeComponent("module1"); + runtime.registerModelObject(module1); + runtime.getContext("module1"); + Assert.assertTrue(((TestBuilder) system.getContext("TestBuilder").getInstance(null)).invoked()); + system.publish(new ModuleStop(this)); + } + + protected void setUp() throws Exception { + super.setUp(); + monitorFactory = new NullMonitorFactory(); + builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); + factory = new SystemAssemblyFactoryImpl(); + + runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, null); + runtime.start(); + } + + protected void tearDown() throws Exception { + runtime.stop(); + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/SystemBootstrapTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/SystemBootstrapTestCase.java new file mode 100644 index 0000000000..45af495239 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/SystemBootstrapTestCase.java @@ -0,0 +1,127 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.runtime; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.mock.component.GenericSystemComponent; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +/** + * Tests bootstrapping a system module + * + * @version $Rev: 385834 $ $Date: 2006-03-14 08:57:08 -0800 (Tue, 14 Mar 2006) $ + */ +public class SystemBootstrapTestCase extends TestCase { + private ContextFactoryBuilderRegistry builderRegistry; + + private SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl(); + + /** + * Simulates booting a runtime process + */ + public void testBoot() throws Exception { + RuntimeContext runtimeContext = new RuntimeContextImpl(new NullMonitorFactory(), builderRegistry,null); + runtimeContext.start(); + + CompositeContext systemContext = runtimeContext.getSystemContext(); + Assert.assertNotNull(systemContext); + Module systemModule = MockFactory.createSystemModule(); + // MockSystemAssemblyFactory.buildModule(systemModule, systemContext); + systemContext.registerModelObject(systemModule); + + // create a test module + Component moduleComponent = MockFactory.createCompositeComponent("module"); + runtimeContext.registerModelObject(moduleComponent); + CompositeContextImpl moduleContext = (CompositeContextImpl) runtimeContext.getContext("module"); + Assert.assertNotNull(moduleContext); + ExternalService es = MockFactory.createESSystemBinding("TestServiceES", "tuscany.system/TestService1EP"); + moduleContext.registerModelObject(es); + + // start the modules and test inter-module system wires + systemContext.publish(new ModuleStart(this)); + moduleContext.publish(new ModuleStart(this)); + + Assert.assertNotNull(systemContext.getContext("TestService1EP").getInstance(null)); + GenericSystemComponent testService = (GenericSystemComponent) systemContext.getContext("TestService1").getInstance(null); + Assert.assertNotNull(testService); + GenericSystemComponent testES = (GenericSystemComponent) moduleContext.getContext("TestServiceES").getInstance(null); + Assert.assertNotNull(testES); + Assert.assertSame(testService, testES); + } + + public void testRuntimeBoot() throws Exception { + RuntimeContext runtime = new RuntimeContextImpl(new NullMonitorFactory(), builderRegistry,null); + runtime.start(); + runtime.getRootContext(); + + CompositeContext system = runtime.getSystemContext(); + system.registerModelObject(MockFactory.createSystemModule()); + system.registerModelObject(MockFactory.createSystemCompositeComponent("module2")); + CompositeContext systemModule2 = (CompositeContext) system.getContext("module2"); + systemModule2.registerModelObject(MockFactory.createSystemChildModule()); + + EntryPoint ep = MockFactory.createEPSystemBinding("TestService2EP", ModuleScopeSystemComponent.class, "ref"); + ep.getBindings().add(factory.createSystemBinding()); + Service service = factory.createService(); + service.setName("module2/TestService2EP"); + JavaServiceContract inter = factory.createJavaServiceContract(); + inter.setInterface(ModuleScopeSystemComponentImpl.class); + service.setServiceContract(inter); + ep.getConfiguredReference().getTargetConfiguredServices().get(0).setPort(service); + system.registerModelObject(ep); + system.publish(new ModuleStart(this)); + Assert.assertNotNull(system.getContext("TestService1").getInstance(null)); + Assert.assertNotNull(system.getContext("TestService2EP").getInstance(null)); + + Assert.assertNotNull(((AutowireContext) system).resolveInstance(ModuleScopeSystemComponent.class)); + // create a test module + Component moduleComponent = MockFactory.createCompositeComponent("test.module"); + runtime.registerModelObject(moduleComponent); + CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("test.module"); + Assert.assertNotNull(moduleContext); + ExternalService es = MockFactory.createESSystemBinding("TestService2ES", "tuscany.system/TestService2EP"); + moduleContext.registerModelObject(es); + moduleContext.publish(new ModuleStart(this)); + Assert.assertNotNull(moduleContext.getContext("TestService2ES").getInstance(null)); + + moduleContext.publish(new ModuleStop(this)); + system.publish(new ModuleStop(this)); + runtime.stop(); + } + + protected void setUp() throws Exception { + super.setUp(); + builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(null); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java new file mode 100644 index 0000000000..fe6bff635a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java @@ -0,0 +1,106 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.builder; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; +import org.apache.tuscany.core.mock.MockConfigContext; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.system.annotation.Monitor; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.Scope; + +/** + * @version $Rev$ $Date$ + */ +public class MonitorInjectionTestCase extends TestCase { + private SystemContextFactoryBuilder builder; + private Component component; + + public static interface TestService { + } + + public static class TestComponent implements TestService { + @Monitor + protected Monitor1 monitor1; + Monitor2 monitor2; + + @Monitor + public void setMonitor2(Monitor2 monitor2) { + this.monitor2 = monitor2; + } + } + + public static interface Monitor1 { + } + + public static interface Monitor2 { + } + + public void testMonitorInjection() { + builder.build(component); + ContextFactory contextFactory = (ContextFactory) component.getContextFactory(); + Assert.assertNotNull(contextFactory); + contextFactory.prepare(createContext()); + Context ctx = contextFactory.createContext(); + + ctx.start(); + TestComponent instance = (TestComponent) ctx.getInstance(null); + assertSame(MONITOR1, instance.monitor1); + assertSame(MONITOR2, instance.monitor2); + } + + protected void setUp() throws Exception { + super.setUp(); + SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl(); + MockMonitorFactory monitorFactory = new MockMonitorFactory(); + builder = new SystemContextFactoryBuilder(monitorFactory); + component = factory.createSystemComponent("test", TestService.class, TestComponent.class, Scope.MODULE); + component.getImplementation().setComponentType(MockFactory.getIntrospector().introspect(TestComponent.class)); + } + + private static final Monitor1 MONITOR1 = new Monitor1() { + }; + private static final Monitor2 MONITOR2 = new Monitor2() { + }; + + public static class MockMonitorFactory implements MonitorFactory { + public T getMonitor(Class monitorInterface) { + if (Monitor1.class.equals(monitorInterface)) { + return monitorInterface.cast(MONITOR1); + } else if (Monitor2.class.equals(monitorInterface)) { + return monitorInterface.cast(MONITOR2); + } else { + throw new AssertionError(); + } + } + } + + private static CompositeContext createContext() { + return new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), new EventContextImpl(), new MockConfigContext(null)); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java new file mode 100644 index 0000000000..3398a010e9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java @@ -0,0 +1,167 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.builder; + +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.AutowireContext; +import org.apache.tuscany.core.context.ConfigurationContext; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.core.system.annotation.ParentContext; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Scope; + +/** + * A system component used for unit testing + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class SystemComponentImpl { + + @Autowire + protected ConfigurationContext ctx; + + @ParentContext + protected CompositeContext parent; + + @Autowire + protected AutowireContext autowireCtx; + + private ConfigurationContext ctxSetter; + + private CompositeContext parentSetter; + + private AutowireContext autowireCtxSetter; + + public ConfigurationContext getConfigContext() { + return ctx; + } + + public CompositeContext getParentContext() { + return parent; + } + + public AutowireContext getAutowireContext() { + return autowireCtx; + } + + @Autowire + public void setConfigContext(ConfigurationContext configCtx) { + ctxSetter = configCtx; + } + + public ConfigurationContext getConfigContextSetter() { + return ctxSetter; + } + + @ParentContext + public void setParentContex(CompositeContext ctx) { + parentSetter = ctx; + } + + public CompositeContext getParentContextSetter() { + return parentSetter; + } + + @Autowire + public void setAutowireContext(AutowireContext ctx) { + autowireCtxSetter = ctx; + } + + public AutowireContext getAutowireContextSetter() { + return autowireCtx; + } + + private boolean inited; + + @Init + public void init(){ + inited=true; + } + + public boolean initialized(){ + return (inited); + } + + private boolean destroyed; + + @Destroy + public void destroy(){ + destroyed=true; + } + + public boolean destroyed(){ + return (destroyed); + } + + @Property + protected int testInt; + + public int getTestInt(){ + return testInt; + } + + @Property + protected double testDouble; + + public double getTestDouble(){ + return testDouble; + } + + @Property + protected float testFloat; + + public float getTestFloat(){ + return testFloat; + } + + @Property + protected short testShort; + + public short getTestShort(){ + return testShort; + } + + @Property + protected boolean testBoolean; + + public boolean getTestBoolean(){ + return testBoolean; + } + + @Property + protected byte testByte; + + public byte getTestByte(){ + return testByte; + } + + @Property + protected char testChar; + + public char getTestChar(){ + return testChar; + } + + @Property + protected String testString; + + public String getTestString(){ + return testString; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java new file mode 100644 index 0000000000..f7543911a6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java @@ -0,0 +1,173 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.builder; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; +import org.apache.tuscany.core.mock.MockConfigContext; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.SystemImplementation; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ConfiguredProperty; +import org.apache.tuscany.model.assembly.Property; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +/** + * Tests to system components are built properly + * + * @version $Rev$ $Date$ + */ +public class SystemContextFactoryBuilderTestCase extends TestCase { + + private SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl(); + + public void testComponentContextBuilder() throws Exception { + SystemContextFactoryBuilder builder = new SystemContextFactoryBuilder(null); + Component component = factory.createSystemComponent("test", null, SystemComponentImpl.class, Scope.AGGREGATE); + component.getImplementation().setComponentType(MockFactory.getIntrospector().introspect(SystemComponentImpl.class)); + ConfiguredProperty cProp = factory.createConfiguredProperty(); + Property prop = factory.createProperty(); + prop.setName("testInt"); + cProp.setValue(1); + cProp.setProperty(prop); + component.getConfiguredProperties().add(cProp); + + cProp = factory.createConfiguredProperty(); + prop = factory.createProperty(); + prop.setName("testString"); + cProp.setValue("test"); + cProp.setProperty(prop); + component.getConfiguredProperties().add(cProp); + + cProp = factory.createConfiguredProperty(); + prop = factory.createProperty(); + prop.setName("testDouble"); + cProp.setValue(1d); + cProp.setProperty(prop); + component.getConfiguredProperties().add(cProp); + + cProp = factory.createConfiguredProperty(); + prop = factory.createProperty(); + prop.setName("testFloat"); + cProp.setValue(1f); + cProp.setProperty(prop); + component.getConfiguredProperties().add(cProp); + + cProp = factory.createConfiguredProperty(); + prop = factory.createProperty(); + prop.setName("testShort"); + cProp.setValue((short) 1); + cProp.setProperty(prop); + component.getConfiguredProperties().add(cProp); + + cProp = factory.createConfiguredProperty(); + prop = factory.createProperty(); + prop.setName("testByte"); + cProp.setValue((byte) 1); + cProp.setProperty(prop); + component.getConfiguredProperties().add(cProp); + + cProp = factory.createConfiguredProperty(); + prop = factory.createProperty(); + prop.setName("testBoolean"); + cProp.setValue(Boolean.TRUE); + cProp.setProperty(prop); + component.getConfiguredProperties().add(cProp); + + cProp = factory.createConfiguredProperty(); + prop = factory.createProperty(); + prop.setName("testChar"); + cProp.setValue('1'); + cProp.setProperty(prop); + component.getConfiguredProperties().add(cProp); + + builder.build(component); + ContextFactory contextFactory = (ContextFactory) component.getContextFactory(); + Assert.assertNotNull(contextFactory); + contextFactory.prepare(createContext()); + AtomicContext ctx = contextFactory.createContext(); + + ctx.start(); + SystemComponentImpl instance = (SystemComponentImpl) ctx.getInstance(null); + Assert.assertNotNull(instance.getConfigContext()); + Assert.assertNotNull(instance.getParentContext()); + Assert.assertNotNull(instance.getAutowireContext()); + Assert.assertNotNull(instance.getConfigContextSetter()); + Assert.assertNotNull(instance.getParentContextSetter()); + Assert.assertNotNull(instance.getAutowireContextSetter()); + Assert.assertEquals(1, instance.getTestInt()); + Assert.assertEquals(1d, instance.getTestDouble()); + Assert.assertEquals(1f, instance.getTestFloat()); + Assert.assertEquals((short) 1, instance.getTestShort()); + Assert.assertTrue(instance.getTestBoolean()); + Assert.assertEquals('1', instance.getTestChar()); + Assert.assertEquals((byte) 1, instance.getTestByte()); + Assert.assertEquals("test", instance.getTestString()); + + Assert.assertTrue(instance.initialized()); + ctx.destroy(); + ctx.stop(); + Assert.assertTrue(instance.destroyed()); + } + + + public void testDefaultScopeIsModuleScope() throws Exception { + SystemContextFactoryBuilder builder = new SystemContextFactoryBuilder(null); + Component component = createSystemComponentWithNoScope("test", null, SystemComponentImpl.class); + builder.build(component); + ContextFactory contextFactory = (ContextFactory) component.getContextFactory(); + Assert.assertEquals(Scope.MODULE, contextFactory.getScope()); + } + + + + + private static CompositeContext createContext() { + return new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), new EventContextImpl(), + new MockConfigContext(null)); + } + + private Component createSystemComponentWithNoScope(String name, Class service, Class impl) { + JavaServiceContract jsc = factory.createJavaServiceContract(); + jsc.setInterface(service); + Service s = factory.createService(); + s.setServiceContract(jsc); + + ComponentType componentType = factory.createComponentType(); + componentType.getServices().add(s); + + SystemImplementation sysImpl = factory.createSystemImplementation(); + sysImpl.setImplementationClass(impl); + sysImpl.setComponentType(componentType); + + Component sc = factory.createSimpleComponent(); + sc.setName(name); + sc.setImplementation(sysImpl); + return sc; + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java new file mode 100644 index 0000000000..3d63664848 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/impl/AssemblyVisitorTestCase.java @@ -0,0 +1,136 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.builder.impl; + +import java.util.ArrayList; +import java.util.List; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.impl.AssemblyVisitorImpl; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.SystemBinding; +import org.apache.tuscany.core.system.assembly.SystemImplementation; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.ConfiguredPort; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.ContextFactoryHolder; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +/** + * Tests decorating a logical configuration model + * + * @version $Rev$ $Date$ + */ +public class AssemblyVisitorTestCase extends TestCase { + + private static final Object MARKER = new Object(); + + private SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl(); + private AssemblyContext assemblyContext = new AssemblyContextImpl(factory, null, null); + + public void testModelVisit() throws Exception { + ComponentType componentType; + Service service; + SystemImplementation impl; + Component component; + + Module module = factory.createModule(); + + // create target component + componentType = factory.createComponentType(); + service = factory.createService(); + service.setName("target"); + componentType.getServices().add(service); + impl = factory.createSystemImplementation(); + impl.setComponentType(componentType); + component = factory.createSimpleComponent(); + component.setName("target"); + component.setImplementation(impl); + component.initialize(assemblyContext); + module.getComponents().add(component); + + // create source component + componentType = factory.createComponentType(); + Reference ref = factory.createReference(); + ref.setName("ref"); + componentType.getReferences().add(ref); + impl = factory.createSystemImplementation(); + impl.setComponentType(componentType); + component = factory.createSimpleComponent(); + component.setName("source"); + component.setImplementation(impl); + ConfiguredReference cRef = factory.createConfiguredReference("ref", "target"); + component.getConfiguredReferences().add(cRef); + component.initialize(assemblyContext); + module.getComponents().add(component); + + EntryPoint ep = factory.createEntryPoint(); + JavaServiceContract contract = factory.createJavaServiceContract(); + contract.setInterface(ModuleScopeSystemComponent.class); + service = factory.createService(); + service.setServiceContract(contract); + ConfiguredService cService = factory.createConfiguredService(); + cService.setPort(service); + cService.initialize(assemblyContext); + ep.setConfiguredService(cService); + SystemBinding binding = factory.createSystemBinding(); + ep.getBindings().add(binding); + ConfiguredReference cEpRef = factory.createConfiguredReference(); + Reference epRef = factory.createReference(); + cEpRef.setPort(epRef); + ep.setConfiguredReference(cEpRef); + ep.initialize(assemblyContext); + module.getEntryPoints().add(ep); + + List builders = new ArrayList(); + builders.add(new TestBuilder()); + AssemblyVisitorImpl visitor = new AssemblyVisitorImpl(builders); + module.initialize(assemblyContext); + visitor.start(module); + + Assert.assertSame(MARKER, component.getContextFactory()); + Assert.assertSame(MARKER, cRef.getProxyFactory()); + Assert.assertSame(MARKER, ep.getContextFactory()); + Assert.assertSame(MARKER, cEpRef.getProxyFactory()); + + } + + private static class TestBuilder implements ContextFactoryBuilder { + public void build(AssemblyObject model) throws BuilderException { + if (model instanceof ConfiguredPort) { + ((ConfiguredPort) model).setProxyFactory(MARKER); + } + if (model instanceof ContextFactoryHolder) { + ((ContextFactoryHolder) model).setContextFactory(MARKER); + } + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java new file mode 100644 index 0000000000..6316fe3a67 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java @@ -0,0 +1,310 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.apache.tuscany.core.system.context; + +import junit.framework.TestCase; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.impl.CompositeContextImpl; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.mock.component.AutowireSourceImpl; +import org.apache.tuscany.core.mock.component.Source; +import org.apache.tuscany.core.mock.component.Target; +import org.apache.tuscany.core.mock.component.TargetImpl; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; + +/** + * Tests autowiring for serveral scenarios according to the following runtime scheme: + * + * + * tuscany.runtime + * | + * + tuscany.system + * | | + * | + system1 + * | | | + * | | + system1a + * | | + * | + system2 + * | + * + tuscany.root + * | + * + app1 + * | + * + app1a + * | + * + app1b + * + * + * @version $Rev$ $Date$ + */ +public class AutowireTestCase extends TestCase { + + private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); + + /** + * Covers the case where a component in app1a requests autowire, which is resolved by the runtime to a service + * exposed on an entry point in tuscany.system. The entry point is wired to an entry point on system1, which itself + * is wired to a component in system1 + */ + public void testScenario1() throws Exception { + RuntimeContext runtime = createScenario1Runtime(); + CompositeContext root = runtime.getRootContext(); + SystemCompositeContext system = runtime.getSystemContext(); + CompositeContext system1 = (CompositeContext) system.getContext("system1"); + system1.publish(new ModuleStart(this)); + Target target = (Target) system.getContext("target.system.ep").getInstance(null); + assertNotNull(target); + CompositeContext app1 = (CompositeContext) root.getContext("app1"); + app1.publish(new ModuleStart(this)); + CompositeContext app1a = (CompositeContext) app1.getContext("app1a"); + app1a.publish(new ModuleStart(this)); + app1a.publish(new ModuleStop(this)); + app1.publish(new ModuleStop(this)); + Source source = (Source) app1a.getContext("source").getInstance(null); + assertEquals(target, source.getTarget()); + source.getTarget().getString(); + runtime.stop(); + } + + /** + * Covers the case where a component in app1a requests autowire, which is resolved to service exposed as an entry + * point on app1b. The entry point is wired to a component in app1b. + */ + public void testScenario2() throws Exception { + RuntimeContext runtime = createScenario2Runtime(); + CompositeContext root = runtime.getRootContext(); + CompositeContext app1 = (CompositeContext) root.getContext("app1"); + app1.publish(new ModuleStart(this)); + CompositeContext app1b = (CompositeContext) app1.getContext("app1b"); + app1b.publish(new ModuleStart(this)); + CompositeContext app1a = (CompositeContext) app1.getContext("app1a"); + app1a.publish(new ModuleStart(this)); + Target target = (Target) app1b.getContext("target.ep").getInstance(null); + assertNotNull(target); + Source source = (Source) app1a.getContext("source").getInstance(null); + assertEquals(target, source.getTarget()); + source.getTarget().getString(); + runtime.stop(); + } + + /** + * Covers the case where a component in system1a requests autowire, which is resolved to an entry point exposed on + * system2. The entry point is wired to a component in system2. + */ + public void testScenario3() throws Exception { + RuntimeContext runtime = createScenario3Runtime(); + SystemCompositeContext system = runtime.getSystemContext(); + + CompositeContext system2 = (CompositeContext) system.getContext("system2"); + system2.publish(new ModuleStart(this)); + Target target = (Target) system2.getContext("target.ep").getInstance(null); + assertNotNull(target); + + CompositeContext system1 = (CompositeContext) system.getContext("system1"); + system1.publish(new ModuleStart(this)); + CompositeContext system1a = (CompositeContext) system1.getContext("system1a"); + system1a.publish(new ModuleStart(this)); + + Source source = (Source) system1a.getContext("source").getInstance(null); + assertEquals(target, source.getTarget()); + source.getTarget().getString(); + runtime.stop(); + } + + /** + * Covers the case where a component in system1a requests autowire, which is resolved to component in its parent, + * system1. + */ + public void testScenario4() throws Exception { + RuntimeContext runtime = createScenario4Runtime(); + SystemCompositeContext system = runtime.getSystemContext(); + CompositeContext system1 = (CompositeContext) system.getContext("system1"); + system1.publish(new ModuleStart(this)); + Target target = (Target) system1.getContext("target").getInstance(null); + assertNotNull(target); + CompositeContext system1a = (CompositeContext) system1.getContext("system1a"); + system1a.publish(new ModuleStart(this)); + + Source source = (Source) system1a.getContext("source").getInstance(null); + assertEquals(target, source.getTarget()); + source.getTarget().getString(); + runtime.stop(); + } + + /** + * Covers the case where a component in system1a requests autowire, which is resolved to component in the parent of + * its parent (grandparent), system. + */ + public void testScenario5() throws Exception { + RuntimeContext runtime = createScenario5Runtime(); + SystemCompositeContext system = runtime.getSystemContext(); + CompositeContext system1 = (CompositeContext) system.getContext("system1"); + system1.publish(new ModuleStart(this)); + Target target = (Target) system.getContext("target").getInstance(null); + assertNotNull(target); + CompositeContext system1a = (CompositeContext) system1.getContext("system1a"); + system1a.publish(new ModuleStart(this)); + + Source source = (Source) system1a.getContext("source").getInstance(null); + assertEquals(target, source.getTarget()); + source.getTarget().getString(); + runtime.stop(); + } + + private RuntimeContext createScenario1Runtime() throws Exception { + RuntimeContext runtime = MockFactory.createCoreRuntime(); + runtime.start(); + SystemCompositeContext system = runtime.getSystemContext(); + ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1"); + ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a"); + system1Component.getImplementation().getComponents().add(system1aComponent); + Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE); + system1Component.getImplementation().getComponents().add(target); + + EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target); + system1Component.getImplementation().getEntryPoints().add(ep); + system.registerModelObject(system1Component); + EntryPoint systemEp = MockFactory.createEPSystemBinding("target.system.ep", Target.class, "ref"); + + systemEp.getBindings().add(systemFactory.createSystemBinding()); + Service service = systemFactory.createService(); + service.setName("system1/target.ep"); + (systemEp.getConfiguredReference().getTargetConfiguredServices().get(0)).setPort(service); + + system.registerModelObject(systemEp); + ModuleComponent app1Component = createAppModuleComponent("app1"); + ModuleComponent app1aComponent = createAppModuleComponent("app1a"); + Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE); + app1aComponent.getImplementation().getComponents().add(source); + app1Component.getImplementation().getComponents().add(app1aComponent); + CompositeContext root = runtime.getRootContext(); + root.registerModelObject(app1Component); + system.publish(new ModuleStart(this)); + return runtime; + } + + private RuntimeContext createScenario2Runtime() throws Exception { + RuntimeContext runtime = MockFactory.createCoreRuntime(); + runtime.start(); + + ModuleComponent app1Component = createAppModuleComponent("app1"); + ModuleComponent app1aComponent = createAppModuleComponent("app1a"); + ModuleComponent app1bComponent = createAppModuleComponent("app1b"); + Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE); + app1aComponent.getImplementation().getComponents().add(source); + app1Component.getImplementation().getComponents().add(app1aComponent); + app1Component.getImplementation().getComponents().add(app1bComponent); + + Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE); + app1bComponent.getImplementation().getComponents().add(target); + + EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target); + ep.getBindings().add(systemFactory.createSystemBinding()); + Service service = systemFactory.createService(); + service.setName("target.ep"); + ep.getConfiguredReference().getTargetConfiguredServices().get(0).setPort(service); + app1bComponent.getImplementation().getEntryPoints().add(ep); + + CompositeContext root = runtime.getRootContext(); + root.registerModelObject(app1Component); + return runtime; + } + + private RuntimeContext createScenario3Runtime() throws Exception { + RuntimeContext runtime = MockFactory.createCoreRuntime(); + runtime.start(); + SystemCompositeContext system = runtime.getSystemContext(); + ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1"); + ModuleComponent system2Component = MockFactory.createSystemCompositeComponent("system2"); + ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a"); + system1Component.getImplementation().getComponents().add(system1aComponent); + + Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE); + system2Component.getImplementation().getComponents().add(target); + EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target); + system2Component.getImplementation().getEntryPoints().add(ep); + system.registerModelObject(system2Component); + + Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE); + system1aComponent.getImplementation().getComponents().add(source); + system.registerModelObject(system1Component); + system.publish(new ModuleStart(this)); + return runtime; + } + + private RuntimeContext createScenario4Runtime() throws Exception { + RuntimeContext runtime = MockFactory.createCoreRuntime(); + runtime.start(); + SystemCompositeContext system = runtime.getSystemContext(); + ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1"); + ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a"); + system1Component.getImplementation().getComponents().add(system1aComponent); + + Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE); + system1Component.getImplementation().getComponents().add(target); + + Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE); + system1aComponent.getImplementation().getComponents().add(source); + system.registerModelObject(system1Component); + system.publish(new ModuleStart(this)); + return runtime; + } + + private RuntimeContext createScenario5Runtime() throws Exception { + RuntimeContext runtime = MockFactory.createCoreRuntime(); + runtime.start(); + SystemCompositeContext system = runtime.getSystemContext(); + ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1"); + ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a"); + system1Component.getImplementation().getComponents().add(system1aComponent); + + Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE); + system.registerModelObject(target); + + Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE); + system1aComponent.getImplementation().getComponents().add(source); + system.registerModelObject(system1Component); + system.publish(new ModuleStart(this)); + return runtime; + } + + private ModuleComponent createAppModuleComponent(String name) throws ConfigurationLoadException { + AssemblyContext assemblyContext = new AssemblyContextImpl(systemFactory, null, null); + ModuleComponent mc = systemFactory.createModuleComponent(); + mc.setName(name); + Module module = systemFactory.createModule(); + module.setImplementationClass(CompositeContextImpl.class); + module.setComponentType(MockFactory.getComponentType()); + module.setName(name); + module.initialize(assemblyContext); + mc.setImplementation(module); + return mc; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java new file mode 100644 index 0000000000..27ffc5794e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java @@ -0,0 +1,98 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.mock.component.Source; +import org.apache.tuscany.core.mock.component.Target; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.Scope; + +/** + * Tests registering arbirarily deep child composite contexts + * + * @version $Rev$ $Date$ + */ +public class CompositeNestingTestCase extends TestCase { + + /** + * Tests registration of a 3-level deep hierarchy under the top-level system composite context + */ + public void testSystemContext() throws Exception { + RuntimeContext runtime = MockFactory.createCoreRuntime(); + ModuleComponent child1 = createHierarchy(); + runtime.getSystemContext().registerModelObject(child1); + CompositeContext child1Ctx = (CompositeContext) runtime.getSystemContext().getContext("child1"); + Assert.assertNotNull(child1Ctx); + child1Ctx.publish(new ModuleStart(this)); + analyzeLeafComponents(child1Ctx); + CompositeContext child2Ctx = (CompositeContext) child1Ctx.getContext("child2"); + Assert.assertNotNull(child2Ctx); + child2Ctx.publish(new ModuleStart(this)); + analyzeLeafComponents(child2Ctx); + CompositeContext child3Ctx = (CompositeContext) child2Ctx.getContext("child3"); + Assert.assertNotNull(child3Ctx); + child3Ctx.publish(new ModuleStart(this)); + analyzeLeafComponents(child3Ctx); + + Assert.assertNull(child1Ctx.getContext("child3")); // sanity check + } + + /** + * Tests registration of a 3-level deep hierarchy under the root application composite context + */ + public void testRootContext() throws Exception { + RuntimeContext runtime = MockFactory.createCoreRuntime(); + ModuleComponent child1 = createHierarchy(); + runtime.getRootContext().registerModelObject(child1); + CompositeContext child1Ctx = (CompositeContext) runtime.getRootContext().getContext("child1"); + Assert.assertNotNull(child1Ctx); + child1Ctx.publish(new ModuleStart(this)); + analyzeLeafComponents(child1Ctx); + CompositeContext child2Ctx = (CompositeContext) child1Ctx.getContext("child2"); + Assert.assertNotNull(child2Ctx); + child2Ctx.publish(new ModuleStart(this)); + analyzeLeafComponents(child2Ctx); + CompositeContext child3Ctx = (CompositeContext) child2Ctx.getContext("child3"); + Assert.assertNotNull(child3Ctx); + child3Ctx.publish(new ModuleStart(this)); + analyzeLeafComponents(child3Ctx); + + Assert.assertNull(child1Ctx.getContext("child3")); // sanity check + child1Ctx.publish(new ModuleStop(this)); + } + + private ModuleComponent createHierarchy() throws ConfigurationLoadException { + ModuleComponent child3 = MockFactory.createSystemModuleComponentWithWiredComponents("child3", Scope.MODULE, Scope.MODULE); + ModuleComponent child2 = MockFactory.createSystemModuleComponentWithWiredComponents("child2", Scope.MODULE, Scope.MODULE); + child2.getImplementation().getComponents().add(child3); + ModuleComponent child1 = MockFactory.createSystemModuleComponentWithWiredComponents("child1", Scope.MODULE, Scope.MODULE); + child1.getImplementation().getComponents().add(child2); + return child1; + } + + private void analyzeLeafComponents(CompositeContext ctx) throws Exception { + Source source = (Source) ctx.getContext("source").getInstance(null); + Assert.assertNotNull(source); + Target target = source.getTarget(); + Assert.assertNotNull(target); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/IntraCompositeWireTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/IntraCompositeWireTestCase.java new file mode 100644 index 0000000000..a956263cc8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/IntraCompositeWireTestCase.java @@ -0,0 +1,125 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.mock.MockConfigContext; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.mock.component.Source; +import org.apache.tuscany.core.mock.component.Target; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.List; + +/** + * Tests intra-composite system component wiring scenarios + * + * @version $Rev$ $Date$ + */ +public class IntraCompositeWireTestCase extends TestCase { + + public void testModuleToModuleScope() throws Exception { + SystemCompositeContext context = createContext(); + context.start(); + context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.MODULE)); + context.publish(new ModuleStart(this)); + Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); + Assert.assertNotNull(source); + Target targetRef = source.getTarget(); + Assert.assertNotNull(targetRef); + Target target = (Target) ((AtomicContext) context.getContext("target")).getTargetInstance(); + Assert.assertSame(target, targetRef); + Assert.assertSame(target, source.getTarget()); + context.publish(new ModuleStop(this)); + context.stop(); + } + + public void testStatelessToModuleScope() throws Exception { + SystemCompositeContext context = createContext(); + context.start(); + context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.INSTANCE, Scope.MODULE)); + context.publish(new ModuleStart(this)); + Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); + Assert.assertNotNull(source); + Target targetRef = source.getTarget(); + Assert.assertNotNull(targetRef); + source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); + Target target = (Target) ((AtomicContext) context.getContext("target")).getTargetInstance(); + Assert.assertSame(target, targetRef); + Assert.assertSame(target, source.getTarget()); + context.publish(new ModuleStop(this)); + context.stop(); + } + + public void testModuleToStatelessScope() throws Exception { + SystemCompositeContext context = createContext(); + context.start(); + context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.INSTANCE)); + context.publish(new ModuleStart(this)); + Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); + Assert.assertNotNull(source); + Target targetRef = source.getTarget(); + Assert.assertNotNull(targetRef); + Target target = (Target) ((AtomicContext) context.getContext("target")).getTargetInstance(); + Assert.assertNotSame(target, targetRef); + Source source2 = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); + // should be the same since the module scope component was alreadyy created and the stateless + // component will be "attached" to it + Assert.assertSame(source.getTarget(), source2.getTarget()); + context.publish(new ModuleStop(this)); + context.stop(); + } + + public void testMultiplicity() throws Exception { + SystemCompositeContext context = createContext(); + context.start(); + context.registerModelObject(MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.MODULE)); + context.publish(new ModuleStart(this)); + Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance(); + Assert.assertNotNull(source); + Target target = (Target) ((AtomicContext) context.getContext("target")).getTargetInstance(); + Assert.assertNotNull(target); + // test setter injection + List targets = source.getTargets(); + Assert.assertEquals(1,targets.size()); + assertSame(target,targets.get(0)); + + // test field injection + targets = source.getTargetsThroughField(); + Assert.assertEquals(1,targets.size()); + assertSame(target,targets.get(0)); + + // test array injection + Target[] targetArray = source.getArrayOfTargets(); + Assert.assertEquals(1,targetArray.length); + assertSame(target,targetArray[0]); + + + } + + private SystemCompositeContext createContext() { + SystemCompositeContextImpl context = new SystemCompositeContextImpl(); + context.setName("system.context"); + context.setConfigurationContext(new MockConfigContext(MockFactory.createSystemBuilders())); + return context; + } + + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeComponentContextTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeComponentContextTestCase.java new file mode 100644 index 0000000000..75208f47b6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeComponentContextTestCase.java @@ -0,0 +1,108 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" + * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.mock.MockConfigContext; +import org.apache.tuscany.core.mock.MockFactory; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent; +import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.Scope; + +import java.util.List; + +/** + * Tests the system composite context + * + * @version $Rev$ $Date$ + */ +public class SystemCompositeComponentContextTestCase extends TestCase { + private SystemAssemblyFactory factory; + private SystemCompositeContextImpl system; + + public void testChildLocate() throws Exception { + system.start(); + Component compositeComponent = MockFactory.createCompositeComponent("system.child"); + system.registerModelObject(compositeComponent); + CompositeContext childContext = (CompositeContext) system.getContext("system.child"); + Assert.assertNotNull(childContext); + + Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); + childContext.registerModelObject(component); + childContext.registerModelObject(ep); + childContext.publish(new ModuleStart(this)); + Assert.assertNotNull(system.getContext("system.child").getInstance(new QualifiedName("./TestService1EP"))); + childContext.publish(new ModuleStop(this)); + } + + public void testAutowireRegisterBeforeStart() throws Exception { + Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); + system.registerModelObject(component); + system.registerModelObject(ep); + system.start(); + system.publish(new ModuleStart(this)); + Assert.assertSame(system.getContext("TestService1EP").getInstance(null), system.resolveInstance(ModuleScopeSystemComponent.class)); + } + + public void testAutowireRegisterAfterStart() throws Exception { + Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE); + system.registerModelObject(component); + system.start(); + system.publish(new ModuleStart(this)); + EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component); + system.registerModelObject(ep); + Assert.assertSame(system.getContext("TestService1EP").getInstance(null), system.resolveInstance(ModuleScopeSystemComponent.class)); + } + + public void testAutowireModuleRegisterBeforeStart() throws Exception { + system.registerModelObject(MockFactory.createSystemModule()); + system.start(); + system.publish(new ModuleStart(this)); + Assert.assertSame(system.getContext("TestService1EP").getInstance(null), system.resolveInstance(ModuleScopeSystemComponent.class)); + } + + public void testAutowireModuleRegisterAfterStart() throws Exception { + system.start(); + system.publish(new ModuleStart(this)); + system.registerModelObject(MockFactory.createSystemModule()); + Assert.assertSame(system.getContext("TestService1EP").getInstance(null), system.resolveInstance(ModuleScopeSystemComponent.class)); + } + + protected void setUp() throws Exception { + super.setUp(); + factory = new SystemAssemblyFactoryImpl(); + List builders = MockFactory.createSystemBuilders(); + + system = new SystemCompositeContextImpl("system", null, null, new SystemScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders)); + } + + protected void tearDown() throws Exception { + system.publish(new ModuleStop(this)); + system.stop(); + super.tearDown(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeContextRegisterTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeContextRegisterTestCase.java new file mode 100644 index 0000000000..4397e39bec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeContextRegisterTestCase.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.context.CompositeContextRegisterTestCase; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; +import org.apache.tuscany.core.mock.MockConfigContext; +import org.apache.tuscany.core.mock.MockFactory; + +import java.util.List; + +/** + * Tests registration of model objects for an system composite context + * + * @version $Rev$ $Date$ + */ +public class SystemCompositeContextRegisterTestCase extends CompositeContextRegisterTestCase { + + protected CompositeContext createContext() { + List builders = MockFactory.createSystemBuilders(); + return new SystemCompositeContextImpl("test.context", null, null, new DefaultScopeStrategy(), new EventContextImpl(), new MockConfigContext(builders)); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeHierarchyTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeHierarchyTestCase.java new file mode 100644 index 0000000000..ba7a3ba5da --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemCompositeHierarchyTestCase.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import junit.framework.Assert; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.context.AbstractCompositeHierarchyTests; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.impl.EventContextImpl; +import org.apache.tuscany.core.context.scope.DefaultScopeStrategy; +import org.apache.tuscany.core.mock.MockConfigContext; +import org.apache.tuscany.core.mock.MockFactory; + +import java.util.List; + +/** + * Performs testing of various hierarchical scenarios + * + * @version $Rev$ $Date$ + */ +public class SystemCompositeHierarchyTestCase extends AbstractCompositeHierarchyTests { + + + + protected CompositeContext createContextHierachy() throws Exception { + List mockBuilders = MockFactory.createSystemBuilders(); + CompositeContext parent = new SystemCompositeContextImpl("test.parent", null, null, new DefaultScopeStrategy(), new EventContextImpl(), new MockConfigContext(mockBuilders)); + parent.registerModelObject(MockFactory.createCompositeComponent("test.child")); + parent.start(); + CompositeContext child = (CompositeContext) parent.getContext("test.child"); + Assert.assertNotNull(child); + return parent; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemObjectRegistrationTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemObjectRegistrationTestCase.java new file mode 100644 index 0000000000..241346e24f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/SystemObjectRegistrationTestCase.java @@ -0,0 +1,84 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import junit.framework.TestCase; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.DuplicateNameException; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.runtime.RuntimeContextImpl; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.common.monitor.MonitorFactory; +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; + +/** + * @version $Rev$ $Date$ + */ +public class SystemObjectRegistrationTestCase extends TestCase { + private RuntimeContext runtime; + private SystemCompositeContext systemContext; + + public void testRegistration() throws ConfigurationException { + MockComponent instance = new MockComponent(); + systemContext.registerJavaObject("foo", MockComponent.class, instance); + assertSame(instance, systemContext.getContext("foo").getInstance(null)); + } + + public void testDuplicateRegistration() throws ConfigurationException { + MockComponent instance = new MockComponent(); + systemContext.registerJavaObject("foo", MockComponent.class, instance); + try { + systemContext.registerJavaObject("foo", MockComponent.class, instance); + fail(); + } catch (DuplicateNameException e) { + // ok + } + } + + public void testAutowireToObject() throws ConfigurationException { + MockComponent instance = new MockComponent(); + systemContext.registerJavaObject("foo", MockComponent.class, instance); + assertSame(instance, systemContext.resolveInstance(MockComponent.class)); + assertNull(systemContext.resolveExternalInstance(MockComponent.class)); + } + + protected void setUp() throws Exception { + super.setUp(); + MonitorFactory monitorFactory = new NullMonitorFactory(); + ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); + DefaultWireBuilder wireBuilder = new DefaultWireBuilder(); + runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, wireBuilder); + runtime.start(); + systemContext = runtime.getSystemContext(); + systemContext.publish(new ModuleStart(this)); + } + + protected void tearDown() throws Exception { + runtime.stop(); + super.tearDown(); + } + + private static class MockComponent { + public String hello(String message) { + return message; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/TestBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/TestBuilder.java new file mode 100644 index 0000000000..c531c8f7f9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/TestBuilder.java @@ -0,0 +1,55 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.system.context; + +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +import org.apache.tuscany.core.builder.BuilderException; +import org.apache.tuscany.core.builder.ContextFactoryBuilder; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.system.annotation.Autowire; +import org.apache.tuscany.model.assembly.AssemblyObject; + +@Scope("MODULE") +public class TestBuilder implements ContextFactoryBuilder { + private ContextFactoryBuilderRegistry builderRegistry; + + private boolean invoked = false; + + public TestBuilder() { + super(); + } + + @Init(eager = true) + public void init() { + builderRegistry.register(this); + } + + @Autowire + public void setBuilderRegistry(ContextFactoryBuilderRegistry builderRegistry) { + this.builderRegistry = builderRegistry; + } + + public void build(AssemblyObject object) throws BuilderException { + invoked = true; + } + + public boolean invoked() { + return invoked; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java new file mode 100644 index 0000000000..5e4b3e2f9e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationErrorTestCase.java @@ -0,0 +1,155 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.wire.impl.InvokerInterceptor; +import org.apache.tuscany.core.wire.impl.MessageChannelImpl; +import org.apache.tuscany.core.wire.mock.MockHandler; +import org.apache.tuscany.core.wire.mock.SimpleTarget; +import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; +import org.apache.tuscany.core.wire.mock.SimpleTargetImpl; +import org.apache.tuscany.core.wire.mock.MockStaticInvoker; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; + +import java.lang.reflect.Method; + +/** + * Tests error propagation through an innvocation + * + * @version $Rev$ $Date$ + */ +public class InvocationConfigurationErrorTestCase extends TestCase { + + + private Method hello; + + private MessageFactory factory = new MessageFactoryImpl(); + + public InvocationConfigurationErrorTestCase() { + super(); + } + + public InvocationConfigurationErrorTestCase(String arg0) { + super(arg0); + } + + public void setUp() throws Exception { + hello = SimpleTarget.class.getMethod("hello", String.class); + } + + public void testInvokeWithHandlers() throws Exception{ + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockHandler sourceRequestHandler = new MockHandler(); + MockHandler sourceResponseHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addResponseHandler(sourceResponseHandler); + source.addInterceptor(sourceInterceptor); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockHandler targetResponseHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addResponseHandler(targetResponseHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + // connect the source to the target + source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); + source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); + source.build(); + target.build(); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = factory.createMessage(); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertTrue(response.getBody() instanceof IllegalArgumentException); + Assert.assertEquals(1,sourceRequestHandler.getCount()); + Assert.assertEquals(1,sourceResponseHandler.getCount()); + Assert.assertEquals(1,sourceInterceptor.getCount()); + Assert.assertEquals(1,targetRequestHandler.getCount()); + Assert.assertEquals(1,targetResponseHandler.getCount()); + Assert.assertEquals(1,targetInterceptor.getCount()); + } + + public void testInvokeWithRequestHandlers() throws Exception{ + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockHandler sourceRequestHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addInterceptor(sourceInterceptor); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + // connect the source to the target + source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); + source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); + source.build(); + target.build(); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = factory.createMessage(); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertTrue(response.getBody() instanceof IllegalArgumentException); + Assert.assertEquals(1,sourceRequestHandler.getCount()); + Assert.assertEquals(1,sourceInterceptor.getCount()); + Assert.assertEquals(1,targetRequestHandler.getCount()); + Assert.assertEquals(1,targetInterceptor.getCount()); + } + + /** + * Tests basic wiring of a source to a target, including handlers and interceptors + */ + public void testInvokeWithInterceptorsOnly() throws Exception{ + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addInterceptor(sourceInterceptor); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + // connect the source to the target + source.setTargetInterceptor(target.getHeadInterceptor()); + source.build(); + target.build(); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = factory.createMessage(); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertTrue(response.getBody() instanceof IllegalArgumentException); + Assert.assertEquals(1,sourceInterceptor.getCount()); + Assert.assertEquals(1,targetInterceptor.getCount()); + + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java new file mode 100644 index 0000000000..0519573439 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationConfigurationTestCase.java @@ -0,0 +1,153 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.wire.impl.InvokerInterceptor; +import org.apache.tuscany.core.wire.impl.MessageChannelImpl; +import org.apache.tuscany.core.wire.mock.SimpleTarget; +import org.apache.tuscany.core.wire.mock.MockHandler; +import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; +import org.apache.tuscany.core.wire.mock.MockStaticInvoker; +import org.apache.tuscany.core.wire.mock.SimpleTargetImpl; +import org.apache.tuscany.core.message.Message; +import org.apache.tuscany.core.message.MessageFactory; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; + +import java.lang.reflect.Method; + +public class InvocationConfigurationTestCase extends TestCase { + + private Method hello; + + + private MessageFactory factory = new MessageFactoryImpl(); + + public InvocationConfigurationTestCase() { + super(); + } + + public InvocationConfigurationTestCase(String arg0) { + super(arg0); + } + + public void setUp() throws Exception { + hello = SimpleTarget.class.getMethod("hello", String.class); + } + + /** + * Tests basic wiring of a source to a target, including handlers and interceptors + */ + public void testInvokeWithHandlers() throws Exception { + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockHandler sourceRequestHandler = new MockHandler(); + MockHandler sourceResponseHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addResponseHandler(sourceResponseHandler); + source.addInterceptor(sourceInterceptor); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockHandler targetResponseHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addResponseHandler(targetResponseHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + // connect the source to the target + source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); + source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); + source.build(); + target.build(); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = factory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, sourceRequestHandler.getCount()); + Assert.assertEquals(1, sourceResponseHandler.getCount()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetRequestHandler.getCount()); + Assert.assertEquals(1, targetResponseHandler.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + public void testInvokeWithRequestHandlers() throws Exception { + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockHandler sourceRequestHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addInterceptor(sourceInterceptor); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockHandler targetRequestHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + // connect the source to the target + source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); + source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); + source.build(); + target.build(); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = factory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, sourceRequestHandler.getCount()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetRequestHandler.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } + + /** + * Tests basic wiring of a source to a target, including handlers and interceptors + */ + public void testInvokeWithInterceptorsOnly() throws Exception { + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addInterceptor(sourceInterceptor); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(hello); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + // connect the source to the target + source.setTargetInterceptor(target.getHeadInterceptor()); + source.build(); + target.build(); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Message msg = factory.createMessage(); + msg.setBody("foo"); + msg.setTargetInvoker(invoker); + Message response = source.getHeadInterceptor().invoke(msg); + Assert.assertEquals("foo", response.getBody()); + Assert.assertEquals(1, sourceInterceptor.getCount()); + Assert.assertEquals(1, targetInterceptor.getCount()); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationErrorTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationErrorTestCase.java new file mode 100644 index 0000000000..1d04e18757 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/InvocationErrorTestCase.java @@ -0,0 +1,122 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.wire.impl.InvokerInterceptor; +import org.apache.tuscany.core.wire.jdk.JDKInvocationHandler; +import org.apache.tuscany.core.wire.mock.MockHandler; +import org.apache.tuscany.core.wire.mock.MockStaticInvoker; +import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Map; + +/** + * Tests handling of exceptions thrown during an wire + * + * @version $Rev: 377006 $ $Date: 2006-02-11 09:41:59 -0800 (Sat, 11 Feb 2006) $ + */ +public class InvocationErrorTestCase extends TestCase { + + private Method checkedMethod; + private Method runtimeMethod; + + public InvocationErrorTestCase() { + super(); + } + + public InvocationErrorTestCase(String arg0) { + super(arg0); + } + + public void setUp() throws Exception { + checkedMethod = TestBean.class.getDeclaredMethod("checkedException", (Class[]) null); + runtimeMethod = TestBean.class.getDeclaredMethod("runtimeException", (Class[]) null); + Assert.assertNotNull(checkedMethod); + Assert.assertNotNull(runtimeMethod); + } + + public void testCheckedException() throws Exception { + Map config = new MethodHashMap(); + config.put(checkedMethod, getConfiguration(checkedMethod)); + InvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), config); + try { + TestBean proxy = (TestBean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), + new Class[]{TestBean.class}, handler); + proxy.checkedException(); + } catch (TestException e) { + return; + } + Assert.fail(TestException.class.getName() + " should have been thrown"); + } + + public void testRuntimeException() throws Exception { + Map config = new MethodHashMap(); + config.put(runtimeMethod, getConfiguration(runtimeMethod)); + InvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), config); + try { + TestBean proxy = (TestBean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), + new Class[]{TestBean.class}, handler); + proxy.runtimeException(); + } catch (TestRuntimeException e) { + return; + } + Assert.fail(TestException.class.getName() + " should have been thrown"); + } + + private InvocationConfiguration getConfiguration(Method m) { + MockStaticInvoker invoker = new MockStaticInvoker(m, new TestBeanImpl()); + SourceInvocationConfiguration invocationConfiguration=new SourceInvocationConfiguration(m); + invocationConfiguration.addInterceptor(new MockSyncInterceptor()); + invocationConfiguration.addRequestHandler(new MockHandler()); + invocationConfiguration.setTargetInvoker(invoker); + invocationConfiguration.setTargetInterceptor(new InvokerInterceptor()); + invocationConfiguration.build(); + return invocationConfiguration; + } + + public interface TestBean { + + public void checkedException() throws TestException; + + public void runtimeException() throws TestRuntimeException; + + } + + public class TestBeanImpl implements TestBean { + + public void checkedException() throws TestException { + throw new TestException(); + } + + public void runtimeException() throws TestRuntimeException { + throw new TestRuntimeException(); + } + } + + public class TestException extends Exception { + } + + public class TestRuntimeException extends RuntimeException { + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java new file mode 100644 index 0000000000..28a2da23b5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInvocationHandlerTestCase.java @@ -0,0 +1,126 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.jdk; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.wire.InvocationConfiguration; +import org.apache.tuscany.core.wire.MethodHashMap; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.mock.SimpleTarget; +import org.apache.tuscany.core.wire.mock.SimpleTargetImpl; +import org.apache.tuscany.core.wire.mock.MockStaticInvoker; +import org.apache.tuscany.core.wire.mock.MockHandler; +import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; +import org.apache.tuscany.core.wire.impl.InvokerInterceptor; +import org.apache.tuscany.core.wire.impl.MessageChannelImpl; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; + +import java.lang.reflect.Method; +import java.util.Map; + +public class JDKInvocationHandlerTestCase extends TestCase { + + private Method hello; + + public JDKInvocationHandlerTestCase() { + super(); + } + + public JDKInvocationHandlerTestCase(String arg0) { + super(arg0); + } + + public void setUp() throws Exception { + hello = SimpleTarget.class.getMethod("hello", String.class); + } + + public void testBasicInvoke() throws Throwable { + Map configs = new MethodHashMap(); + configs.put(hello, getInvocationHandler(hello)); + JDKInvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), configs); + Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] { "foo" })); + } + + public void testErrorInvoke() throws Throwable { + Map configs = new MethodHashMap(); + configs.put(hello, getInvocationHandler(hello)); + JDKInvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), configs); + try { + Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] {})); + fail("Expected " + IllegalArgumentException.class.getName()); + } catch (IllegalArgumentException e) { + // should throw + } + } + + public void testDirectErrorInvoke() throws Throwable { + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Map configs = new MethodHashMap(); + configs.put(hello, source); + JDKInvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), configs); + try { + Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] {})); + fail("Expected " + IllegalArgumentException.class.getName()); + } catch (IllegalArgumentException e) { + // should throw + } + } + + public void testDirectInvoke() throws Throwable { + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + + Map configs = new MethodHashMap(); + configs.put(hello, source); + JDKInvocationHandler handler = new JDKInvocationHandler(new MessageFactoryImpl(), configs); + Assert.assertEquals("foo", handler.invoke(null, hello, new Object[] { "foo" })); + } + + private InvocationConfiguration getInvocationHandler(Method m) { + SourceInvocationConfiguration source = new SourceInvocationConfiguration(m); + MockHandler sourceRequestHandler = new MockHandler(); + MockHandler sourceResponseHandler = new MockHandler(); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addRequestHandler(sourceRequestHandler); + source.addResponseHandler(sourceResponseHandler); + source.addInterceptor(sourceInterceptor); + + TargetInvocationConfiguration target = new TargetInvocationConfiguration(m); + MockHandler targetRequestHandler = new MockHandler(); + MockHandler targetResponseHandler = new MockHandler(); + MockSyncInterceptor targetInterceptor = new MockSyncInterceptor(); + target.addRequestHandler(targetRequestHandler); + target.addResponseHandler(targetResponseHandler); + target.addInterceptor(targetInterceptor); + target.addInterceptor(new InvokerInterceptor()); + + // connect the source to the target + source.setTargetRequestChannel(new MessageChannelImpl(target.getRequestHandlers())); + source.setTargetResponseChannel(new MessageChannelImpl(target.getResponseHandlers())); + source.build(); + target.build(); + MockStaticInvoker invoker = new MockStaticInvoker(m, new SimpleTargetImpl()); + source.setTargetInvoker(invoker); + return source; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactoryTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactoryTestCase.java new file mode 100644 index 0000000000..60f8cf837d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKWireFactoryFactoryTestCase.java @@ -0,0 +1,83 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.core.wire.jdk; + +import junit.framework.Assert; +import junit.framework.TestCase; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.wire.MethodHashMap; +import org.apache.tuscany.core.wire.WireSourceConfiguration; +import org.apache.tuscany.core.wire.SourceInvocationConfiguration; +import org.apache.tuscany.core.wire.TargetInvocationConfiguration; +import org.apache.tuscany.core.wire.WireTargetConfiguration; +import org.apache.tuscany.core.wire.impl.InvokerInterceptor; +import org.apache.tuscany.core.wire.mock.MockStaticInvoker; +import org.apache.tuscany.core.wire.mock.MockSyncInterceptor; +import org.apache.tuscany.core.wire.mock.SimpleTarget; +import org.apache.tuscany.core.wire.mock.SimpleTargetImpl; +import org.apache.tuscany.core.message.impl.MessageFactoryImpl; + +import java.lang.reflect.Method; +import java.util.Map; + +public class JDKWireFactoryFactoryTestCase extends TestCase { + + private Method hello; + + public JDKWireFactoryFactoryTestCase(String arg0) { + super(arg0); + } + + public void setUp() throws Exception { + hello = SimpleTarget.class.getMethod("hello", String.class); + } + + public void testSourceWireFactory() throws Exception { + SourceInvocationConfiguration source = new SourceInvocationConfiguration(hello); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addInterceptor(sourceInterceptor); + source.setTargetInterceptor(new InvokerInterceptor()); + source.setTargetInvoker(new MockStaticInvoker(hello, new SimpleTargetImpl())); + source.build(); + Map configs = new MethodHashMap(); + configs.put(hello, source); + WireSourceConfiguration config = new WireSourceConfiguration("foo",new QualifiedName("foo"), configs, Thread.currentThread() + .getContextClassLoader(), new MessageFactoryImpl()); + JDKSourceWireFactory factory = new JDKSourceWireFactory(); + factory.setConfiguration(config); + factory.setBusinessInterface(SimpleTarget.class); + factory.initialize(); + SimpleTarget instance = (SimpleTarget) factory.createProxy(); + Assert.assertEquals("foo",instance.hello("foo")); + } + + public void testTargetWireFactory() throws Exception { + TargetInvocationConfiguration source = new TargetInvocationConfiguration(hello); + MockSyncInterceptor sourceInterceptor = new MockSyncInterceptor(); + source.addInterceptor(sourceInterceptor); + source.addInterceptor(new InvokerInterceptor()); + source.setTargetInvoker(new MockStaticInvoker(hello, new SimpleTargetImpl())); + source.build(); + Map configs = new MethodHashMap(); + configs.put(hello, source); + WireTargetConfiguration config = new WireTargetConfiguration(new QualifiedName("foo"), configs, Thread.currentThread() + .getContextClassLoader(), new MessageFactoryImpl()); + JDKTargetWireFactory factory = new JDKTargetWireFactory(); + factory.setConfiguration(config); + factory.setBusinessInterface(SimpleTarget.class); + factory.initialize(); + SimpleTarget instance = (SimpleTarget) factory.createProxy(); + Assert.assertEquals("foo",instance.hello("foo")); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockHandler.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockHandler.java new file mode 100644 index 0000000000..9def6b5b0e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockHandler.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.mock; + +import org.apache.tuscany.core.wire.MessageHandler; +import org.apache.tuscany.core.message.Message; + +/** + * + */ +public class MockHandler implements MessageHandler { + + private int count =0; + + public boolean processMessage(Message message) { + //System.out.println("Invoking handler"); + count++; + return true; + } + + public int getCount(){ + return count; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockScopeContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockScopeContext.java new file mode 100644 index 0000000000..915885549a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockScopeContext.java @@ -0,0 +1,131 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.mock; + +import org.apache.tuscany.core.builder.ContextFactory; +import org.apache.tuscany.core.context.ScopeContext; +import org.apache.tuscany.core.context.RuntimeEventListener; +import org.apache.tuscany.core.context.ContextRuntimeException; +import org.apache.tuscany.core.context.AtomicContext; +import org.apache.tuscany.core.context.ScopeRuntimeException; +import org.apache.tuscany.core.context.QualifiedName; +import org.apache.tuscany.core.context.Context; +import org.apache.tuscany.core.context.EventFilter; +import org.apache.tuscany.core.context.event.Event; +import org.apache.tuscany.model.assembly.AtomicComponent; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MockScopeContext implements ScopeContext { + + Map components; + + public MockScopeContext() { + components = new HashMap(); + components.put("foo", new SimpleTargetImpl()); + components.put("bar", new SimpleTargetImpl()); + } + + public MockScopeContext(Map instances) { + components = instances; + } + + + public void start() { + } + + public void stop() { + } + + public void publish(Event object) { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void addListener(RuntimeEventListener listener) throws ContextRuntimeException { + } + + public void addListener(EventFilter filter, RuntimeEventListener listener) { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void removeListener(RuntimeEventListener listener) throws ContextRuntimeException { + } + + public String getName() { + return "Mock Scope Container"; + } + + public boolean isCacheable() { + return false; + } + + public int[] getEventTypes() { + return null; + } + + public AtomicContext getContext(String name) { + return null; + } + + public Object getInstance(QualifiedName name) throws ScopeRuntimeException { + return components.get(name.getPartName()); + } + + public AtomicContext getContextByKey(String name, Object key) { + return null; + } + + public void setComponent(AtomicComponent component) throws ScopeRuntimeException { + } + + public void removeContext(String name) throws ScopeRuntimeException { + } + + public void removeContextByKey(String name, Object key) throws ScopeRuntimeException { + } + + public AtomicComponent[] getComponents() { + return null; + } + + + public void registerFactories(List> configurations) { + } + + public void registerFactory(ContextFactory configuration) { + } + + public int getLifecycleState(){ + return RUNNING; + } + + + public void setLifecycleState(int state) { + } + + + public void setName(String name) { + } + + + public void onEvent(Event event) { + //To change body of implemented methods use File | Settings | File Templates. + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockStaticInvoker.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockStaticInvoker.java new file mode 100644 index 0000000000..66e8579cb4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockStaticInvoker.java @@ -0,0 +1,86 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.mock; + +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.wire.InvocationRuntimeException; +import org.apache.tuscany.core.wire.TargetInvoker; +import org.apache.tuscany.core.message.Message; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * Caches component instances that do not need to be resolved for every wire, e.g. an wire originating from + * a lesser scope intended for a target with a wider scope + * + * @version $Rev: 377006 $ $Date: 2006-02-11 09:41:59 -0800 (Sat, 11 Feb 2006) $ + */ +public class MockStaticInvoker implements TargetInvoker { + + private Object instance; + + private Method operation; + + public MockStaticInvoker(Method operation, Object instance) { + this.operation = operation; + this.instance = instance; + } + + public boolean isCacheable() { + return true; + } + + public Object invokeTarget(Object payload) throws InvocationTargetException { + try { + if (payload != null && !payload.getClass().isArray()) { + return operation.invoke(instance, payload); + } else { + return operation.invoke(instance, (Object[]) payload); + } + } catch (IllegalAccessException e) { + throw new InvocationRuntimeException(e); + } + } + + public Message invoke(Message msg) { + try { + Object resp = invokeTarget(msg.getBody()); + msg.setBody(resp); + } catch (InvocationTargetException e) { + msg.setBody(e.getCause()); + } catch (Throwable e) { + msg.setBody(e); + } + return msg; + } + + public void setNext(Interceptor next) { + throw new IllegalStateException("This interceptor must be the last interceptor in an interceptor chain"); + } + + public Object clone() throws CloneNotSupportedException { + try { + MockStaticInvoker invoker = (MockStaticInvoker) super.clone(); + invoker.instance = this.instance; + invoker.operation = this.operation; + return invoker; + } catch (CloneNotSupportedException e) { + return null; // will not happen + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockSyncInterceptor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockSyncInterceptor.java new file mode 100644 index 0000000000..a64caed8eb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockSyncInterceptor.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.mock; + +import org.apache.tuscany.core.wire.Interceptor; +import org.apache.tuscany.core.message.Message; + +public class MockSyncInterceptor implements Interceptor { + + private int count; + + private Interceptor next; + + public MockSyncInterceptor() { + } + + public Message invoke(Message msg) { + ++count; + //System.out.println("Invoking interceptor"); + return next.invoke(msg); + } + + public int getCount() { + return count; + } + + public void setNext(Interceptor next) { + this.next=next; + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSource.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSource.java new file mode 100644 index 0000000000..8e8af9ec18 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSource.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.mock; + +public interface SimpleSource { + + public void invokeHello() throws Exception; + + public void invokeGoodbye() throws Exception; +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSourceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSourceImpl.java new file mode 100644 index 0000000000..900fa9c324 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSourceImpl.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.mock; + +public class SimpleSourceImpl implements SimpleSource { + + private SimpleTarget proxy; + + public SimpleSourceImpl(SimpleTarget proxy) { + this.proxy = proxy; + } + + public void invokeHello() throws Exception { + proxy.hello("hello"); + } + + public void invokeGoodbye() throws Exception { + proxy.goodbye("hello"); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTarget.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTarget.java new file mode 100644 index 0000000000..d63d3a0565 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTarget.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.mock; + +public interface SimpleTarget { + + public String hello(String message) throws Exception; + + public String goodbye(String message) throws Exception; + + public String echo(String message) throws Exception; + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTargetImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTargetImpl.java new file mode 100644 index 0000000000..1b6fe93ac8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTargetImpl.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.core.wire.mock; + +public class SimpleTargetImpl implements SimpleTarget { + + public SimpleTargetImpl() { + super(); + } + + public String hello(String message) throws Exception { + return message; + } + + public String goodbye(String message) throws Exception { + return message; + } + + public String echo(String message) throws Exception { + return message; + } + + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/config/ModuleComponentLoaderTest1.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/config/ModuleComponentLoaderTest1.module new file mode 100644 index 0000000000..b261cbe6c0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/config/ModuleComponentLoaderTest1.module @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.wsdl new file mode 100644 index 0000000000..3a23e7b717 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.wsdl @@ -0,0 +1,23 @@ + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.xsd new file mode 100644 index 0000000000..e34b6e92e0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/example.xsd @@ -0,0 +1,23 @@ + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/interfacestyles.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/interfacestyles.wsdl new file mode 100644 index 0000000000..eeab33193d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/org/apache/tuscany/core/loader/assembly/interfacestyles.wsdl @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/system.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/system.fragment new file mode 100644 index 0000000000..74d04561cd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/core/src/test/resources/system.fragment @@ -0,0 +1,21 @@ + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/pom.xml new file mode 100644 index 0000000000..d7f337a955 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/pom.xml @@ -0,0 +1,36 @@ + + + + + + org.apache.tuscany + tuscany-sca + incubating-M1 + + + 4.0.0 + org.apache.tuscany.databinding + tuscany-databinding + pom + Tuscany SCA Data Bindings + incubating-M1 + + + sdo + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/pom.xml new file mode 100644 index 0000000000..635711f294 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/pom.xml @@ -0,0 +1,46 @@ + + + + + + org.apache.tuscany.databinding + tuscany-databinding + incubating-M1 + + + 4.0.0 + tuscany-databinding-sdo + Tuscany Data Binding based on SDO + Data Binding based on SDO. + incubating-M1 + + + + org.apache.tuscany + tuscany-core + ${pom.version} + compile + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java new file mode 100644 index 0000000000..519d256036 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/ImportSDOLoader.java @@ -0,0 +1,106 @@ +/** + * + * Copyright 2006 The Apache Software Foundation or its licensors as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.databinding.sdo; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import commonj.sdo.helper.XSDHelper; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.SidefileLoadException; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.StAXUtil; +import org.apache.tuscany.core.loader.assembly.AbstractLoader; +import org.apache.tuscany.core.loader.assembly.AssemblyConstants; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.osoa.sca.annotations.Scope; + +/** + * Loader that handles <import.sdo> elements. + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class ImportSDOLoader extends AbstractLoader { + public static final QName IMPORT_SDO = new QName(AssemblyConstants.SCA_NAMESPACE, "import.sdo"); + + public QName getXMLType() { + return IMPORT_SDO; + } + + public AssemblyObject load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException { + assert IMPORT_SDO.equals(reader.getName()); + importFactory(reader, loaderContext); + importWSDLOrXSD(reader, loaderContext); + StAXUtil.skipToEndElement(reader); + return null; + } + + private void importFactory(XMLStreamReader reader, LoaderContext loaderContext) throws ConfigurationLoadException { + String factoryName = reader.getAttributeValue(null, "factory"); + if (factoryName != null) { + ResourceLoader resourceLoader = loaderContext.getResourceLoader(); + ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); + try { + // set TCCL as SDO needs it + Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader()); + Class factoryClass = resourceLoader.loadClass(factoryName); + SDOUtil.registerStaticTypes(factoryClass); + } catch (ClassNotFoundException e) { + throw new ConfigurationLoadException(e.getMessage(), e); + } finally { + Thread.currentThread().setContextClassLoader(oldCL); + } + } + } + + @SuppressWarnings("deprecation") + private void importWSDLOrXSD(XMLStreamReader reader, LoaderContext loaderContext) throws ConfigurationLoadException { + String location = reader.getAttributeValue(null, "wsdlLocation"); + if (location == null) + location = reader.getAttributeValue(null, "schemaLocation"); + if (location != null) { + ResourceLoader resourceLoader = loaderContext.getResourceLoader(); + URL wsdlURL = resourceLoader.getResource(location); + ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); + try { +// Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader()); + InputStream xsdInputStream = wsdlURL.openStream(); + try { + AssemblyContext context = registry.getContext(); + XSDHelper xsdHelper = SDOUtil.createXSDHelper(context.getTypeHelper()); + xsdHelper.define(xsdInputStream, null); + } finally { + xsdInputStream.close(); + } + } catch (IOException e) { + SidefileLoadException sfe = new SidefileLoadException(e.getMessage()); + sfe.setResourceURI(location); + throw sfe; + } finally { + Thread.currentThread().setContextClassLoader(oldCL); + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java new file mode 100644 index 0000000000..0f0cc13fd8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOObjectFactory.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.databinding.sdo; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.CopyHelper; +import org.apache.tuscany.core.builder.ObjectFactory; +import org.apache.tuscany.core.injection.ObjectCreationException; + +/** + * Creates new instances of an SDO + * + * @version $Rev$ $Date$ + */ +public class SDOObjectFactory implements ObjectFactory { + + private DataObject dataObject; + + public SDOObjectFactory(DataObject dataObject) { + this.dataObject = dataObject; + } + + public DataObject getInstance() throws ObjectCreationException { + return CopyHelper.INSTANCE.copy(dataObject); + } + + public void releaseInstance(DataObject instance) { + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java new file mode 100644 index 0000000000..d732676c76 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOXMLHelper.java @@ -0,0 +1,264 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.databinding.sdo; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.core.wire.InvocationRuntimeException; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.osoa.sca.ServiceRuntimeException; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLDocument; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; + +/** + * Utility methods to convert between XML byte arrays, SDO DataObjects, and Java objects. + * + * Most of these methods rely on the schemas having been registered with XSDHelper.define + */ +public final class SDOXMLHelper { + + private SDOXMLHelper() { + // utility class, never contructed + } + + /** + * Deserialize an XML byte array into Java Objects + * + * @param xmlBytes + * the byte array containing the XML + * @param isWrapped + * + * @return the array of deserialized Java objects + * @deprecated TUSCANY-333 use the method that takes a ClassLoader + */ + public static Object[] toObjects(TypeHelper typeHelper, byte[] xmlBytes, boolean isWrapped) { + DataObject dataObject = toDataObject(typeHelper, xmlBytes); + return toObjects(dataObject, isWrapped); + } + + /** + * Convert a typed DataObject to Java objects + * + * @param dataObject + * @param isWrapped + * @return the array of Objects from the DataObject + */ + public static Object[] toObjects(DataObject dataObject, boolean isWrapped) { + if (isWrapped) { + List ips = dataObject.getInstanceProperties(); + Object[] os = new Object[ips.size()]; + for (int i = 0; i < ips.size(); i++) { + os[i] = dataObject.get((Property) ips.get(i)); + } + return os; + } else { + Object object = dataObject; + Type type = dataObject.getType(); + if (type.isSequenced()) { + object = dataObject.getSequence().getValue(0); + } + return new Object[] { object }; + } + } + + /** + * Serializes objects to an XML byte array + * + * @param os + * @param typeNS + * @param typeName + * @return a byte array containing the XML + * @deprecated TUSCANY-333 use the method that takes a ClassLoader + */ + public static byte[] toXMLBytes(TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) { + DataObject dataObject = toDataObject(typeHelper, os, elementQName, isWrapped); + return toXMLbytes(typeHelper, dataObject, elementQName); + } + + /** + * Convert a DataObject to an XML byte array + * + * @param dataObject + * @param typeNS + * @param typeName + * @return a byte array containing the XML bytes + * @deprecated TUSCANY-333 use the method that takes a ClassLoader + */ + public static byte[] toXMLbytes(TypeHelper typeHelper, DataObject dataObject, QName elementQName) { + try { + + ByteArrayOutputStream pos = new ByteArrayOutputStream(); + XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper); + xmlHelper.save(dataObject, elementQName.getNamespaceURI(), elementQName.getLocalPart(), pos); + pos.close(); + + return pos.toByteArray(); + + } catch (IOException e) { + throw new ServiceRuntimeException(e); + } + } + + /** + * Deserialize an XML byte array into a DataObject + * + * @param xmlBytes + * @return a DataObject + * @deprecated TUSCANY-333 use the method that takes a ClassLoader + */ + public static DataObject toDataObject(TypeHelper typeHelper, byte[] xmlBytes) { + try { + + XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper); + XMLDocument document = xmlHelper.load(new ByteArrayInputStream(xmlBytes)); + + return document.getRootObject(); + + } catch (IOException e) { + throw new ServiceRuntimeException(e); + } + } + + /** + * Convert objects to typed DataObject + * + * @param typeNS + * @param typeName + * @param os + * @return the DataObject + * @deprecated TUSCANY-333 use the method that takes a ClassLoader + */ + public static DataObject toDataObject(TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) { + XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper); + + Property property = xsdHelper.getGlobalProperty(elementQName.getNamespaceURI(), elementQName.getLocalPart(), true); + if (null == property) { + throw new InvocationRuntimeException("Type '" + elementQName.toString() + "' not found in registered SDO types."); + } + if (isWrapped) { + DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper); + DataObject dataObject = dataFactory.create(property.getType()); + List ips = dataObject.getInstanceProperties(); + for (int i = 0; i < ips.size(); i++) { + dataObject.set(i, os[i]); + } + return dataObject; + } else { + Object value = os[0]; + Type type = property.getType(); + if (!type.isDataType()) { + return (DataObject) value; + } else { + return SDOUtil.createDataTypeWrapper(type, value); + } + } + } + +// --- + + public static DataObject toDataObject(ClassLoader classLoader, TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(classLoader); + } + + return toDataObject(typeHelper, os, elementQName, isWrapped); + + } finally { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(tccl); + } + } + } + + public static DataObject toDataObject(ClassLoader classLoader, TypeHelper typeHelper, byte[] xmlBytes) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(classLoader); + } + + return toDataObject(typeHelper, xmlBytes); + + } finally { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(tccl); + } + } + } + + public static byte[] toXMLbytes(ClassLoader classLoader, TypeHelper typeHelper, DataObject dataObject, QName elementQName) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(classLoader); + } + + return toXMLbytes(typeHelper, dataObject, elementQName); + + } finally { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(tccl); + } + } + } + + public static byte[] toXMLBytes(ClassLoader classLoader, TypeHelper typeHelper, Object[] os, QName elementQName, boolean isWrapped) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(classLoader); + } + + return toXMLBytes(typeHelper, os, elementQName, isWrapped); + + } finally { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(tccl); + } + } + } + + public static Object[] toObjects(ClassLoader classLoader, TypeHelper typeHelper, byte[] xmlBytes, boolean isWrapped) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(classLoader); + } + + return toObjects(typeHelper, xmlBytes, isWrapped); + + } finally { + if (tccl != classLoader) { + Thread.currentThread().setContextClassLoader(tccl); + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/system.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/system.fragment new file mode 100644 index 0000000000..a963af3e2e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/main/resources/system.fragment @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java new file mode 100644 index 0000000000..31815a97b4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/ImportSDOLoaderTestCase.java @@ -0,0 +1,59 @@ +/** + * + * Copyright 2006 The Apache Software Foundation or its licensors as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.databinding.sdo; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.core.config.ConfigurationLoadException; + +/** + * @version $Rev$ $Date$ + */ +public class ImportSDOLoaderTestCase extends LoaderTestSupport { + private ImportSDOLoader loader; + + public void testMinimal() throws XMLStreamException, ConfigurationLoadException { + String xml = ""; + XMLStreamReader reader = getReader(xml); + assertNull(loader.load(reader, null)); + } + + public void testFactory() throws XMLStreamException, ConfigurationLoadException { + String xml = ""; + XMLStreamReader reader = getReader(xml); + assertFalse(inited); + assertNull(loader.load(reader, loaderContext)); + assertTrue(inited); + } + + protected void setUp() throws Exception { + super.setUp(); + loader = new ImportSDOLoader(); + } + + private static boolean inited = false; + + public static class MockFactory { + public static Object INSTANCE; + + static { + ImportSDOLoaderTestCase.inited = true; + } + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java new file mode 100644 index 0000000000..821a7220dd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/LoaderTestSupport.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2006 The Apache Software Foundation or its licensors as applicable + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.databinding.sdo; + +import java.io.StringReader; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamException; +import javax.xml.namespace.QName; + +import junit.framework.TestCase; +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; +import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; +import org.apache.tuscany.core.loader.LoaderContext; +import org.apache.tuscany.core.loader.assembly.*; +import org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; + +/** + * Base class for loader tests with common fixture elements. + * + * @version $Rev$ $Date$ + */ +public abstract class LoaderTestSupport extends TestCase { + protected SystemAssemblyFactory assemblyFactory; + protected ResourceLoader resourceLoader; + protected LoaderContext loaderContext; + protected AssemblyContext modelContext; + protected XMLInputFactory xmlFactory; + protected StAXLoaderRegistryImpl registry; + + protected static final StAXLoaderRegistryImpl.Monitor NULL_MONITOR = new StAXLoaderRegistryImpl.Monitor() { + public void registeringLoader(QName xmlType) { + } + + public void unregisteringLoader(QName xmlType) { + } + + public void elementLoad(QName xmlType) { + } + }; + + protected void setUp() throws Exception { + super.setUp(); + assemblyFactory = new SystemAssemblyFactoryImpl(); + resourceLoader = new ResourceLoaderImpl(getClass().getClassLoader()); + loaderContext = new LoaderContext(resourceLoader); + modelContext = new AssemblyContextImpl(assemblyFactory, null, resourceLoader); + xmlFactory = XMLInputFactory.newInstance(); + registry = new StAXLoaderRegistryImpl(); + registry.setMonitor(org.apache.tuscany.databinding.sdo.LoaderTestSupport.NULL_MONITOR); + } + + protected XMLStreamReader getReader(String xml) throws XMLStreamException { + XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml)); + reader.next(); + return reader; + } + + protected void registerLoader(AbstractLoader loader) { + loader.setFactory(assemblyFactory); + loader.setRegistry(registry); + loader.start(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java new file mode 100644 index 0000000000..b72fa93046 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/java/org/apache/tuscany/databinding/sdo/SDOXMLHelperTestCase.java @@ -0,0 +1,141 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.databinding.sdo; + +import java.net.URL; + +import javax.xml.namespace.QName; + +import junit.framework.TestCase; + +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XSDHelper; + +public class SDOXMLHelperTestCase extends TestCase { + + private TypeHelper typeHelper; + + public static final QName GREETING_QN = new QName("http://helloworldaxis.samples.tuscany.apache.org", "getGreetings"); + + private static final String GREETING_NAME = "petra"; + + private static final String GREETING_XML = "petra"; + + private DataObject greetingDOB; + + private byte[] greetingXML; + + private ClassLoader appCL; + + public static final QName DOCLIT_QN = new QName("http://www.example.org/creditscore/doclit/", "getCreditScoreRequest"); + + // private static final Object[] CUSTOMER = { "111-22-3333", "John", "Smith" }; + + private DataObject nonWrappedDOB; + + public void testXMLBytes1() { + byte[] xmlBytes = SDOXMLHelper.toXMLbytes(appCL, typeHelper, greetingDOB, GREETING_QN); + assertNotNull(xmlBytes); + assertTrue(new String(xmlBytes).contains("petra")); + } + + public void testXMLBytes2() { + byte[] xmlBytes = SDOXMLHelper.toXMLBytes(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true); + assertNotNull(xmlBytes); + assertTrue(new String(xmlBytes).contains(GREETING_XML)); + } + + // TODO: nonwrapped doesn't work + // public void testXMLBytes3() { + // byte[] xmlBytes = SDOXMLHelper.toXMLBytes(typeHelper, CUSTOMER, DOCLIT_QN, false); + // assertNotNull(xmlBytes); + // assertTrue(new String(xmlBytes).contains(DOC_LIT_XML)); + // } + + public void testToDataObject1() { + DataObject dataObject = SDOXMLHelper.toDataObject(appCL, typeHelper, greetingXML); + assertNotNull(dataObject); + assertEquals(GREETING_NAME, dataObject.getString(0)); + } + + public void testToDataObject2() { + DataObject dataObject = SDOXMLHelper.toDataObject(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true); + assertNotNull(dataObject); + assertEquals(GREETING_NAME, dataObject.getString(0)); + } + + // TODO: nonwrapped doesn't work + // public void testToDataObject3() { + // DataObject dataObject = SDOXMLHelper.toDataObject(typeHelper, CUSTOMER, DOCLIT_QN, false); + // assertNotNull(dataObject); + // assertEquals(CUSTOMER[0], dataObject.getString(0)); + // assertEquals(CUSTOMER[1], dataObject.getString(1)); + // assertEquals(CUSTOMER[2], dataObject.getString(2)); + // } + + public void testToObjects1() { + Object[] os = SDOXMLHelper.toObjects(appCL, typeHelper, greetingXML, true); + assertNotNull(os); + assertEquals(1, os.length); + assertEquals(GREETING_NAME, os[0]); + } + + public void testToObjects2() { + Object[] os = SDOXMLHelper.toObjects(greetingDOB, true); + assertNotNull(os); + assertEquals(1, os.length); + assertEquals(GREETING_NAME, os[0]); + } + + public void testToObjects3() { + Object[] os = SDOXMLHelper.toObjects(nonWrappedDOB, false); + assertNotNull(os); + // assertEquals(3, os.length); TODO: non-wrapped doesn't seem to work + } + + protected void setUp() throws Exception { + super.setUp(); + DataObjectUtil.initRuntime(); + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + try { + appCL = getClass().getClassLoader(); + Thread.currentThread().setContextClassLoader(appCL); + typeHelper = SDOUtil.createTypeHelper(); + XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper); + URL url = getClass().getResource("helloworld.wsdl"); + xsdHelper.define(url.openStream(), null); + url = getClass().getResource("CreditScoreDocLit.wsdl"); + xsdHelper.define(url.openStream(), null); + greetingDOB = SDOXMLHelper.toDataObject(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true); + greetingXML = SDOXMLHelper.toXMLBytes(appCL, typeHelper, new Object[] { GREETING_NAME }, GREETING_QN, true); + + DataFactory dataFactory = SDOUtil.createDataFactory(typeHelper); + nonWrappedDOB = dataFactory.create("http://www.example.org/creditscore/doclit/", "Customer"); + nonWrappedDOB.setString(0, "111-22-3333"); + nonWrappedDOB.setString(1, "John"); + nonWrappedDOB.setString(2, "Smith"); + + } finally { + Thread.currentThread().setContextClassLoader(cl); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl new file mode 100644 index 0000000000..09d1a58589 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLit.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl new file mode 100644 index 0000000000..3952c74809 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/CreditScoreDocLitWrapped.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl new file mode 100644 index 0000000000..e9312949d3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/databinding/sdo/src/test/resources/org/apache/tuscany/databinding/sdo/helloworld.wsdl @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/pom.xml new file mode 100644 index 0000000000..c1b74166aa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/pom.xml @@ -0,0 +1,77 @@ + + + + + org.apache.tuscany + tuscany-sca + incubating-M1 + + 4.0.0 + tuscany-model + Tuscany Assembly Model + Data model for the Assembly model defined by the SCA specification. + incubating-M1 + + + + org.osoa + sca-api + ${pom.version} + compile + + + org.apache.tuscany + tuscany-common + ${pom.version} + compile + + + + commonj + sdo-api + incubating-M1 + compile + + + org.apache.tuscany + tuscany-sdo-impl + incubating-M1 + compile + + + + wsdl4j + wsdl4j + 1.5.2 + compile + + + + asm + asm + 2.2 + compile + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java new file mode 100644 index 0000000000..e167882786 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/ModelRuntimeException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.model; + +import org.apache.tuscany.common.TuscanyRuntimeException; + +/** + * The root runtime exception for the model. + * + * @version $Rev$ $Date$ + */ +@SuppressWarnings({"serial"}) +public abstract class ModelRuntimeException extends TuscanyRuntimeException { + + public ModelRuntimeException() { + super(); + } + + public ModelRuntimeException(String message) { + super(message); + } + + public ModelRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public ModelRuntimeException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java new file mode 100644 index 0000000000..48aed5f35a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyContext.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; + +import commonj.sdo.helper.TypeHelper; + +/** + * Context object supplied by visitors that are processing the model. + */ +public interface AssemblyContext { + + /** + * Returns a factory that can be used to create other model objects + * + * @return a factory for model objects + */ + AssemblyFactory getAssemblyFactory(); + + /** + * Returns a loader for resources in the application environment. + * + * @return a loader for resources in the system environment + */ + ResourceLoader getApplicationResourceLoader(); + + /** + * Returns a loader that can be used to load sub-models. + * + * @return a loader for sub-models + */ + AssemblyModelLoader getAssemblyLoader(); + + /** + * Returns an SDO type helper. + * + * @return an SDO type helper + */ + TypeHelper getTypeHelper(); + + /** + * Returns the Web application module URI + * + * @return the module name of the Web app + */ + String getWebAppName(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java new file mode 100644 index 0000000000..efbc6bffa4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyFactory.java @@ -0,0 +1,260 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.model.types.java.JavaServiceContract; +import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; + +/** + * The Factory for the assembly model. Provides a create method for each non-abstract class of the model. + */ +public interface AssemblyFactory { + + /** + * Returns a new SimpleComponent. + * + * @return a new SimpleComponent + */ + AtomicComponent createSimpleComponent(); + + /** + * Returns a new ComponentType. + * + * @return a new ComponentType + */ + ComponentType createComponentType(); + + /** + * Returns a new EntryPoint. + * + * @return a new EntryPoint + */ + EntryPoint createEntryPoint(); + + /** + * Returns a new ExternalService. + * + * @return a new ExternalService + */ + ExternalService createExternalService(); + + /** + * Returns a new JavaServiceContract. + * + * @return a new JavaServiceContract + */ + JavaServiceContract createJavaServiceContract(); + + /** + * Returns a new Module. + * + * @return a new Module + */ + Module createModule(); + + /** + * Returns a new ModuleComponent. + * + * @return a new ModuleComponent + */ + ModuleComponent createModuleComponent(); + + /** + * Returns a new ModuleFragment. + * + * @return a new ModuleFragment + */ + ModuleFragment createModuleFragment(); + + /** + * Returns a new Reference. + * + * @return a new Reference + */ + Reference createReference(); + + /** + * Returns a new ConfiguredReference. + * + * @return a new ConfiguredReference + */ + ConfiguredReference createConfiguredReference(); + + /** + * Returns a new Service. + * + * @return a new Service + */ + Service createService(); + + /** + * Returns a new ConfiguredService. + * + * @return a new ConfiguredService + */ + ConfiguredService createConfiguredService(); + + /** + * Returns a new Subsystem. + * + * @return a new Subsystem + */ + Subsystem createSubsystem(); + + /** + * Returns a new Property. + * + * @return a new Property + */ + Property createProperty(); + + /** + * Returns a new ConfiguredProperty. + * + * @return a new ConfiguredProperty + */ + ConfiguredProperty createConfiguredProperty(); + + /** + * Returns a new WSDLServiceContract. + * + * @return a new WSDLServiceContract + */ + WSDLServiceContract createWSDLServiceContract(); + + /** + * Create a new ServiceURI from the given uri string. + * + * @param uri the URI for the service + * @return a new ServiceURI created from the supplied URI + */ + ServiceURI createServiceURI(String uri); + + /** + * Creates a new ServiceURI from a module component and a service name. + * + * @param moduleComponent the module component exposing the service + * @param serviceName the name of the service exposed by the module + * @return a new ServiceURI for the exposed service + */ + ServiceURI createServiceURI(ModuleComponent moduleComponent, String serviceName); + + /** + * Creates a new ServiceURI from a module component and configured port. + * + * @param moduleComponent the module component exposing the service + * @param part the part that is providing the service + * @param configuredPort the port on the part + * @return a new serviceURI for the exposed service + */ + ServiceURI createServiceURI(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort); + + ServiceURI createServiceURI(ModuleComponent moduleComponent, String partName, String serviceName); + + /** + * Create a qname from a URI + * + * @param uri + * @return a new qname + */ + QName createQName(String uri); + + /** + * Create a wire + * + * @return an new wire + */ + Wire createWire(); + + /** + * Helper method for creating a reference. + * + * @param name the name of the reference + * @param service the Java type of the service + * @return a Reference + */ + Reference createReference(String name, Class service); + + /** + * Helper method for creating a reference. + * + * @param name the name of the reference + * @param service the Java type of the service + * @param multiplicity the multiplicity of the reference + * @return a Reference + */ + Reference createReference(String name, Class service, Multiplicity multiplicity); + + /** + * Helper method for creating a configured reference. + * + * @param name the name of the reference + * @param targets the targets for the reference + * @return a ConfiguredReference + */ + ConfiguredReference createConfiguredReference(String name, String... targets); + + /** + * Helper method for creating an EntryPoint wired to a single target. + * + * @param entryPointName the name of the entry point + * @param serviceContract the service contract the EntryPoint should expose + * @param binding the binding the EntryPoint should use + * @param targetName the target the EntryPoint exposes + * @return an EntryPoint that exposes the supplied service and is wired to the target + */ + EntryPoint createEntryPoint(String entryPointName, ServiceContract serviceContract, Binding binding, String targetName); + + /** + * Helper method for creating an EntryPoint wired to a single target. + * + * @param entryPointName the name of the entry point + * @param configuredService the configured service to expose + * @param binding the binding the EntryPoint should use + * @param configuredReference a configured reference to the target + * @return an EntryPoint that exposes the supplied service using the supplied bindng and which is wired + * using the supplied reference + */ + EntryPoint createEntryPoint(String entryPointName, ConfiguredService configuredService, Binding binding, ConfiguredReference configuredReference); + + /** + * Helper method for creating a simple Property. + * + * @param name the property name + * @param type the Java type of the property + * @return a Property with the supplied name and type + */ + Property createProperty(String name, Class type); + + /** + * Returns a new ImportWSDL model object. + * + * @return a new ImportWSDL model object + */ + ImportWSDL createImportWSDL(); + + /** + * Returns a new ImportWSDL model object initialized with the supplied values. + * + * @param location the location where the WSDL definition can be found + * @param namespace the namespace URI for this import + * @return a new ImportWSDL model object + */ + ImportWSDL createImportWSDL(String location, String namespace); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java new file mode 100644 index 0000000000..69a7854df9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyInitializationException.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import org.apache.tuscany.model.ModelRuntimeException; + +/** + * Denotes an exception initializing an assembly model artifact. + * + * @version $Rev$ $Date$ + */ +public class AssemblyInitializationException extends ModelRuntimeException { + private static final long serialVersionUID = 747289653378365323L; + + public AssemblyInitializationException() { + super(); + } + + public AssemblyInitializationException(String message) { + super(message); + } + + public AssemblyInitializationException(String message, Throwable cause) { + super(message, cause); + } + + public AssemblyInitializationException(Throwable cause) { + super(cause); + } + +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java new file mode 100644 index 0000000000..d25f114902 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyObject.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * Base interface for all assembly model objects providing methods for managing the model itself. + */ +public interface AssemblyObject { + + /** + * Initialize this model object. + * + * @param modelContext context providing access to the environment in which this model is being used + * @throws AssemblyInitializationException if an error ocurrs initializing the artifact + */ + void initialize(AssemblyContext modelContext) throws AssemblyInitializationException; + + /** + * Freeze this model object preventing any additional changes. + */ + void freeze(); + + /** + * Accept a visitor + * + * @param visitor a visitor that is visiting the model + * @return true if processing is complete and the visitor should stop traversing the model + */ + boolean accept(AssemblyVisitor visitor); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java new file mode 100644 index 0000000000..f153b9b4f6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AssemblyVisitor.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * A visitor that traverses the model performing some operation. + */ +public interface AssemblyVisitor { + + /** + * Visit the given model object. + * + * @param modelObject the assembly model object to visit + * @return true if processing is complete + */ + boolean visit(AssemblyObject modelObject); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java new file mode 100644 index 0000000000..0c98bbbe95 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicComponent.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + +/** + * An atomic component, specifically not an {@link Composite}. + */ +public interface AtomicComponent extends Component { +} + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java new file mode 100644 index 0000000000..4d0703186b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/AtomicImplementation.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + +/** + * The implementation for a specific atomic component instance. + * This interface will typically be extended by component type implementations to indicate the + * specific implementation to be used by a runtime and to allow for additional runtime configuration + * properties. + */ +public interface AtomicImplementation extends Implementation { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java new file mode 100644 index 0000000000..51becc29c2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Binding.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + +/** + * The binding of an entry point or external service to a transport. + * This model object will typically be extended by binding implementations to allow + * specification of binding/transport specific information. + */ +public interface Binding extends AssemblyObject { + /** + * Returns the binding URI. + * @return the binding uri + * TODO do we need this? + */ + String getURI(); + + /** + * Sets binding URI. + * @param value the binding uri + * TODO do we need this? + */ + void setURI(String value); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java new file mode 100644 index 0000000000..b8d566f1d6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Component.java @@ -0,0 +1,81 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import java.util.List; + + +/** + * A component is a configured instance of a generic {@link Implementation}. + */ +public interface Component extends Part { + + /** + * Returns the Implementation for this configured instance. + * @return the Implementation for this configured instance + */ + I getImplementation(); + + /** + * Sets the Implementation for this configured instance + * @param value the Implementation for this configured instance + */ + void setImplementation(I value); + + /** + * Returns a list of configured property values for this configured instance. + * These values will be used to initialize the component when it is activated. + * @return a list of ConfiguredProperty values + */ + List getConfiguredProperties(); + + /** + * Returns the ConfiguredProperty value for the specified property. + * + * @param name the name of the Property + * @return the configured property value for the named property + */ + ConfiguredProperty getConfiguredProperty(String name); + + /** + * Returns the configured references for the configured instance. + * + * @return the configured references for the configured instance + */ + List getConfiguredReferences(); + + /** + * Returns the ConfiguredReference value for the specified reference. + * @param name the name of the Property + * @return the configured reference value for the named reference + */ + ConfiguredReference getConfiguredReference(String name); + + /** + * Returns the configured services for the configured instance. + * @return the configured services for the configured instance + */ + List getConfiguredServices(); + + /** + * Returns the ConfiguredService value for the specified property. + * @param name the name of the Property + * @return the configured service value for the named service + */ + ConfiguredService getConfiguredService(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java new file mode 100644 index 0000000000..58ac9bc9de --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ComponentType.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import java.util.List; + + +/** + * A logical definition of a type of component separate from any specific implementation. + */ +public interface ComponentType extends Extensible { + + /** + * Returns a list of services exposed by this component type. + * @return a list of services exposed by this component type + */ + List getServices(); + + /** + * Returns the specfied service if exposed by this component type. + * @param name the name of the service + * @return the service identified by the supplied name, or null if there is no service with that name + */ + Service getService(String name); + + /** + * Returns the list of references this component type consumes. + * @return the list of references this component type consumes + */ + List getReferences(); + + /** + * Returns the specified reference. + * @param name the name of the reference + * @return the reference identified by the supplied name, or null if there is no reference with that name + */ + Reference getReference(String name); + + /** + * Returns the list of properties that can be used to configure components with this component type. + * @return the list of properties that can be used to configure components with this component type + */ + List getProperties(); + + /** + * Returns the specified property + * @param name the name of the property + * @return the property with the supplied name, or null if there is no property with that name + */ + Property getProperty(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java new file mode 100644 index 0000000000..09f51945bb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Composite.java @@ -0,0 +1,94 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import java.util.List; + +/** + * A model object that describes a container for parts. + */ +public interface Composite extends Implementation { + + /** + * Returns the name of the composite. + * @return the name of the composite + */ + String getName(); + + /** + * Sets the name of the composite. + * @param name the name of the composite + */ + void setName(String name); + + /** + * Returns the named part. + * @param name + */ + Part getPart(String name); + + /** + * Returns all entry points contained in this composite. + * @return a list of all EntryPoint model objects contained in this composite + */ + List getEntryPoints(); + + /** + * Returns all components contained in this composite. + * @return a list of all Component model objects contained in this composite + */ + List getComponents(); + + /** + * Returns all external services contained in this composite. + * @return a list of all ExternalService model objects contained in this composite + */ + List getExternalServices(); + + /** + * Returns the wires contained in this composite. + */ + List getWires(); + + /** + * Returns the WSDL imports declared in this composite. + */ + List getWSDLImports(); + + /** + * Returns the WSDL imports for the given namespace. + * @param namespace + */ + List getWSDLImports(String namespace); + + /** + * Returns the configured service at the given address. + * @param address + */ + ConfiguredService getConfiguredService(ServiceURI address); + + /** + * Returns the implementation class. + */ + Class getImplementationClass(); + + /** + * Sets the implementation class. + */ + void setImplementationClass(Class value); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java new file mode 100644 index 0000000000..c78fe28ff5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/CompositeComponent.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * Specialization of Component that represents a configured {@link Module}. + */ +public interface CompositeComponent extends Component { + + /** + * Returns the uri that uniquely identifies this module component. + * @return the uri that uniquely identifies this module component + */ + String getURI(); + + /** + * Sets the uri that uniquely identifies this module component. + * @param uri the uri that uniquely identifies this module component + */ + void setURI(String uri); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java new file mode 100644 index 0000000000..7f562e99d9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredPort.java @@ -0,0 +1,63 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + +/** + * Represents a configured port (e.g. a configured reference or configured service). + */ +public interface ConfiguredPort

extends AssemblyObject, ProxyFactoryHolder { + + /** + * Returns the name of the port being configured. + * + * @return the name of the port being configured + */ + String getName(); + + /** + * Set the name of the port being configured. + * + * @param name the name of the port being configured + */ + void setName(String name); + + /** + * Returns the port that is being configured. + * @return the port that is being configured + */ + P getPort(); + + /** + * Sets the port that is being configured. + * @param port the port that is being configured + */ + void setPort(P port); + + /** + * Returns the part containing this port. + * @return the part that contains this port + */ + Part getPart(); + + /** + * Sets the configured part containing this port. + * @param part the configured part containing this port. + */ + void setPart(Part part); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java new file mode 100644 index 0000000000..0d3a3e5011 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredProperty.java @@ -0,0 +1,74 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * The configured value of a {@link Property}. + */ +public interface ConfiguredProperty extends AssemblyObject { + + //FIXME remove the name attribute? + /** + * Returns the name of the property being configured. + * @return the name of the property being configured + */ + String getName(); + + /** + * Set the name of the property being configured. + * @param name the name of the property being configured + */ + void setName(String name); + + /** + * Returns the {@link Property} whose value is being set. + * @return the {@link Property} whose value is being set + */ + Property getProperty(); + + /** + * Sets the {@link Property} whose value is being set. + * @param property the {@link Property} whose value is being set + */ + void setProperty(Property property); + + /** + * Returns the value being set for this usage of the {@link Property}. + * @return the value being set for this usage of the {@link Property} + */ + Object getValue(); + + /** + * Sets the value being set for this usage of the {@link Property}. + * @param value the value being set for this usage of the {@link Property} + */ + void setValue(Object value); + + /** + * Returns the override option that determines if any configuration for this property + * that is contained in this composite can be overridden by configuration supplied from outside. + */ + OverrideOption getOverrideOption(); + + /** + * Set the override option that determines if any configuration for this property + * that is contained in this composite can be overridden by configuration supplied from outside. + * + * @param value the option that determines how property configuration can be overriden + */ + void setOverrideOption(OverrideOption value); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java new file mode 100644 index 0000000000..22cb734869 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredReference.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import java.util.List; + +/** + * A configured reference associated with a particular usage. + * Each configuredReference represents a configured version of an logical + * reference defined in the ComponentType. If the logical reference + * has a multiplicity greater than 1 (0..n or 1..n) then the configured + * reference many have multiple targets. + */ +public interface ConfiguredReference extends ConfiguredPort { + + /** + * List of URIs for the targets of this reference. + * + * @return the list of URIs for the targets of this reference + */ + List getTargets(); + + /** + * Returns the list of configured services that are wired to this configured reference. + * + * @return the list of configured services that are wired to this configured reference + */ + List getTargetConfiguredServices(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java new file mode 100644 index 0000000000..696250ea44 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ConfiguredService.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + +/** + * A configured service associated with a particular usage. + */ +public interface ConfiguredService extends ConfiguredPort { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java new file mode 100644 index 0000000000..20259f245d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ContextFactoryHolder.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * A model object that can hold a runtime context factory object. + */ +public interface ContextFactoryHolder { + + /** + * Sets the context factory + */ + void setContextFactory(Object contextFactory); + + /** + * Returns the context factory + */ + Object getContextFactory(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java new file mode 100644 index 0000000000..a90b89c4f5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/EntryPoint.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import java.util.List; + + +/** + * An entry point exposed by its containing {@link Composite}. + * References from outside the composite can only be connected to its entry points. + */ +public interface EntryPoint extends Part { + + /** + * Returns the bindings supported by this entry point. + * A single entry point may be bound to multiple transports. + * + * @return a list of bindings supported by this entry point + */ + List getBindings(); + + /** + * Returns the configured service exposed by this entry point. + * + * @return the configured service exposed by this entry point + */ + ConfiguredService getConfiguredService(); + + /** + * Sets the configured service exposed by this entry point. + * + * @param configuredService the configured service exposed by this entry point + */ + void setConfiguredService(ConfiguredService configuredService); + + /** + * Returns the configured reference that wires this entry point to the published service + * inside the composite. + * + * @return the reference that wires this entry point to the published service + */ + ConfiguredReference getConfiguredReference(); + + /** + * Sets the configured reference that wires this entry point to the published service + * inside the composite. + * + * @param configuredReference the configured reference that wires this entry point to + * the published service inside the composite + */ + void setConfiguredReference(ConfiguredReference configuredReference); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java new file mode 100644 index 0000000000..b4651a6186 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Extensible.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import java.util.List; + +/** + * An extensible model object. We actually need this even though we have the ability to load specializations + * of individual model objects + */ +public interface Extensible extends AssemblyObject { + + /** + * Returns the extensibility elements. + */ + List getExtensibilityElements(); + + /** + * Returns the extensibility attributes. + */ + List getExtensibilityAttributes(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java new file mode 100644 index 0000000000..f2b72ec928 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ExternalService.java @@ -0,0 +1,59 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import java.util.List; + + +/** + * An external service consumed by its containing {@link Composite}. + * All references used by the composite are specified as external services. + */ +public interface ExternalService extends Part { + + /** + * Returns the bindings that can be used by operations on this external service. + * A single external service may be bound to multiple transports. + */ + List getBindings(); + + /** + * Returns the override option that determines if any wiring for this external service + * that is contained in this composite can be overridden by wired supplied from outside. + */ + OverrideOption getOverrideOption(); + + /** + * Set the override option that determines if any wiring for this external service + * that is contained in this composite can be overridden by wired supplied from outside. + * + * @param value the option that determines how wires can be overriden + */ + void setOverrideOption(OverrideOption value); + + /** + * Returns the configured service that this external service provides to other parts of the containing composite. + * @return the configured service that this external service provides to other parts of the containing composite + */ + ConfiguredService getConfiguredService(); + + /** + * Sets the configured service that this external service provides to other parts of the containing composite + * @param configuredService the configured service that this external service provides to other parts of the containing composite + */ + void setConfiguredService(ConfiguredService configuredService); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java new file mode 100644 index 0000000000..2777d985f8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Implementation.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + +/** + * The implementation for a specific component instance. + * This interface will typically be extended by component type implementations to indicate the + * specific implementation to be used by a runtime and to allow for additional runtime configuration + * properties. + */ +public interface Implementation extends Extensible { + + /** + * Returns the generic component type corresponding to this implementation. + * @return the generic component type corresponding to this implementation + */ + ComponentType getComponentType(); + + /** + * Sets the generic component type corresponding to this implementation. + * @param componentType the generic component type corresponding to this implementation + */ + void setComponentType(ComponentType componentType); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java new file mode 100644 index 0000000000..7c858a1b76 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ImportWSDL.java @@ -0,0 +1,62 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import javax.wsdl.Definition; + +/** + * Model object that represents the import of an external WSDL definition. + * + * @version $Rev$ $Date$ + */ +public interface ImportWSDL extends AssemblyObject { + /** + * Returns the location where the WSDL definition can be found. + * @return the location where the WSDL definition can be found + */ + String getLocation(); + + /** + * Set the location where the WSDL definition can be found. + * @param uri the location where the WSDL definition can be found + */ + void setLocation(String uri); + + /** + * Returns the namespace URI for this import. + * @return the namespace URI for this import + */ + String getNamespace(); + + /** + * Sets the namespace URI for this import. + * @param uri the namespace URI for this import + */ + void setNamespace(String uri); + + /** + * Returns the WSDL Definition. + * @return the WSDL Definition + */ + Definition getDefinition(); + + /** + * Sets the WSDL Definition. + * @param definition the WSDL Definition + */ + void setDefinition(Definition definition); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java new file mode 100644 index 0000000000..40d1d1534b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Module.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +import java.util.List; + +/** + * A specialized {@link Implementation} that defines a modular unit of assembly. + * A Module denotes the extent of assembly in which pass-by-reference semantics are supported. + */ +public interface Module extends Composite { + + /** + * Returns a list of assembly fragments that combine to form a single module. + * @return a list of assembly fragments that combine to form a single module + */ + List getModuleFragments(); + + /** + * Returns the specified assembly fragment. + * @param name the name of the fragment + * @return the fragment with the specified name, or null if there is no fragment with that name + */ + ModuleFragment getModuleFragment(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java new file mode 100644 index 0000000000..00f6079096 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleComponent.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * Specialization of Component that represents a configured {@link Module}. + */ +public interface ModuleComponent extends CompositeComponent { + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java new file mode 100644 index 0000000000..dec1e8bfd3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ModuleFragment.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * A fragment of assembly configuration within a module. + * To support flexibility and reuse, modules can be defined in multiple fragments that are + * then combined by the runtime to form the complete module definition. + */ +public interface ModuleFragment extends Composite { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java new file mode 100644 index 0000000000..c51ab7b8ea --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Multiplicity.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * Enumeration for multiplicity. + */ +public enum Multiplicity { + /** + * Indicates a relationship that is optionally connected to the requestor and which, if supplied, + * must be connected to exactly one provider. + */ + ZERO_ONE, + + /** + * Indicates a relationship that must be connected between exactly one requestor and + * exactly one provider. + */ + ONE_ONE, + + /** + * Indicates a relationship that is optionally connects the requestor to zero to unbounded providers. + */ + ZERO_N, + + /** + * Indicates a relationship that must be connected at the requestor and which connects it to + * zero to unbounded providers. + */ + ONE_N + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java new file mode 100644 index 0000000000..68489d0200 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/OverrideOption.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * Enumeration for override options that are used to control whether configuration information + * can be overridden by larger grained definitions. + */ +public enum OverrideOption { + /** + * Indicates that the supplied configuration cannot be overridden. + */ + NO, + + /** + * Indicates that the supplied configuration may be overriden. + */ + MAY, + + /** + * Indicates that the supplied configuration must be overriden. + */ + MUST + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java new file mode 100644 index 0000000000..9645ad6d35 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Part.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + + +/** + * A configured object that is contained inside a {@link Composite}. + */ +public interface Part extends Extensible, ContextFactoryHolder { + /** + * Returns the name that uniquely identifies this component within its containing composite. + * @return the name that uniquely identifies this component within its containing composite + */ + String getName(); + + /** + * Sets the name that uniquely identifies this component within its containing composite. + * @param value the name that uniquely identifies this component within its containing composite + */ + void setName(String value); + + /** + * Returns the composite that contains this component. + * @return the composite that contains this component + */ + Composite getComposite(); + + /** + * Sets the composite that contains this component. + * @param the composite that contains this component + */ + void setComposite(Composite composite); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java new file mode 100644 index 0000000000..13b9d0a1db --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Port.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * Abstraction for the association of a service contract with a requestor or provider. + */ +public interface Port extends AssemblyObject { + /** + * Returns the contract for invocations of a service using this port. + * @return the oontract for invocations of a service using this port + */ + ServiceContract getServiceContract(); + + /** + * Set the contract for invocations of a service using this port. + * @param contract the contract for invocations of a service using this port + */ + void setServiceContract(ServiceContract contract); + + /** + * Returns the name of the port where it is associated with a requestor or provider. + * @return the name of the port + */ + String getName(); + + /** + * Sets the name of the port where it is associated with a requestor or provider. + * @param name the name of the port where it is associated with a requestor or provider + */ + void setName(String name); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java new file mode 100644 index 0000000000..1f238efce6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Property.java @@ -0,0 +1,91 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + + +/** + * A description of a property that can be used to configure a component. + */ +public interface Property extends Extensible { + // todo should we decalre this as Property where T would be the type of this Property? + + /** + * Returns the property name. + * @return the property name + */ + String getName(); + + /** + * Sets the property name. + * @param name the property name + */ + void setName(String name); + + /** + * Returns the default value of the property. + * @return the default value of ths property + */ + Object getDefaultValue(); + + /** + * Sets the default value of the property. + * @param value the default value of ths property + */ + void setDefaultValue(Object value); + + /** + * Returns true if the property allows multiple values. + * @return true if the property allows multiple values + */ + boolean isMany(); + + /** + * Sets whether or not the property allows multiple values. + * @param value true if the property should allow multiple values + */ + void setMany(boolean value); + + /** + * Returns true if a value must be supplied for the property. + * @return true is a value must be supplied for the property + */ + boolean isRequired(); + + /** + * Sets whether a value must be supplied for the property. + * For ease of use, it is recommended that a meaningful default value should + * be supplied for all properties; users should only be required to specify + * a value if there is no reasonable default. + * + * @param value set to true to require that a value be supplied for uses of this property + */ + void setRequired(boolean value); + + /** + * Returns the type of this property as used by the runtime. + * @return the type of this property as used by the runtime + */ + Class getType(); + + /** + * Sets the type of this property as used by the runtime + * @param value the type of this property as used by the runtime + */ + void setType(Class value); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java new file mode 100644 index 0000000000..055448b2f5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ProxyFactoryHolder.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * A model object that can hold a runtime proxy factory object. + */ +public interface ProxyFactoryHolder { + + /** + * Sets the proxy factory + */ + void setProxyFactory(Object proxyFactory); + + /** + * Returns the proxy factory + */ + Object getProxyFactory(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java new file mode 100644 index 0000000000..8cc13e98ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Reference.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + +/** + * The association of a port with a requestor. + */ +public interface Reference extends Port { + /** + * Returns the multiplicity allowed for wires connected to this reference. + * @return the multiplicity allowed for wires connected to this reference + */ + Multiplicity getMultiplicity(); + + /** + * Sets the multiplicity allowed for wires connected to this reference. + * @param multiplicity the multiplicity allowed for wires connected to this reference + */ + void setMultiplicity(Multiplicity multiplicity); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java new file mode 100644 index 0000000000..c7194292f0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Scope.java @@ -0,0 +1,31 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * The types of scope supported by assemblies. + */ +public enum Scope { + // todo define what these are + INSTANCE, + REQUEST, + SESSION, + MODULE, + AGGREGATE, + UNDEFINED + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java new file mode 100644 index 0000000000..c73002efba --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Service.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + +/** + * The association of a port with a provider. + */ +public interface Service extends Port { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java new file mode 100644 index 0000000000..1600e11663 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceContract.java @@ -0,0 +1,60 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * The contract specified by a requestor or provider for invocations across a port. + */ +public interface ServiceContract extends Extensible { + + /** + * Returns the interface for invocations from the requestor to the provider. + * @return the interface for invocations from the requestor to the provider + */ + Class getInterface(); + + /** + * Sets the interface for invocations from the requestor to the provider. + * @param value the interface for invocations from the requestor to the provider + */ + void setInterface(Class value); + + /** + * Returns the callback interface for wire from the provider back to its requestor. + * @return the callback interface for wire from the provider back to its requestor + */ + Class getCallbackInterface(); + + /** + * Sets the callback interface for wire from the provider back to its requestor. + * @param value the callback interface for wire from the provider back to its requestor + */ + void setCallbackInterface(Class value); + + /** + * Returns the scope of this service contract. + * @return + */ + Scope getScope(); + + /** + * Sets the scope. + * @param scope of this service contract. + */ + void setScope(Scope scope); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java new file mode 100644 index 0000000000..740febc360 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/ServiceURI.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + +/** + * Represents a service URI. + */ +public interface ServiceURI { + + /** + * Returns true if the address scheme is sca + * @return + */ + public boolean isSCAScheme(); + + /** + * @return Returns the address. + */ + public String getAddress(); + + /** + * @return Returns the path. + */ + public String getPath(); + + /** + * Returns the module component name + * @return + */ + public String getModuleComponentName(); + + /** + * Returns the part name + * @return + */ + public String getPartName(); + + /** + * Returns the service name + * @return + */ + public String getServiceName(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java new file mode 100644 index 0000000000..709ba4da35 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Subsystem.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + + +/** + * Represents a subsystem. + */ +public interface Subsystem extends Composite { + + /** + * Returns the subsystem uri. + * @return + */ + String getURI(); + + /** + * Sets the subsystem uri. + * @param value + */ + void setURI(String value); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java new file mode 100644 index 0000000000..dfe553210a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/Wire.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly; + + +/** + * A connection between a requestor (source) and a provider (target). + */ +public interface Wire extends Extensible { + /** + * Returns the URI for the source of the request. + * @return the URI for the source of the request + */ + ServiceURI getSource(); + + /** + * Sets the URI for the source of the request. + * @param uri the URI for the source of the request + */ + void setSource(ServiceURI uri); + + /** + * Returns the URI for the target of the request. + * @return the URI for the target of the request + */ + ServiceURI getTarget(); + + /** + * Sets the URI for the target of the request. + * @param uri the URI for the target of the request + */ + void setTarget(ServiceURI uri); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java new file mode 100644 index 0000000000..a7f9012db7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyContextImpl.java @@ -0,0 +1,88 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.helper.TypeHelper; + +/** + */ +public class AssemblyContextImpl implements AssemblyContext { + + private final AssemblyFactory assemblyFactory; + private final AssemblyModelLoader assemblyLoader; + private final ResourceLoader applicationResourceLoader; + private final TypeHelper typeHelper; + private String webAppName; + + public AssemblyContextImpl(AssemblyModelLoader assemblyLoader, ResourceLoader resourceLoader) { + this(new AssemblyFactoryImpl(), assemblyLoader, resourceLoader); + } + + public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader) { + this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper()); + } + + public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, String webAppName) { + this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper(), webAppName); + } + public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, TypeHelper typeHelper) { + this(assemblyFactory, assemblyLoader, artifactLoader, SDOUtil.createTypeHelper(), null); + } + + public AssemblyContextImpl(AssemblyFactory assemblyFactory, AssemblyModelLoader assemblyLoader, ResourceLoader artifactLoader, TypeHelper typeHelper, String webAppName) { + this.assemblyFactory = assemblyFactory; + this.assemblyLoader = assemblyLoader; + this.applicationResourceLoader = artifactLoader; + this.typeHelper=typeHelper; + this.webAppName=webAppName; + } + + /** + * @see org.apache.tuscany.model.assembly.AssemblyContext#getAssemblyFactory() + */ + public AssemblyFactory getAssemblyFactory() { + return assemblyFactory; + } + + public ResourceLoader getApplicationResourceLoader() { + return applicationResourceLoader; + } + + /** + * @see org.apache.tuscany.model.assembly.AssemblyContext#getAssemblyLoader() + */ + public AssemblyModelLoader getAssemblyLoader() { + return assemblyLoader; + } + + /** + * @see org.apache.tuscany.model.assembly.AssemblyContext#getTypeHelper() + */ + public TypeHelper getTypeHelper() { + return typeHelper; + } + + public String getWebAppName() { + return webAppName; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java new file mode 100644 index 0000000000..c88ea4448f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyFactoryImpl.java @@ -0,0 +1,217 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.model.assembly.Part; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.ConfiguredPort; +import org.apache.tuscany.model.assembly.ConfiguredProperty; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.ModuleFragment; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.Property; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceURI; +import org.apache.tuscany.model.assembly.AtomicComponent; +import org.apache.tuscany.model.assembly.Subsystem; +import org.apache.tuscany.model.assembly.Wire; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.apache.tuscany.model.assembly.ImportWSDL; +import org.apache.tuscany.model.types.java.JavaServiceContract; +import org.apache.tuscany.model.types.java.impl.JavaServiceContractImpl; +import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; +import org.apache.tuscany.model.types.wsdl.impl.WSDLServiceContractImpl; + +/** + * Default implementation of AssemblyFactory + */ +public class AssemblyFactoryImpl implements AssemblyFactory { + + /** + * Constructor + */ + public AssemblyFactoryImpl() { + super(); + } + + public AtomicComponent createSimpleComponent() { + return new AtomicComponentImpl(); + } + + public ComponentType createComponentType() { + return new ComponentTypeImpl(); + } + + public EntryPoint createEntryPoint() { + return new EntryPointImpl(); + } + + public ExternalService createExternalService() { + return new ExternalServiceImpl(); + } + + public JavaServiceContract createJavaServiceContract() { + return new JavaServiceContractImpl(); + } + + public Module createModule() { + return new ModuleImpl(); + } + + public ModuleFragment createModuleFragment() { + return new ModuleFragmentImpl(); + } + + public ModuleComponent createModuleComponent() { + return new ModuleComponentImpl(); + } + + public Property createProperty() { + return new PropertyImpl(); + } + + public ConfiguredProperty createConfiguredProperty() { + return new ConfiguredPropertyImpl(); + } + + public Reference createReference() { + return new ReferenceImpl(); + } + + public ConfiguredReference createConfiguredReference() { + return new ConfiguredReferenceImpl(); + } + + public Service createService() { + return new ServiceImpl(); + } + + public ConfiguredService createConfiguredService() { + return new ConfiguredServiceImpl(); + } + + public Subsystem createSubsystem() { + return new SubsystemImpl(); + } + + public WSDLServiceContract createWSDLServiceContract() { + return new WSDLServiceContractImpl(); + } + + public ServiceURI createServiceURI(String uri) { + return new ServiceURIImpl(uri); + } + + public ServiceURI createServiceURI(ModuleComponent moduleComponent, String serviceName) { + return new ServiceURIImpl(moduleComponent, serviceName); + } + + public ServiceURI createServiceURI(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort) { + return new ServiceURIImpl(moduleComponent, part, configuredPort); + } + + public ServiceURI createServiceURI(ModuleComponent moduleComponent, String partName, String serviceName) { + return new ServiceURIImpl(moduleComponent,partName,serviceName); + } + + public QName createQName(String uri) { + int h = uri.indexOf('#'); + return new QName(uri.substring(0, h), uri.substring(h + 1)); + } + + public Wire createWire() { + return new WireImpl(); + } + + public Reference createReference(String name, Class service) { + return createReference(name,service,Multiplicity.ZERO_ONE); + } + + public Reference createReference(String name, Class service, Multiplicity multiplicity){ + JavaServiceContract refContract = createJavaServiceContract(); + refContract.setInterface(service); + Reference reference = createReference(); + reference.setName(name); + reference.setServiceContract(refContract); + reference.setMultiplicity(multiplicity); + return reference; + } + + public ConfiguredReference createConfiguredReference(String name, String... targets) { + ConfiguredReference ref = createConfiguredReference(); + ref.setName(name); + for (String target : targets) { + ref.getTargets().add(target); + } + return ref; + } + + public EntryPoint createEntryPoint(String entryPointName, ServiceContract serviceContract, Binding binding, String targetName) { + // create and configure the exposed service + Service service = createService(); + service.setName(entryPointName); + service.setServiceContract(serviceContract); + ConfiguredService configuredService = createConfiguredService(); + configuredService.setPort(service); + + // create and configure a reference to target + Reference reference = createReference(); + reference.setMultiplicity(Multiplicity.ONE_ONE); + reference.setServiceContract(serviceContract); + ConfiguredReference configuredReference = createConfiguredReference(null, targetName); + configuredReference.setPort(reference); + + return createEntryPoint(entryPointName, configuredService, binding, configuredReference); + } + + public EntryPoint createEntryPoint(String entryPointName, ConfiguredService configuredService, Binding binding, ConfiguredReference configuredReference) { + EntryPoint entryPoint = createEntryPoint(); + entryPoint.setName(entryPointName); + entryPoint.setConfiguredService(configuredService); + entryPoint.setConfiguredReference(configuredReference); + entryPoint.getBindings().add((Binding)binding); + return entryPoint; + } + + public Property createProperty(String name, Class type) { + Property property = createProperty(); + property.setName(name); + property.setType(type); + return property; + } + + public ImportWSDL createImportWSDL() { + return new ImportWSDLImpl(); + } + + public ImportWSDL createImportWSDL(String location, String namespace) { + ImportWSDL importWSDL = createImportWSDL(); + importWSDL.setLocation(location); + importWSDL.setNamespace(namespace); + return importWSDL; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java new file mode 100644 index 0000000000..38056e1e1c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AssemblyObjectImpl.java @@ -0,0 +1,123 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyObject; +import org.apache.tuscany.model.assembly.AssemblyVisitor; + +/** + * A base class for assembly model objects. + */ +public abstract class AssemblyObjectImpl implements AssemblyObject { + + private boolean frozen; + private boolean initialized; + + protected AssemblyObjectImpl() { + } + + public boolean accept(AssemblyVisitor visitor) { + return visitor.visit(this); + } + + /** + * Walk a visitor through a collection of model objects. + * @param collection + * @param visitor + */ + protected boolean accept(Collection collection, AssemblyVisitor visitor) { + for (Object member : collection) { + if (member instanceof AssemblyObject) { + if (!((AssemblyObject)member).accept(visitor)) + return false; + } + } + return true; + } + + public void freeze() { + if (!frozen) + frozen=true; + } + + /** + * Returns true if the object is frozen + */ + protected boolean isFrozen() { + return frozen; + } + + /** + * Freeze a list and its members + */ + protected List freeze(List list) { + list=Collections.unmodifiableList(list); + for (Object member : list) { + if (member instanceof AssemblyObject) { + ((AssemblyObject)member).freeze(); + } + } + return list; + } + + /** + * Check that the current model object can be modified. + * @throws IllegalStateException + */ + protected void checkNotFrozen() { + if (frozen) + throw new IllegalStateException("Attempt to modify a frozen assembly model"); + } + + public void initialize(AssemblyContext modelContext) { + if (!initialized) + initialized=true; + } + + /** + * Returns true if the object is initialized + */ + protected boolean isInitialized() { + return initialized; + } + + /** + * Initialize members of a collection + */ + protected void initialize(Collection collection, AssemblyContext modelContext) { + for (Object member : collection) { + if (member instanceof AssemblyObject) { + ((AssemblyObject)member).initialize(modelContext); + } + } + } + + /** + * Check that the current model object is initialized. + * @throws IllegalStateException + */ + protected void checkInitialized() { + if (!initialized) + throw new IllegalStateException("Attempt to use an uninitialized assembly model"); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java new file mode 100644 index 0000000000..186d685d12 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicComponentImpl.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.AtomicComponent; +import org.apache.tuscany.model.assembly.AtomicImplementation; + +/** + * An implementation of AtomicComponent. + */ +public class AtomicComponentImpl extends ComponentImpl implements AtomicComponent { + + protected AtomicComponentImpl() { + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java new file mode 100644 index 0000000000..1f85afa2cc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/AtomicImplementationImpl.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.AtomicImplementation; + +/** + * An implementation of AtomicImplementation. + */ +public abstract class AtomicImplementationImpl extends ImplementationImpl implements AtomicImplementation { + + protected AtomicImplementationImpl() { + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java new file mode 100644 index 0000000000..c13dabb17e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/BindingImpl.java @@ -0,0 +1,62 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Binding; + +/** + * An implementation of Binding. + */ +public class BindingImpl extends ExtensibleImpl implements Binding { + + private String uri; + + protected BindingImpl() { + } + + public String getURI() { + return uri; + } + + public void setURI(String value) { + checkNotFrozen(); + uri=value; + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + return true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java new file mode 100644 index 0000000000..a952ebe34d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentImpl.java @@ -0,0 +1,213 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.AssemblyInitializationException; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.ConfiguredPort; +import org.apache.tuscany.model.assembly.ConfiguredProperty; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.Implementation; +import org.apache.tuscany.model.assembly.Property; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.util.NotifyingList; + +/** + * An implementation of Component. + */ +public abstract class ComponentImpl extends PartImpl implements Component { + + /** + * A list of configured ports synchronized with a map + */ + private class ConfiguredPortList extends NotifyingList{ + + Map map; + + private ConfiguredPortList(Map map) { + this.map=map; + } + + protected void added(E element) { + String name=element.getPort()!=null? element.getPort().getName():element.getName(); + map.put(name, element); + element.setPart(ComponentImpl.this); + } + protected void removed(E element) { + String name=element.getPort()!=null? element.getPort().getName():element.getName(); + map.remove(name); + element.setPart(null); + } + } + + private Map configuredReferencesMap = new HashMap(); + private List configuredReferences = new ConfiguredPortList(configuredReferencesMap); + + private Map configuredServicesMap = new HashMap(); + private List configuredServices = new ConfiguredPortList(configuredServicesMap); + + /** + * A list of properties synchronized with a map + */ + private class ConfiguredPropertyList extends NotifyingList{ + + protected void added(E element) { + String name=element.getProperty()!=null? element.getProperty().getName():element.getName(); + configuredPropertiesMap.put(name, element); + } + protected void removed(E element) { + String name=element.getProperty()!=null? element.getProperty().getName():element.getName(); + configuredPropertiesMap.remove(name); + } + } + + private List configuredProperties = new ConfiguredPropertyList(); + private Map configuredPropertiesMap=new HashMap(); + + private I implementation; + + public I getImplementation() { + return implementation; + } + + public void setImplementation(I value) { + checkNotFrozen(); + implementation = value; + } + + public List getConfiguredServices() { + return configuredServices; + } + + public ConfiguredService getConfiguredService(String name) { + return configuredServicesMap.get(name); + } + + public List getConfiguredReferences() { + return configuredReferences; + } + + public ConfiguredReference getConfiguredReference(String name) { + return configuredReferencesMap.get(name); + } + + public List getConfiguredProperties() { + return configuredProperties; + } + + public ConfiguredProperty getConfiguredProperty(String name) { + return configuredPropertiesMap.get(name); + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + // Initialize the implementation + if (implementation == null) { + throw new AssemblyInitializationException("No implementation for component [" + getName() + ']'); + } + implementation.initialize(modelContext); + + // Derive the configured services from the component implementation + ComponentType componentType=implementation.getComponentType(); + AssemblyFactory factory = modelContext.getAssemblyFactory(); + for (Service service : componentType.getServices()) { + ConfiguredService configuredService = factory.createConfiguredService(); + configuredService.setPort(service); + configuredServices.add(configuredService); + configuredService.initialize(modelContext); + } + + // Derive the configured references from the references on the component info + for (Reference reference : componentType.getReferences()) { + ConfiguredReference configuredReference = configuredReferencesMap.get(reference.getName()); + if (configuredReference==null) { + configuredReference=factory.createConfiguredReference(); + configuredReference.setPort(reference); + configuredReferences.add(configuredReference); + configuredReference.initialize(modelContext); + } else { + configuredReference.setPort(reference); + configuredReference.initialize(modelContext); + } + } + for (ConfiguredReference configuredReference : configuredReferences) { + if (configuredReference.getPort()==null) { + throw new AssemblyInitializationException("Undefined reference ["+configuredReference.getName()+"]"); + } + } + + // Derive the configured properties from the properties on the component info + for (Property property : componentType.getProperties()) { + ConfiguredProperty configuredProperty = configuredPropertiesMap.get(property.getName()); + if (configuredProperty != null) { + configuredProperty.setProperty(property); + configuredProperty.initialize(modelContext); + } + } + for (ConfiguredProperty configuredProperty : configuredProperties) { + if (configuredProperty.getProperty()==null) { + throw new AssemblyInitializationException("Undefined property ["+configuredProperty.getName()+"]"); + } + } + + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + // Freeze configured services, references and properties + configuredServices = freeze(configuredServices); + configuredReferences = freeze(configuredReferences); + configuredProperties = freeze(configuredProperties); + if (implementation != null) + implementation.freeze(); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (!accept(configuredServices, visitor)) + return false; + if (!accept(configuredReferences, visitor)) + return false; + if (!accept(configuredProperties, visitor)) + return false; + if (implementation != null) { + if (!implementation.accept(visitor)) + return false; + } + + return true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java new file mode 100644 index 0000000000..617206b6af --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ComponentTypeImpl.java @@ -0,0 +1,147 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Port; +import org.apache.tuscany.model.assembly.Property; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.util.NotifyingList; + +/** + * An implementation of ComponentType. + */ +public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType { + + /** + * A list of ports synchronized with a map + */ + private class PortList extends NotifyingList{ + + Map map; + + private PortList(Map map) { + this.map=map; + } + + protected void added(E element) { + map.put(element.getName(), element); + } + protected void removed(E element) { + map.remove(element.getName()); + } + } + + private Map referencesMap=new HashMap(); + private List references=new PortList(referencesMap); + + private Map servicesMap=new HashMap(); + private List services=new PortList(servicesMap); + + /** + * A list of properties synchronized with a map + */ + private class PropertyList extends NotifyingList{ + + protected void added(E element) { + propertiesMap.put(element.getName(), element); + } + protected void removed(E element) { + propertiesMap.remove(element.getName()); + } + } + + private Map propertiesMap=new HashMap(); + private List properties=new PropertyList(); + + protected ComponentTypeImpl() { + } + + public List getReferences() { + return references; + } + + public Reference getReference(String name) { + return referencesMap.get(name); + } + + public List getServices() { + return services; + } + + public Service getService(String name) { + return servicesMap.get(name); + } + + public List getProperties() { + return properties; + } + + public Property getProperty(String name) { + return propertiesMap.get(name); + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + // Initialize references, properties and services + for (Reference reference : references) { + reference.initialize(modelContext); + } + for (Property property : properties) { + property.initialize(modelContext); + } + for (Service service : services) { + service.initialize(modelContext); + } + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + // Freeze lists of services, references and properties + services=freeze(services); + references=freeze(references); + properties=freeze(properties); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (!accept(services, visitor)) + return false; + if (!accept(references, visitor)) + return false; + if (!accept(properties, visitor)) + return false; + + return true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java new file mode 100644 index 0000000000..fff32e3398 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/CompositeImpl.java @@ -0,0 +1,357 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Component; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Composite; +import org.apache.tuscany.model.assembly.ConfiguredProperty; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.Implementation; +import org.apache.tuscany.model.assembly.ImportWSDL; +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.OverrideOption; +import org.apache.tuscany.model.assembly.Part; +import org.apache.tuscany.model.assembly.Reference; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceContract; +import org.apache.tuscany.model.assembly.ServiceURI; +import org.apache.tuscany.model.assembly.Wire; +import org.apache.tuscany.model.util.NotifyingList; + +/** + * An implementation of Composite. + */ +public abstract class CompositeImpl extends ExtensibleImpl implements Composite { + + private String name; + private ComponentType componentType; + private Class implementationClass; + + /** + * A list of parts synchronized with a map + */ + private class PartList extends NotifyingList { + protected void added(E element) { + partsMap.put(element.getName(), element); + element.setComposite(CompositeImpl.this); + } + + protected void removed(E element) { + partsMap.remove(element.getName()); + element.setComposite(null); + } + } + + private Map partsMap = new HashMap(); + + private List components = new PartList(); + private List entryPoints = new PartList(); + private List externalServices = new PartList(); + + private List wires = new ArrayList(); + + /** + * A list of WSDL imports synchronized with a map + */ + private class ImportWSDLList extends NotifyingList { + protected void added(ImportWSDL element) { + List importList = wsdlImportsMap.get(element.getNamespace()); + if (importList == null) { + importList = new ArrayList(); + wsdlImportsMap.put(element.getNamespace(), importList); + } + importList.add(element); + } + + protected void removed(ImportWSDL element) { + List importList = wsdlImportsMap.get(element.getNamespace()); + if (importList != null) { + importList.remove(element); + if (importList.isEmpty()) + wsdlImportsMap.remove(element.getNamespace()); + } + } + } + + private Map> wsdlImportsMap = new HashMap>(); + + private List wsdlImports = new ImportWSDLList(); + + protected CompositeImpl() { + } + + public String getName() { + return name; + } + + public void setName(String newName) { + checkNotFrozen(); + name = newName; + } + + public List getComponents() { + return components; + } + + public List getEntryPoints() { + return entryPoints; + } + + public List getExternalServices() { + return externalServices; + } + + public Part getPart(String name) { + return partsMap.get(name); + } + + public List getWires() { + return wires; + } + + public List getWSDLImports() { + return wsdlImports; + } + + public List getWSDLImports(String namespace) { + return wsdlImportsMap.get(namespace); + } + + public ComponentType getComponentType() { + return componentType; + } + + public void setComponentType(ComponentType componentType) { + checkNotFrozen(); + this.componentType = componentType; + } + + public ConfiguredService getConfiguredService(ServiceURI address) { + String partName = address.getPartName(); + String serviceName = address.getServiceName(); + Part part = getPart(partName); + if (part instanceof Component) { + Component component = (Component) part; + if (serviceName != null) { + return component.getConfiguredService(serviceName); + } else { + if (!component.getConfiguredServices().isEmpty()) { + return component.getConfiguredServices().get(0); + } else { + return null; + } + } + + } + if (part instanceof ExternalService) { + ExternalService externalService = (ExternalService) part; + return externalService.getConfiguredService(); + } else + return null; + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + // Initialize WSDL imports + for (ImportWSDL importWSDL : wsdlImports) { + importWSDL.initialize(modelContext); + } + + // Initialize parts + for (Part part : externalServices) { + part.initialize(modelContext); + } + for (Part part : components) { + part.initialize(modelContext); + } + for (Part part : entryPoints) { + part.initialize(modelContext); + } + + // Derive the component type from the entry points and external services in the composite + // Also derive properties from the overridable properties of the components in the composite + if (componentType == null) { + AssemblyFactory factory = modelContext.getAssemblyFactory(); + componentType = factory.createComponentType(); + for (EntryPoint entryPoint : getEntryPoints()) { + Service service = factory.createService(); + service.setName(entryPoint.getName()); + ServiceContract serviceContract = entryPoint.getConfiguredService().getPort().getServiceContract(); + if (serviceContract != null) + service.setServiceContract(serviceContract); + componentType.getServices().add(service); + + ConfiguredReference configuredReference = entryPoint.getConfiguredReference(); + ServiceURI sourceURI = factory.createServiceURI(null, entryPoint, configuredReference); + for (String target : configuredReference.getTargets()) { + ServiceURI targetURI = factory.createServiceURI(null, target); + Wire wire = factory.createWire(); + wire.setSource(sourceURI); + wire.setTarget(targetURI); + getWires().add(wire); + } + } + for (ExternalService externalService : getExternalServices()) { + if (externalService.getOverrideOption() == null || externalService.getOverrideOption() == OverrideOption.NO) + continue; + Reference reference = factory.createReference(); + reference.setName(externalService.getName()); + ServiceContract serviceContract = externalService.getConfiguredService().getPort().getServiceContract(); + if (serviceContract != null) + reference.setServiceContract(serviceContract); + componentType.getReferences().add(reference); + } + for (Component component : getComponents()) { + for (ConfiguredProperty configuredProperty : component.getConfiguredProperties()) { + if (configuredProperty.getOverrideOption() == null || configuredProperty.getOverrideOption() == OverrideOption.NO) + continue; + componentType.getProperties().add(configuredProperty.getProperty()); + } + + for (ConfiguredReference configuredReference : component.getConfiguredReferences()) { + // Create a wire + ServiceURI sourceURI = factory.createServiceURI(null, component, configuredReference); + for (String target : configuredReference.getTargets()) { + ServiceURI targetURI = factory.createServiceURI(null, target); + Wire wire = factory.createWire(); + wire.setSource(sourceURI); + wire.setTarget(targetURI); + getWires().add(wire); + } + } + } + } + componentType.initialize(modelContext); + + // Wire the parts in this composite + wire(modelContext); + } + + /** + * Wire the parts in this composite. + * @param modelContext + */ + protected void wire(AssemblyContext modelContext) { + for (Wire wire : getWires()) { + + // Get the source reference + ServiceURI sourceURI = wire.getSource(); + ConfiguredReference configuredReference = null; + String partName = sourceURI.getPartName(); + String referenceName = sourceURI.getServiceName(); + if (referenceName != null) { + //Component component = (Component)getPart(partName); +// if (component != null) { + Part part = getPart(partName); + if (part instanceof Component) { + configuredReference = ((Component) part).getConfiguredReference(referenceName); + } else if (part instanceof EntryPoint) { + configuredReference = ((EntryPoint) part).getConfiguredReference(); + } + } else { + EntryPoint entryPoint = (EntryPoint) getPart(partName); + if (entryPoint != null) { + configuredReference = entryPoint.getConfiguredReference(); + } + } + if (configuredReference == null) { + throw new IllegalArgumentException("Cannot find wire source " + sourceURI.getPath()); + } else { + + // Resolve the target service endpoint + ServiceURI targetURI = wire.getTarget(); + ConfiguredService configuredService = getConfiguredService(targetURI); + if (configuredService != null) { + + // Wire the reference to the target + Multiplicity multiplicity = configuredReference.getPort().getMultiplicity(); + if (multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N) { + configuredReference.getTargetConfiguredServices().add(configuredService); + } else { + configuredReference.getTargetConfiguredServices().clear(); + configuredReference.getTargetConfiguredServices().add(configuredService); + } + } else { + throw new IllegalArgumentException("Cannot find service '" + targetURI.getPath() +"'."); + } + } + } + } + + public Class getImplementationClass() { + return implementationClass; + } + + public void setImplementationClass(Class clazz) { + checkNotFrozen(); + this.implementationClass = clazz; + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + // Freeze component type + if (componentType != null) + componentType.freeze(); + + // Freeze lists + wsdlImports = freeze(wsdlImports); + components = freeze(components); + entryPoints = freeze(entryPoints); + externalServices = freeze(externalServices); + wires = freeze(wires); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (!accept(wsdlImports, visitor)) + return false; + + if (!accept(partsMap.values(), visitor)) + return false; + + if (!accept(wires, visitor)) + return false; + + if (componentType != null) { + if (!componentType.accept(visitor)) + return false; + } + + return true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java new file mode 100644 index 0000000000..f1007e8c07 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPortImpl.java @@ -0,0 +1,106 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.Part; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.ConfiguredPort; +import org.apache.tuscany.model.assembly.Port; + +/** + * Implementation of ConfiguredPort. + */ +public abstract class ConfiguredPortImpl

extends AssemblyObjectImpl implements ConfiguredPort

{ + private String name; + private Part part; + private P port; + + private Object proxyFactory; + + protected ConfiguredPortImpl() { + } + + public String getName() { + return name; + } + + public void setName(String name) { + checkNotFrozen(); + this.name=name; + } + + public P getPort() { + return port; + } + + public void setPort(P port) { + checkNotFrozen(); + this.port = port; + } + + public Part getPart() { + return part; + } + + public void setPart(Part part) { + checkNotFrozen(); + this.part=part; + } + + public Object getProxyFactory() { + return proxyFactory; + } + + public void setProxyFactory(Object proxyFactory) { + checkNotFrozen(); + this.proxyFactory = proxyFactory; + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + if (port!=null) { + name=port.getName(); + port.initialize(modelContext); + } + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + if (port!=null) + port.freeze(); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (port!=null) { + if (!port.accept(visitor)) + return false; + } + + return true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java new file mode 100644 index 0000000000..4c64676451 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredPropertyImpl.java @@ -0,0 +1,102 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.ConfiguredProperty; +import org.apache.tuscany.model.assembly.OverrideOption; +import org.apache.tuscany.model.assembly.Property; + +/** + * Implementation of ConfiguredProperty + */ +public class ConfiguredPropertyImpl extends AssemblyObjectImpl implements ConfiguredProperty { + private String name; + private OverrideOption overrideOption; + private Object value; + private Property property; + + protected ConfiguredPropertyImpl() { + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Property getProperty() { + return property; + } + + public void setProperty(Property property) { + checkNotFrozen(); + this.property = property; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + checkNotFrozen(); + this.value = value; + } + + public OverrideOption getOverrideOption() { + return overrideOption; + } + + public void setOverrideOption(OverrideOption value) { + checkNotFrozen(); + this.overrideOption=value; + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + if (property!=null) + property.initialize(modelContext); + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + if (property!=null) + property.freeze(); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (property!=null) { + if (!property.accept(visitor)) + return false; + } + + return true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java new file mode 100644 index 0000000000..f21a5be52e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredReferenceImpl.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.Reference; + +/** + * An implementation of ConfiguredReference. + */ +public class ConfiguredReferenceImpl extends ConfiguredPortImpl implements ConfiguredReference { + + private List targets = new ArrayList(); + + private List targetConfiguredServices = new ArrayList(); + + protected ConfiguredReferenceImpl() { + } + + public List getTargets() { + return targets; + } + + public List getTargetConfiguredServices() { + return targetConfiguredServices; + } + + public void freeze() { + super.freeze(); + + targetConfiguredServices = freeze(targetConfiguredServices); + targets = freeze(targets); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java new file mode 100644 index 0000000000..923af1882c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ConfiguredServiceImpl.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.Service; + +/** + * An implementation of ConfiguredService. + */ +public class ConfiguredServiceImpl extends ConfiguredPortImpl implements ConfiguredService { + + protected ConfiguredServiceImpl() { + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java new file mode 100644 index 0000000000..a894a7c48f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/EntryPointImpl.java @@ -0,0 +1,116 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.EntryPoint; + +/** + * An implementation of EntryPoint. + */ +public class EntryPointImpl extends PartImpl implements EntryPoint { + + private ConfiguredService configuredService; + private ConfiguredReference configuredReference; + private List bindings=new ArrayList(); + + protected EntryPointImpl() { + } + + public ConfiguredReference getConfiguredReference() { + return configuredReference; + } + + public void setConfiguredReference(ConfiguredReference configuredReference) { + checkNotFrozen(); + configuredReference.setPart(this); + this.configuredReference=configuredReference; + } + + public ConfiguredService getConfiguredService() { + return configuredService; + } + + public void setConfiguredService(ConfiguredService configuredService) { + checkNotFrozen(); + configuredService.setPart(this); + this.configuredService=configuredService; + } + + public List getBindings() { + return bindings; + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + // Initialize the service contract and reference to the published service + if (configuredReference != null) { + configuredReference.initialize(modelContext); + } + if (configuredService != null) { + configuredService.initialize(modelContext); + } + + // Initialize the bindings + initialize(bindings, modelContext); + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + // Freeze the service contract and configured reference + if (configuredReference != null) + configuredReference.freeze(); + if (configuredService != null) + configuredService.freeze(); + + // Freeze the bindings + bindings=freeze(bindings); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (configuredReference!=null) { + if (!configuredReference.accept(visitor)) + return false; + } + + if (configuredService!=null) { + if (!configuredService.accept(visitor)) + return false; + } + + if (!accept(bindings, visitor)) + return false; + + return true; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java new file mode 100644 index 0000000000..6adf66dc9e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExtensibleImpl.java @@ -0,0 +1,75 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Extensible; + +/** + * An implementation of Extensible. + */ +public abstract class ExtensibleImpl extends AssemblyObjectImpl implements Extensible { + + private List extensibilityElements = new ArrayList(); + private List extensibilityAttributes = new ArrayList(); + + protected ExtensibleImpl() { + } + + public List getExtensibilityElements() { + return extensibilityElements; + } + + public List getExtensibilityAttributes() { + return extensibilityAttributes; + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + // Initialize extensibility elements and attributes + initialize(extensibilityElements, modelContext); + initialize(extensibilityAttributes, modelContext); + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + // Freeze extensibility elements and attributes + freeze(extensibilityElements); + freeze(extensibilityAttributes); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (!accept(extensibilityElements, visitor)) + return false; + return accept(extensibilityAttributes, visitor); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java new file mode 100644 index 0000000000..9110731c34 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ExternalServiceImpl.java @@ -0,0 +1,116 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Binding; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.ExternalService; +import org.apache.tuscany.model.assembly.OverrideOption; + +/** + * An implementation ExternalService. + */ +public class ExternalServiceImpl extends PartImpl implements ExternalService { + + private ConfiguredService configuredService; + private OverrideOption overrideOption; + private List bindings=new ArrayList(); + + private Object contextFactory; + + protected ExternalServiceImpl() { + } + + public OverrideOption getOverrideOption() { + return overrideOption; + } + + public void setOverrideOption(OverrideOption newOverridable) { + checkNotFrozen(); + overrideOption=newOverridable; + } + + public List getBindings() { + return bindings; + } + + public ConfiguredService getConfiguredService() { + return configuredService; + } + + public void setConfiguredService(ConfiguredService configuredService) { + checkNotFrozen(); + configuredService.setPart(this); + this.configuredService=configuredService; + } + + public Object getContextFactory() { + return contextFactory; + } + + public void setContextFactory(Object contextFactory) { + this.contextFactory=contextFactory; + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + // Initialize the configured service + if (configuredService != null) { + configuredService.initialize(modelContext); + } + + // Initialize the bindings + initialize(bindings, modelContext); + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + // Freeze the configured service + if (configuredService!= null) + configuredService.freeze(); + + // Freeze the bindings + bindings=freeze(bindings); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (configuredService!=null) { + if (!configuredService.accept(visitor)) + return false; + } + + if (!accept(bindings, visitor)) + return false; + + return true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java new file mode 100644 index 0000000000..a44d80cc66 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImplementationImpl.java @@ -0,0 +1,72 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Implementation; + +/** + * An implementation of Implementation. + */ +public abstract class ImplementationImpl extends ExtensibleImpl implements Implementation { + + private ComponentType componentType; + + public ComponentType getComponentType() { + return componentType; + } + + public void setComponentType(ComponentType componentType) { + checkNotFrozen(); + this.componentType=componentType; + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + // Initialize the component type + if (componentType!=null) { + componentType.initialize(modelContext); + } + + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + if (componentType!=null) + componentType.freeze(); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (componentType!=null) { + if (!componentType.accept(visitor)) + return false; + } + return true; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java new file mode 100644 index 0000000000..56aedd18f5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ImportWSDLImpl.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import java.net.URL; + +import javax.wsdl.Definition; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.ImportWSDL; + +/** + * Implementation of ImportWSDL. + * + * @version $Rev$ $Date$ + */ +public class ImportWSDLImpl extends AssemblyObjectImpl implements ImportWSDL { + private String location; + private String namespace; + private Definition definition; + + protected ImportWSDLImpl() { + } + + public String getLocation() { + return location; + } + + public void setLocation(String uri) { + checkNotFrozen(); + this.location = uri; + } + + public String getNamespace() { + return namespace; + } + + public void setNamespace(String uri) { + checkNotFrozen(); + this.namespace = uri; + } + + public Definition getDefinition() { + return definition; + } + + public void setDefinition(Definition definition) { + checkNotFrozen(); + this.definition = definition; + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + // Load the WSDL definition if necessary + ResourceLoader resourceLoader = modelContext.getApplicationResourceLoader(); + if (definition == null) { + URL url = resourceLoader.getResource(location); + if (url == null) + throw new IllegalArgumentException("Cannot find " + location); + definition = modelContext.getAssemblyLoader().loadDefinition(url.toString()); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java new file mode 100644 index 0000000000..60cb42a981 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleComponentImpl.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleComponent; + +/** + * An implementation of ModuleComponent. + */ +public class ModuleComponentImpl extends ComponentImpl implements ModuleComponent { + + private String uri; + + protected ModuleComponentImpl() { + } + + public String getURI() { + return uri; + } + + public void setURI(String value) { + checkNotFrozen(); + uri=value; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java new file mode 100644 index 0000000000..08536d23b8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleFragmentImpl.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.ModuleFragment; + +/** + * An implementation of ModuleFragment. + */ +public class ModuleFragmentImpl extends CompositeImpl implements ModuleFragment { + + protected ModuleFragmentImpl() { + } + + protected void wire(AssemblyContext modelContext) { + // No wiring inside a module fragment + // Wires are handled at the module level + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java new file mode 100644 index 0000000000..f64317ac86 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ModuleImpl.java @@ -0,0 +1,104 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Module; +import org.apache.tuscany.model.assembly.ModuleFragment; +import org.apache.tuscany.model.util.NotifyingList; + +/** + * An implementation of Module. + */ +public class ModuleImpl extends CompositeImpl implements Module { + + /** + * A list of module fragments synchronized with a map + */ + private class ModuleFragmentList extends NotifyingList { + protected void added(E element) { + moduleFragmentsMap.put(element.getName(), element); + } + + protected void removed(E element) { + moduleFragmentsMap.remove(element.getName()); + } + } + + private List moduleFragments = new ModuleFragmentList(); + private Map moduleFragmentsMap = new HashMap(); + + /** + * Constructor + */ + protected ModuleImpl() { + } + + public List getModuleFragments() { + return moduleFragments; + } + + public ModuleFragment getModuleFragment(String name) { + checkInitialized(); + return moduleFragmentsMap.get(name); + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + + // Initialize module fragments + for (ModuleFragment moduleFragment : moduleFragments) { + + // Add all WSDL imports, components, entry points and external services from the module fragments + getWSDLImports().addAll(moduleFragment.getWSDLImports()); + getComponents().addAll(moduleFragment.getComponents()); + getEntryPoints().addAll(moduleFragment.getEntryPoints()); + getExternalServices().addAll(moduleFragment.getExternalServices()); + + // Add all the wires from the module fragments + getWires().addAll(moduleFragment.getWires()); + + moduleFragment.initialize(modelContext); + } + + // Initialize the composite + super.initialize(modelContext); + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + moduleFragments = freeze(moduleFragments); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + return accept(moduleFragments, visitor); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java new file mode 100644 index 0000000000..3743c7505b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PartImpl.java @@ -0,0 +1,61 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.Composite; +import org.apache.tuscany.model.assembly.Part; + +/** + * Implementation of Part. + */ +public abstract class PartImpl extends ExtensibleImpl implements Part { + private Composite composite; + private String name; + + private Object contextFactory; + + protected PartImpl() { + } + + public String getName() { + return name; + } + + public void setName(String value) { + checkNotFrozen(); + name=value; + } + + public Composite getComposite() { + return composite; + } + + public void setComposite(Composite composite) { + checkNotFrozen(); + this.composite=composite; + } + + public Object getContextFactory() { + return contextFactory; + } + + public void setContextFactory(Object contextFactory) { + checkNotFrozen(); + this.contextFactory=contextFactory; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java new file mode 100644 index 0000000000..c11cee590a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PortImpl.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyVisitor; +import org.apache.tuscany.model.assembly.Port; +import org.apache.tuscany.model.assembly.ServiceContract; + +/** + * An implementation of Port. + */ +public abstract class PortImpl extends AssemblyObjectImpl implements Port { + + private ServiceContract serviceContract; + private String name; + + protected PortImpl() { + } + + public String getName() { + return name; + } + + public void setName(String value) { + checkNotFrozen(); + name=value; + } + + public ServiceContract getServiceContract() { + return serviceContract; + } + + public void setServiceContract(ServiceContract value) { + checkNotFrozen(); + serviceContract=value; + } + + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + if (serviceContract!=null) + serviceContract.initialize(modelContext); + } + + public void freeze() { + if (isFrozen()) + return; + super.freeze(); + + if (serviceContract!=null) + serviceContract.freeze(); + } + + public boolean accept(AssemblyVisitor visitor) { + if (!super.accept(visitor)) + return false; + + if (serviceContract!=null) { + if (!serviceContract.accept(visitor)) + return false; + } + + return true; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java new file mode 100644 index 0000000000..e91245504b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/PropertyImpl.java @@ -0,0 +1,80 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.Property; + +/** + * An implementation of Property. + */ +public class PropertyImpl extends ExtensibleImpl implements Property { + + private Object defaultValue; + private String name; + private boolean many; + private boolean required; + private Class type; + + protected PropertyImpl() { + } + + public Object getDefaultValue() { + return defaultValue; + } + + public String getName() { + return name; + } + + public Class getType() { + return type; + } + + public boolean isMany() { + return many; + } + + public boolean isRequired() { + return required; + } + + public void setDefaultValue(Object value) { + checkNotFrozen(); + defaultValue = value; + } + + public void setMany(boolean value) { + checkNotFrozen(); + many = value; + } + + public void setName(String value) { + checkNotFrozen(); + name = value; + } + + public void setRequired(boolean value) { + checkNotFrozen(); + required = value; + } + + public void setType(Class value) { + checkNotFrozen(); + type = value; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java new file mode 100644 index 0000000000..1a064e5092 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ReferenceImpl.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.Multiplicity; +import org.apache.tuscany.model.assembly.Reference; + +/** + * An implementation of Reference. + */ +public class ReferenceImpl extends PortImpl implements Reference { + + private Multiplicity multiplicity; + + protected ReferenceImpl() { + } + + public Multiplicity getMultiplicity() { + return multiplicity; + } + + public void setMultiplicity(Multiplicity multiplicity) { + checkNotFrozen(); + this.multiplicity=multiplicity; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java new file mode 100644 index 0000000000..f71702792b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceContractImpl.java @@ -0,0 +1,60 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.Scope; +import org.apache.tuscany.model.assembly.ServiceContract; + +/** + * An implementation of ServiceContract. + */ +public class ServiceContractImpl extends ExtensibleImpl implements ServiceContract { + + private Class interface_; + private Class callbackInterface; + private Scope scope; + + protected ServiceContractImpl() { + } + + public Class getCallbackInterface() { + return callbackInterface; + } + + public Class getInterface() { + return interface_; + } + + public Scope getScope() { + return scope; + } + + public void setCallbackInterface(Class value) { + checkNotFrozen(); + callbackInterface=value; + } + + public void setInterface(Class value) { + checkNotFrozen(); + interface_=value; + } + + public void setScope(Scope scope) { + checkNotFrozen(); + this.scope=scope; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java new file mode 100644 index 0000000000..d1432d0149 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceImpl.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.Service; + +/** + * An implementation of Service. + */ +public class ServiceImpl extends PortImpl implements Service { + + protected ServiceImpl() { + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java new file mode 100644 index 0000000000..ef180814ff --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/ServiceURIImpl.java @@ -0,0 +1,210 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.ConfiguredPort; +import org.apache.tuscany.model.assembly.ConfiguredReference; +import org.apache.tuscany.model.assembly.ConfiguredService; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.Part; +import org.apache.tuscany.model.assembly.Service; +import org.apache.tuscany.model.assembly.ServiceURI; + +/** + * An implementation of ServiceURI. + */ +public class ServiceURIImpl implements ServiceURI { + + private String address; + private Boolean isSCAScheme; + private boolean isParsed; + private String moduleComponentName; + private String partName; + private String serviceName; + + /** + * Constructs a new ServiceURIImpl. + * @param address + */ + protected ServiceURIImpl(String address) { + this.address = address; + } + + /** + * Constructs a new ServiceURIImpl. + * @param moduleComponent + * @param partName + * @param portName + */ + protected ServiceURIImpl(ModuleComponent moduleComponent, String partName, String portName) { + if (moduleComponent != null) + moduleComponentName = moduleComponent.getName(); + else + moduleComponentName = ""; + this.partName = partName; + this.serviceName = portName; + } + + /** + * Constructs a new ServiceURIImpl. + * @param moduleComponent + * @param configuredPort + */ + protected ServiceURIImpl(ModuleComponent moduleComponent, Part part, ConfiguredPort configuredPort) { + if (moduleComponent != null) + moduleComponentName = moduleComponent.getName(); + else + moduleComponentName = ""; + if (configuredPort instanceof ConfiguredService) { + partName = part.getName(); + ConfiguredService configuredService = (ConfiguredService) configuredPort; + Service service = configuredService.getPort(); + if (service != null) { + serviceName = configuredService.getPort().getName(); + address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName; + } else { + address = "sca:///" + moduleComponentName + '/' + partName; + } + + } else if (configuredPort instanceof ConfiguredReference) { + ConfiguredReference configuredReference = (ConfiguredReference) configuredPort; + partName = part.getName(); + serviceName = configuredReference.getPort().getName(); + if (serviceName!=null) + address = "sca:///" + moduleComponentName + '/' + partName + '/' + serviceName; + else + address = "sca:///" + moduleComponentName + '/' + partName; + } + + isSCAScheme = Boolean.TRUE; + isParsed = true; + } + + /** + * Constructor + * + * @param moduleComponent + * @param targetServiceName + */ + protected ServiceURIImpl(ModuleComponent moduleComponent, String targetServiceName) { + if (moduleComponent != null) + moduleComponentName = moduleComponent.getName(); + else + moduleComponentName = ""; + int s = targetServiceName.indexOf('/'); + if (s == -1) { + partName = targetServiceName; + address = "sca:///" + moduleComponentName + '/' + partName; + } else { + partName = targetServiceName.substring(0, s); + this.serviceName = targetServiceName.substring(s + 1); + address = "sca:///" + moduleComponentName + '/' + partName + '/' + this.serviceName; + } + isSCAScheme = Boolean.TRUE; + isParsed = true; + } + + public boolean isSCAScheme() { + if (isSCAScheme == null) { + if (address != null && address.startsWith("sca://")) { + isSCAScheme = Boolean.TRUE; + } else { + isSCAScheme = Boolean.FALSE; + } + } + return isSCAScheme.booleanValue(); + } + + public String getAddress() { + return address; + } + + public String getPath() { + StringBuffer path = new StringBuffer(); + String mc = getModuleComponentName(); + if (mc != null) { + path.append(mc); + } + String p = getPartName(); + if (p !=null) { + if (path.length()!=0) + path.append('/'); + path.append(p); + } + String s = getServiceName(); + if (s !=null) { + if (path.length()!=0) + path.append('/'); + path.append(s); + } + return path.toString(); + } + + /** + * Parse the address. + */ + private void parse() { + isParsed = true; + if (isSCAScheme()) { + int s1 = address.indexOf('/', 6); + if (s1 == -1) + return; + s1++; + int s2 = address.indexOf('/', s1); + if (s2 == -1) + return; + moduleComponentName = address.substring(s1, s2); + s2++; + int s3 = address.indexOf('/', s2); + if (s3 == -1) { + partName = address.substring(s2); + return; + } + partName = address.substring(s2, s3); + s3++; + serviceName = address.substring(s3); + } + } + + /** + * Returns the module component name + */ + public String getModuleComponentName() { + if (!isParsed) + parse(); + return moduleComponentName; + } + + /** + * Returns the part name + */ + public String getPartName() { + if (!isParsed) + parse(); + return partName; + } + + /** + * Returns the service name + */ + public String getServiceName() { + if (!isParsed) + parse(); + return serviceName; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java new file mode 100644 index 0000000000..334e34ba5b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/SubsystemImpl.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.ComponentType; +import org.apache.tuscany.model.assembly.Subsystem; + +/** + * An implementation of Subsystem. + */ +public class SubsystemImpl extends CompositeImpl implements Subsystem { + + private String uri; + + protected SubsystemImpl() { + } + + public String getURI() { + return uri; + } + + public void setURI(String value) { + checkNotFrozen(); + uri=value; + } + + public ComponentType getComponentType() { + //TODO implement + return null; + } + + public void setComponentType(ComponentType componentType) { + } + + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java new file mode 100644 index 0000000000..c7c4bda7a1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/impl/WireImpl.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.impl; + +import org.apache.tuscany.model.assembly.ServiceURI; +import org.apache.tuscany.model.assembly.Wire; + +/** + * An implementation of Wire. + */ +public class WireImpl extends ExtensibleImpl implements Wire { + + private ServiceURI source; + private ServiceURI target; + + protected WireImpl() { + } + + public ServiceURI getSource() { + return source; + } + + public void setSource(ServiceURI uri) { + checkNotFrozen(); + source=uri; + } + + public ServiceURI getTarget() { + return target; + } + + public void setTarget(ServiceURI uri) { + checkNotFrozen(); + target=uri; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java new file mode 100644 index 0000000000..95793cc439 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/assembly/loader/AssemblyModelLoader.java @@ -0,0 +1,38 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.loader; + +import java.util.List; + +import javax.wsdl.Definition; + +/** + * An assembly model loader. + */ +public interface AssemblyModelLoader { + + /** + * Load a WSDL definition + */ + Definition loadDefinition(String uri); + + /** + * Load definitions by namespace + */ + List loadDefinitions(String namespace); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java new file mode 100644 index 0000000000..6c5e0ef75d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/AssemblyModelLoadException.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.apache.tuscany.model.scdl.loader.impl; + +import org.apache.tuscany.common.TuscanyRuntimeException; + +/** + * The root runtime exception for the model loader. + * + * @version $Rev$ $Date$ + */ +public class AssemblyModelLoadException extends TuscanyRuntimeException { + private static final long serialVersionUID = -5891723952359470362L; + + public AssemblyModelLoadException() { + super(); + } + + public AssemblyModelLoadException(String message) { + super(message); + } + + public AssemblyModelLoadException(String message, Throwable cause) { + super(message, cause); + } + + public AssemblyModelLoadException(Throwable cause) { + super(cause); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java new file mode 100644 index 0000000000..8413350e50 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/scdl/loader/impl/SCDLAssemblyModelLoaderImpl.java @@ -0,0 +1,71 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.scdl.loader.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.wsdl.Definition; +import javax.wsdl.WSDLException; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; + +import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; + +/** + */ +public class SCDLAssemblyModelLoaderImpl implements AssemblyModelLoader { + private WSDLReader wsdlReader; + private Map definitions=new HashMap(); + private Map> definitionsByNamespace=new HashMap>(); + + public Definition loadDefinition(String uri) { + Definition definition=definitions.get(uri); + if (definition!=null) + return definition; + + try { + if (wsdlReader==null) { + wsdlReader=WSDLFactory.newInstance().newWSDLReader(); + wsdlReader.setFeature("javax.wsdl.verbose", false); + } + definition = wsdlReader.readWSDL(uri); + } catch (WSDLException e) { + throw new IllegalArgumentException(e); + } + if (definition==null) + throw new IllegalArgumentException("Could not load WSDL definition at "+uri); + + definitions.put(uri, definition); + + String namespace=definition.getTargetNamespace(); + List list=definitionsByNamespace.get(namespace); + if (list==null) { + list=new ArrayList(); + definitionsByNamespace.put(namespace, list); + } + list.add(definition); + + return definition; + } + + public List loadDefinitions(String namespace) { + return definitionsByNamespace.get(namespace); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java new file mode 100644 index 0000000000..68f9dfa6f8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/JavaServiceContract.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.types.java; + +import org.apache.tuscany.model.assembly.ServiceContract; + + +/** + * Represents a Java service contract. + */ +public interface JavaServiceContract extends ServiceContract { + + String getInterfaceName(); + + void setInterfaceName(String interfaceName); + + String getCallbackInterfaceName(); + + void setCallbackInterfaceName(String callbackInterfaceName); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java new file mode 100644 index 0000000000..d384bcd670 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/java/impl/JavaServiceContractImpl.java @@ -0,0 +1,89 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.types.java.impl; + +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.impl.ServiceContractImpl; +import org.apache.tuscany.model.types.java.JavaServiceContract; + +/** + * An implementation of JavaServiceContract. + */ +public class JavaServiceContractImpl extends ServiceContractImpl implements JavaServiceContract { + + private String interfaceName; + private String callbackInterfaceName; + + /** + * Constructor + */ + public JavaServiceContractImpl() { + } + + /** + * @param interfaceName The interfaceName to set. + */ + public void setInterfaceName(String interfaceName) { + this.interfaceName = interfaceName; + } + + /** + * @param callbackInterfaceName The callbackInterfaceName to set. + */ + public void setCallbackInterfaceName(String callbackInterfaceName) { + this.callbackInterfaceName = callbackInterfaceName; + } + + public String getInterfaceName() { + return interfaceName; + } + + public String getCallbackInterfaceName() { + return callbackInterfaceName; + } + + /** + * @see org.apache.tuscany.model.assembly.impl.ExtensibleImpl#initialize(org.apache.tuscany.model.assembly.AssemblyContext) + */ + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + + // Load the interface + if (getInterface()==null && interfaceName!=null) { + try { + Class interfaceClass=modelContext.getApplicationResourceLoader().loadClass(interfaceName); + setInterface(interfaceClass); + } catch (ClassNotFoundException e) { + throw new IllegalArgumentException(e); + } + } + + // Load the callback interface + if (getCallbackInterface()==null && callbackInterfaceName!=null) { + try { + Class callbackInterfaceClass=modelContext.getApplicationResourceLoader().loadClass(callbackInterfaceName); + setInterface(callbackInterfaceClass); + } catch (ClassNotFoundException e) { + throw new IllegalArgumentException(e); + } + } + + super.initialize(modelContext); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java new file mode 100644 index 0000000000..999242a4c2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/WSDLServiceContract.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.types.wsdl; + +import javax.wsdl.PortType; + +import org.apache.tuscany.model.assembly.ServiceContract; + +/** + * A WSDL service contract. + */ +public interface WSDLServiceContract extends ServiceContract { + + /** + * Returns the WSDL portType. + * @return the WSDL portType + */ + PortType getPortType(); + + /** + * Sets the WSDL portType. + * @param portType + */ + void setPortType(PortType portType); + + /** + * Returns the callback WSDL portType. + * @return the callback WSDL portType + */ + PortType getCallbackPortType(); + + /** + * Sets the callback WSDL portType. + * @param portType + */ + void setCallbackPortType(PortType portType); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java new file mode 100644 index 0000000000..a596eb539f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/types/wsdl/impl/WSDLServiceContractImpl.java @@ -0,0 +1,234 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.types.wsdl.impl; + +import static org.objectweb.asm.Opcodes.ACC_ABSTRACT; +import static org.objectweb.asm.Opcodes.ACC_INTERFACE; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.V1_5; + +import java.util.ArrayList; +import java.util.List; + +import javax.wsdl.Operation; +import javax.wsdl.Part; +import javax.wsdl.PortType; +import javax.xml.namespace.QName; + +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.impl.ServiceContractImpl; +import org.apache.tuscany.model.types.wsdl.WSDLServiceContract; +import org.apache.tuscany.model.util.XMLNameUtil; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Type; + +import commonj.sdo.Property; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XSDHelper; + +/** + * An implementation of WSDLServiceContract. + */ +public class WSDLServiceContractImpl extends ServiceContractImpl implements WSDLServiceContract { + + private PortType portType; + + private PortType callbackPortType; + + private static final String[] EMPTY_STRINGS = new String[0]; + + /** + * Constructor + */ + public WSDLServiceContractImpl() { + } + + public PortType getPortType() { + return portType; + } + + public void setPortType(PortType portType) { + checkNotFrozen(); + this.portType = portType; + } + + public PortType getCallbackPortType() { + return callbackPortType; + } + + public void setCallbackPortType(PortType portType) { + checkNotFrozen(); + callbackPortType = portType; + } + + /** + * @see org.apache.tuscany.model.assembly.impl.ExtensibleImpl#initialize(org.apache.tuscany.model.assembly.AssemblyContext) + */ + public void initialize(AssemblyContext modelContext) { + if (isInitialized()) + return; + super.initialize(modelContext); + + // Load the Java interface for the portType + if (portType != null && getInterface() == null) { + QName qname = portType.getQName(); + String interfaceName = XMLNameUtil.getFullyQualifiedClassNameFromQName(qname.getNamespaceURI(), qname.getLocalPart()); + Class interfaceClass; + try { + // Load the interface + interfaceClass = modelContext.getApplicationResourceLoader().loadClass(interfaceName); + } catch (ClassNotFoundException e) { + // Generate the interface on the fly + interfaceClass = generateJavaInterface(modelContext.getTypeHelper(), modelContext.getApplicationResourceLoader(), portType, interfaceName); + } + super.setInterface(interfaceClass); + } + + // Load the Java interface for the callback portType + if (callbackPortType != null && getCallbackInterface() == null) { + QName qname = callbackPortType.getQName(); + String interfaceName = XMLNameUtil.getFullyQualifiedClassNameFromQName(qname.getNamespaceURI(), qname.getLocalPart()); + Class interfaceClass; + try { + // Load the interface + interfaceClass = modelContext.getApplicationResourceLoader().loadClass(interfaceName); + } catch (ClassNotFoundException e) { + // Generate the interface on the fly + interfaceClass = generateJavaInterface(modelContext.getTypeHelper(), modelContext.getApplicationResourceLoader(), portType, interfaceName); + } + super.setCallbackInterface(interfaceClass); + } + } + + /** + * Generate a Java interface from a WSDL portType. + * + * @param portType + * @param interfaceName + * @return a Java interface that provides the same service contract as the WSDL portType + */ + @SuppressWarnings("unchecked") + private static Class generateJavaInterface(TypeHelper typeHelper, ResourceLoader resourceLoader, PortType portType, String interfaceName) { + + ClassLoader cl=Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(resourceLoader.getClassLoader()); + + // Create an XSD helper + XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper); + + ClassWriter cw = new ClassWriter(false); + + // Generate the interface + interfaceName = interfaceName.replace('.', '/'); + cw.visit(V1_5, ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, interfaceName, null, "java/lang/Object", EMPTY_STRINGS); + + // Generate methods from the WSDL operations + for (Operation operation : (List) portType.getOperations()) { + + //FIXME Workaround for TUSCANY-170, we will need to make this consistent with the algorithm used by Axis2 WSDL2Java + // to generate method names from operations names + //String methodName = XMLNameUtil.getJavaNameFromXMLName(operation.getName(), false); + String methodName = operation.getName(); + + // FIXME later we may want to wwitch to use the Axis2 WSDL2Java (not to generate the Java source, + // just to figure the WSDL to Java mapping) + + // Derive the method signature from the input message part (and check if it's a doc-wrapped or doc-bare operation) + List inputTypes=new ArrayList(); + boolean wrapped = false; + if (operation.getInput() != null && operation.getInput().getMessage()!=null && !operation.getInput().getMessage().getParts().isEmpty()) { + QName qname=((Part)operation.getInput().getMessage().getParts().values().iterator().next()).getElementName(); + if (qname!=null) { + Property property = xsdHelper.getGlobalProperty(qname.getNamespaceURI(), qname.getLocalPart(), true); + commonj.sdo.Type type = property.getType(); + if (property.getName().equals(operation.getName())) { + String localName = xsdHelper.getLocalName(type); + if (localName.indexOf("_._")!=-1) { + for (Property param : (List)type.getProperties()) { + Class inputType = param.getType().getInstanceClass(); + if (inputType == null) + inputType = Object.class; + inputTypes.add(inputType); + } + wrapped=true; + } + } + + // Bare doc style + if (!wrapped) { + Class inputType = type.getInstanceClass(); + if (inputType == null) + inputType = Object.class; + inputTypes.add(inputType); + } + + } else { + // FIXME only support elements for now + } + } + + // Derive the return type from the output message part (also support doc-wrapped and doc-bare here) + Class outputType=Void.class; + if (operation.getOutput() != null && operation.getOutput().getMessage()!=null && !operation.getOutput().getMessage().getParts().isEmpty()) { + QName qname=((Part)operation.getOutput().getMessage().getParts().values().iterator().next()).getElementName(); + if (qname!=null) { + Property property = xsdHelper.getGlobalProperty(qname.getNamespaceURI(), qname.getLocalPart(), true); + commonj.sdo.Type type = property.getType(); + if (wrapped) { + if (!type.getProperties().isEmpty()) { + outputType=((Property)type.getProperties().get(0)).getType().getInstanceClass(); + if (outputType==null) + outputType=Object.class; + } + } else { + outputType = type.getInstanceClass(); + if (outputType==null) + outputType=Object.class; + } + } else { + // FIXME only support elements for now + } + } + + // FIXME integrate XSD to Java type mapping here + StringBuffer inputSignature=new StringBuffer(); + for (Class inputType : inputTypes) { + inputSignature.append(Type.getDescriptor(inputType)); + } + String outputSignature = Type.getDescriptor(outputType); + + cw.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, methodName, '(' + inputSignature.toString() + ')' + outputSignature, null, null).visitEnd(); + } + + // Generate the bytecodes + cw.visitEnd(); + byte[] bytes = cw.toByteArray(); + + // Add the class to the resource loader + + return resourceLoader.addClass(bytes); + + } finally { + Thread.currentThread().setContextClassLoader(cl); + } + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java new file mode 100644 index 0000000000..1f064e0977 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/util/NotifyingList.java @@ -0,0 +1,108 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * A list that invokes added or removed methods when elements are added or removed. + * + */ +public abstract class NotifyingList extends ArrayList { + + private boolean frozen; + + public NotifyingList() { + } + + public void freeze() { + frozen=true; + } + + protected void checkNotFrozen() { + if (frozen) + throw new IllegalStateException("Attempt to modify a frozen list"); + } + + public boolean add(E element) { + checkNotFrozen(); + boolean result=super.add(element); + added(element); + return result; + } + + public void add(int index, E element) { + checkNotFrozen(); + super.add(index, element); + added(element); + } + + public boolean addAll(Collection c) { + checkNotFrozen(); + boolean result=super.addAll(c); + for (E element : c) + added(element); + return result; + } + + public boolean addAll(int index, Collection c) { + checkNotFrozen(); + boolean result=super.addAll(index, c); + for (E element : c) + added(element); + return result; + } + + public void clear() { + checkNotFrozen(); + List l=new ArrayList(this); + super.clear(); + for (E element : l) + removed(element); + } + + public E remove(int index) { + checkNotFrozen(); + E element=super.remove(index); + removed(element); + return element; + } + + @SuppressWarnings("unchecked") + public boolean remove(Object element) { + checkNotFrozen(); + boolean result=super.remove(element); + removed((E)element); + return result; + } + + @SuppressWarnings("unchecked") + public boolean removeAll(Collection c) { + checkNotFrozen(); + boolean result=super.removeAll(c); + for (E element : (Collection)c) + removed(element); + return result; + } + + protected abstract void added(E element); + + protected abstract void removed(E element); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java new file mode 100644 index 0000000000..f493356594 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/java/org/apache/tuscany/model/util/XMLNameUtil.java @@ -0,0 +1,212 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.util; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder; + + + +/** + * A utility class that converts between XML names and Java names. + */ +public final class XMLNameUtil { + + private static final List DOMAINS = Arrays.asList(new String[]{"COM", "com", "ORG", "org"}); + + /** + * Constructor + */ + private XMLNameUtil() { + super(); + } + + /** + * Return an EPackage name for the given namespace. + * + * @param namespace + * @return an EPackage name for the given namespace + */ + public static String getPackageNameFromNamespace(String namespace) { + return org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getDefaultPackageName(namespace); + } + + /** + * Trim the file extension from a path. + * @param path + * @return + */ + private static String trimFileExtension(String path) { + int s=path.lastIndexOf('/'); + int d=path.lastIndexOf('.'); + if (d>s) { + return path.substring(0,d); + } else { + return path; + } + } + + /** + * Returns a namespace prefix for the given package Name. + * + * @param packageName + * @return a namespace prefix for the given package Name + */ + public static String getNSPrefixFromPackageName(String packageName) { + int index = packageName.lastIndexOf('.'); + return index == -1 ? packageName : packageName.substring(index + 1); + } + + /** + * Parse the given name. + * + * @param sourceName + * @param separator + * @return some stuff parsed from the name + */ + private static List parseName(String sourceName, char separator) { + List result = new ArrayList(); + if (sourceName != null) { + StringBuilder currentWord = new StringBuilder(64); + boolean lastIsLower = false; + int index; + int length; + for (index = 0, length = sourceName.length(); index < length; ++index) { + char curChar = sourceName.charAt(index); + if (!Character.isJavaIdentifierPart(curChar)) { + curChar = separator; + } + if (Character.isUpperCase(curChar) + || (!lastIsLower && Character.isDigit(curChar)) + || curChar == separator) { + + if (lastIsLower && currentWord.length() > 1 + || curChar == separator && currentWord.length() > 0) { + result.add(currentWord.toString()); + currentWord = new StringBuilder(64); + } + lastIsLower = false; + } else { + if (!lastIsLower) { + int currentWordLength = currentWord.length(); + if (currentWordLength > 1) { + char lastChar = currentWord.charAt(--currentWordLength); + currentWord.setLength(currentWordLength); + result.add(currentWord.toString()); + currentWord = new StringBuilder(64); + currentWord.append(lastChar); + } + } + lastIsLower = true; + } + + if (curChar != separator) { + currentWord.append(curChar); + } + } + + result.add(currentWord.toString()); + } + return result; + } + + /** + * Returns a valid Java name from an XML Name. + * + * @param name + * @param isUpperCase + * @return a valid Java name from an XML Name + */ + public static String getJavaNameFromXMLName(String name, boolean isUpperCase) { + List parsedName = parseName(name, '_'); + StringBuilder result = new StringBuilder(64 * parsedName.size()); + for (String nameComponent: parsedName) { + if (nameComponent.length() > 0) { + if (result.length() > 0 || isUpperCase) { + result.append(Character.toUpperCase(nameComponent.charAt(0))); + result.append(nameComponent.substring(1)); + } else { + result.append(nameComponent); + } + } + } + + if (result.length() == 0) { + return "_"; + } + if (Character.isJavaIdentifierStart(result.charAt(0))) { + return isUpperCase ? result.toString() : decapitalizeName(result.toString()); + } + return "_" + result; + } + + /** + * Returns a valid fully qualified class name from a QName. + * @param namespace + * @param name + * @return a valid fully qualified class name from a QName + */ + public static String getFullyQualifiedClassNameFromQName(String namespace, String name) { + return XMLNameUtil.getPackageNameFromNamespace(namespace) + '.' + + XMLNameUtil.getJavaNameFromXMLName(name, true); + } + + /** + * Decapitalize a name. + * @param name + * @return a decapitalized name + */ + public static String decapitalizeName(String name) { + if (name.length() == 0) { + return name; + } else { + String lowerName = name.toLowerCase(); + int i; + for (i = 0; i < name.length(); i++) { + if (name.charAt(i) == lowerName.charAt(i)) { + break; + } + } + if (i > 1 && i < name.length()) { + --i; + } + return name.substring(0, i).toLowerCase() + name.substring(i); + } + } + + /** + * Capitalize a name. + * @param name + * @return a capitalized name + */ + public static String capitalizeName(String name) { + int l = name.length(); + if (l == 0) { + return name; + } else if (l == 1) { + return name.toUpperCase(); + } else { + return name.substring(0, 1).toUpperCase() + name.substring(1); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-binding-sca.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-binding-sca.xsd new file mode 100644 index 0000000000..3b003ce77a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-binding-sca.xsd @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd new file mode 100644 index 0000000000..79131506c4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-binding-webservice.xsd @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-core.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-core.xsd new file mode 100644 index 0000000000..7d3ca73676 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-core.xsd @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-implementation-java.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-implementation-java.xsd new file mode 100644 index 0000000000..d7998a355c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-implementation-java.xsd @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-interface-java.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-interface-java.xsd new file mode 100644 index 0000000000..2b3f263b52 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-interface-java.xsd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd new file mode 100644 index 0000000000..3649f4d898 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca-interface-wsdl.xsd @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca.xsd new file mode 100644 index 0000000000..d49dfeff79 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/model/sca.xsd @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties new file mode 100644 index 0000000000..4581e44bff --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/main/resources/org/apache/tuscany/model/Messages.properties @@ -0,0 +1,25 @@ +# 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. +# ==================================================================== +# To code developer: +# Do NOT change the properties between this line and the +# "%%% END OF TRANSLATED PROPERTIES %%%" line. +# Make a new property name, append to the end of the file and change +# the code to use the new property. +# ==================================================================== + +# ===================================================================== +# %%% END OF TRANSLATED PROPERTIES %%% +# ===================================================================== +# NLS_MESSAGEFORMAT_ALL diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountReport.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountReport.java new file mode 100644 index 0000000000..b1b5913adc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountReport.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.account; + +import java.util.List; + +/** + * @model + */ + +public interface AccountReport { + + /** + * @model type="services.account.AccountSummary" + */ + + List getAccountSummaries(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.java new file mode 100644 index 0000000000..83df13439a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.java @@ -0,0 +1,25 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.account; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface AccountService { + + public AccountReport getAccountReport(String customerID); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.wsdl new file mode 100644 index 0000000000..baf9ecd81d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountService.wsdl @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java new file mode 100644 index 0000000000..a5619bb41e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.account; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +import org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata.AccountDataService; +import org.apache.tuscany.model.assembly.tests.bigbank.account.services.stockquote.StockQuoteService; + +public class AccountServiceImpl implements AccountService { + + @Property + public String currency = "USD"; + + @Reference + public AccountDataService accountDataService; + @Reference + public StockQuoteService stockQuoteService; + + public AccountServiceImpl() { + } + + public AccountReport getAccountReport(String customerID) { + return null; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountSummary.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountSummary.java new file mode 100644 index 0000000000..c1650c79fa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/account/AccountSummary.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.account; + +/** + * @model + */ + +public interface AccountSummary { + + /** + * @model + */ + String getAccountNumber(); + + void setAccountNumber(String accountNumber); + + /** + * @model + */ + String getAccountType(); + + void setAccountType(String accountType); + + /** + * @model + */ + float getBalance(); + + void setBalance(float balance); +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java new file mode 100644 index 0000000000..04ae8e5bd5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata; + +public interface AccountDataService { + + CheckingAccount getCheckingAccount(String customerID); + + SavingsAccount getSavingsAccount(String customerID); + + StockAccount getStockAccount(String customerID); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..4d5eee1f01 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata; + +public class AccountDataServiceImpl implements AccountDataService { + + public CheckingAccount getCheckingAccount(String customerID) { + + CheckingAccount checkingAccount = new CheckingAccount(); + checkingAccount.setAccountNumber(customerID + "_CHA12345"); + checkingAccount.setBalance(1500.0f); + + return checkingAccount; + } + + public SavingsAccount getSavingsAccount(String customerID) { + + SavingsAccount savingsAccount = new SavingsAccount(); + savingsAccount.setAccountNumber(customerID + "_SAA12345"); + savingsAccount.setBalance(1500.0f); + + return savingsAccount; + } + + public StockAccount getStockAccount(String customerID) { + + StockAccount stockAccount = new StockAccount(); + stockAccount.setAccountNumber(customerID + "_STA12345"); + stockAccount.setSymbol("IBM"); + stockAccount.setQuantity(100); + + return stockAccount; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java new file mode 100644 index 0000000000..d4f2f8be6c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata; + +public class CheckingAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java new file mode 100644 index 0000000000..73474585da --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata; + +public class SavingsAccount { + + private String accountNumber; + private float balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public float getBalance() { + return balance; + } + + public void setBalance(float balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/StockAccount.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/StockAccount.java new file mode 100644 index 0000000000..eeb7238abc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/accountdata/StockAccount.java @@ -0,0 +1,48 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.accountdata; + +public class StockAccount { + + private String accountNumber; + private String symbol; + private int quantity; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String symbol) { + this.symbol = symbol; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..7545e9fbbb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.stockquote; + +public interface StockQuoteService { + + public float getQuote(String symbol); +} + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java new file mode 100644 index 0000000000..85f85340ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java @@ -0,0 +1,28 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.model.assembly.tests.bigbank.account.services.stockquote; + +/* Dummy'd up StockQuoteService, override webservice for now */ + +public class StockQuoteServiceImpl implements StockQuoteService { + + public float getQuote(String symbol) { + // Just hardcode for now + return 83.00f; + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl new file mode 100644 index 0000000000..6af61ef80e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/java/org/apache/tuscany/model/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.module new file mode 100644 index 0000000000..7290f9c0c3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.module @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.subsystem b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.subsystem new file mode 100644 index 0000000000..bff90f010d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/model/src/test/resources/org/apache/tuscany/model/assembly/tests/sca.subsystem @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/pom.xml new file mode 100644 index 0000000000..6ade2cf913 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/pom.xml @@ -0,0 +1,57 @@ + + + + + org.apache.tuscany.sca.plugins + tuscany-sca-plugins + incubating-M1 + + + 4.0.0 + tuscany-plugin-java2wsdl + maven-plugin + Tuscany SCA - Maven Plugin for Java2WSDL + Implementation of Java2WSDL Generator + incubating-M1 + + + + org.apache.maven + maven-plugin-api + 2.0 + + + org.apache.tuscany + tuscany-sca-tools + ${pom.version} + compile + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.4 + 1.5 + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java new file mode 100644 index 0000000000..f1b9d91523 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java @@ -0,0 +1,156 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tuscany.tools.java2wsdl.plugin; + +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorFactory; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; + +/** + * @version $Rev$ $Date$ + * @goal generate + * @phase generate-sources + * @description Generate WSDL from a given Java class / interface + */ +public class Java2WSDLGeneratorMojo extends AbstractMojo +{ + + /** + * The name of the class for which the WSDL must be generated + * @parameter + * + */ + private String sourceClassName; + + /** + * The location where the wsdls should be generated into + * @parameter expression="${project.build.directory}\\java2wsdl-wsdl" + */ + private String targetLocation; + + /** + * The name of the wsdl file + * @parameter + */ + private String wsdlFilename; + + + /** + * Classpaths to be included + * @parameter + * + */ + String[] classpaths; + + /** + * The name of the service + * @parameter + */ + private String serviceName; + + /** + * The binding style for the service + * @parameter + */ + private String bindingStyle; + + /** + * The binding use option + * @parameter + */ + private String bindingUse; + + /** + * The soap address + * @parameter + */ + private String soapAddress; + + public void execute() throws MojoExecutionException + { + try + { + Java2WSDLGeneratorFactory.getInstance().createGenerator().generateWSDL(createOptionsMap ()); + } + catch ( Exception e ) + { + throw new MojoExecutionException("Exception in Java2WSDL Maven Plugin ", e); + } + } + + protected Map createOptionsMap() + { + Map optionsMap = new Hashtable(); + + optionsMap.put(Java2WSDLConstants.CLASSNAME_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSNAME_OPTION, new String[]{sourceClassName})); + + if ( targetLocation != null ) + { + optionsMap.put(Java2WSDLConstants.OUTPUT_LOCATION_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.OUTPUT_LOCATION_OPTION, new String[]{targetLocation})); + } + + if ( wsdlFilename != null ) + { + optionsMap.put(Java2WSDLConstants.OUTPUT_FILENAME_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.OUTPUT_FILENAME_OPTION, new String[]{wsdlFilename})); + } + + if ( classpaths != null && classpaths.length > 0 ) + { + optionsMap.put(Java2WSDLConstants.CLASSPATH_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSPATH_OPTION, classpaths)); + } + + if ( serviceName != null ) + { + optionsMap.put(Java2WSDLConstants.SERVICE_NAME_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.SERVICE_NAME_OPTION, new String[]{serviceName})); + } + + if ( bindingStyle != null ) + { + optionsMap.put(Java2WSDLConstants.STYLE_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.STYLE_OPTION, new String[]{bindingStyle})); + } + + if ( bindingUse != null ) + { + optionsMap.put(Java2WSDLConstants.USE_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.USE_OPTION, new String[]{bindingUse})); + } + + if ( soapAddress != null ) + { + optionsMap.put(Java2WSDLConstants.LOCATION_OPTION, + new Java2WSDLCommandLineOption(Java2WSDLConstants.LOCATION_OPTION, new String[]{soapAddress})); + } + + return optionsMap; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.java2wsdl/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/pom.xml new file mode 100644 index 0000000000..e340ceb602 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/pom.xml @@ -0,0 +1,57 @@ + + + + + org.apache.tuscany.sca.plugins + tuscany-sca-plugins + incubating-M1 + + + 4.0.0 + tuscany-plugin-wsdl2java + maven-plugin + Tuscany SCA - Maven Plugin for WSDL2Java + Implementation of WSDL2Java Generator + incubating-M1 + + + + org.apache.maven + maven-plugin-api + 2.0 + + + org.apache.tuscany + tuscany-sca-tools + ${pom.version} + compile + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.4 + 1.5 + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java new file mode 100644 index 0000000000..37ff6655d7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java @@ -0,0 +1,150 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.wsdl2java.plugin; + +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.util.List; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator; + +/** + * @version $Rev$ $Date$ + * @goal generate + * @phase generate-sources + * @description Generate SDO interface classes from an XML Schema + */ +public class WSDL2JavaGeneratorMojo extends AbstractMojo { + /** + * The directory containing wsdl files; defaults to ${basedir}/src/main/wsdl + * @parameter expression="${basedir}/src/main/wsdl" + */ + private String wsdlDir; + + /** + * Name of the wsdl file; if omitted all files in the directory are processed + * @parameter + */ + private File wsdlFile; + + /** + * The Java package to generate into. By default the value is derived from the schema URI. + * + * @parameter + */ + private String javaPackage; + + /** + * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source + * + * @parameter expression="${project.build.directory}/wsdl2java-source" + */ + private String targetDirectory; + + /** + * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source + * + * @parameter + */ + private WSDLFileOption[] wsdlFiles; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + private List compilerSourceRoots; + + public void execute() throws MojoExecutionException { + + if(null != wsdlFiles){ + for(int i=0; i< wsdlFiles.length ; ++i ){ + System.err.println("wsdlFiles" + wsdlFiles[i].getFileName()); + WSDLFileOption wf = wsdlFiles[i]; + + if(null == wf.getTargetDirectory()) + wf.setTargetDirectory(targetDirectory); + if(null == wf.getJavaPackage()){ + wf.setJavaPackage(javaPackage); + } + if(wf.getFileName() == null || wf.getFileName().length() ==0){ + throw new MojoExecutionException("no fileName specfied for wsdl."); + } + if(!wf.getFileName().canRead() || !wf.getFileName().isFile()){ + + throw new MojoExecutionException("file can not be read:"+wf.getFileName()); + } + + } + }else{ + + + + if (wsdlFile == null) { + + File[] files = new File(wsdlDir).listFiles(FILTER); + + wsdlFiles= new WSDLFileOption[files.length]; + for(int i= files.length -1; i> -1; --i){ + + + wsdlFiles[i] = new WSDLFileOption(); + wsdlFiles[i].setFileName(files[i]); + wsdlFiles[i].setJavaPackage(javaPackage); + wsdlFiles[i].setPorts(null); + wsdlFiles[i].setTargetDirectory(targetDirectory); + + + } + + } else { + wsdlFiles= new WSDLFileOption[]{new WSDLFileOption()}; + wsdlFiles[0].setFileName(wsdlFile); + wsdlFiles[0].setJavaPackage(javaPackage); + wsdlFiles[0].setPorts(null); + wsdlFiles[0].setTargetDirectory(targetDirectory); + } + } + + int genOptions = 0; + + for (int i = 0; i < wsdlFiles.length; i++) { + File file = wsdlFiles[i].getFileName(); + File marker = new File(targetDirectory, ".gen#" + file.getName()+".wsdl2java"); + if (file.lastModified() > marker.lastModified()) { + getLog().info("Generating Java service interfaces from " + file); + WSDL2JavaGenerator.generateFromWSDL(file.toString(), wsdlFiles[i].getPorts(), wsdlFiles[i].getTargetDirectory(), wsdlFiles[i].getJavaPackage(), null, genOptions); + } + try { + marker.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage(), e); + } + marker.setLastModified(System.currentTimeMillis()); + } + + compilerSourceRoots.add(targetDirectory); + } + + private static final FileFilter FILTER = new FileFilter() { + public boolean accept(File pathname) { + return (pathname.isFile() || !pathname.isHidden()); + } + }; +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java new file mode 100644 index 0000000000..2d2ae5ed2d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java @@ -0,0 +1,90 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.wsdl2java.plugin; + +import java.io.File; + +public class WSDLFileOption { + /** + * Name of the wsdl file; if omitted all files in the directory are processed + * + */ + private File fileName; + + /** + * The Java package to generate into. By default the value is derived from the schema URI. + * + * + */ + private String javaPackage; + + /** + * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source + * + * + */ + private String targetDirectory; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + + private String ports[]; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + + + public WSDLFileOption(){} + + public String getJavaPackage() { + return javaPackage; + } + + public void setJavaPackage(String javaPackage) { + this.javaPackage = javaPackage; + } + + + public String[] getPorts() { + return ports; + } + + public void setPorts(String[] ports) { + this.ports = ports; + } + + public String getTargetDirectory() { + return targetDirectory; + } + + public void setTargetDirectory(String targetDirectory) { + this.targetDirectory = targetDirectory; + } + + public File getFileName() { + return fileName; + } + + public void setFileName(File fileName) { + this.fileName = fileName; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/plugin.wsdl2java/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/pom.xml new file mode 100644 index 0000000000..a8c04a4b37 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/plugins/pom.xml @@ -0,0 +1,35 @@ + + + + + org.apache.tuscany + tuscany-sca + incubating-M1 + + + 4.0.0 + org.apache.tuscany.sca.plugins + tuscany-sca-plugins + pom + Tuscany SCA Maven Plugins + incubating-M1 + + + plugin.wsdl2java + plugin.java2wsdl + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/pom.xml new file mode 100644 index 0000000000..a73f1f5619 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/pom.xml @@ -0,0 +1,70 @@ + + + + + org.apache.tuscany + tuscany-project + incubating-M1 + + 4.0.0 + tuscany-sca + pom + Tuscany SCA Implementation Project + incubating-M1 + + + common + model + core + bindings + databinding + containers + tomcat + tools + plugins + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*TestCase.java + + brief + false + + + + + + src/test/java + + **/*.componentType + + + + src/test/resources + + **/* + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/pom.xml new file mode 100644 index 0000000000..ff16f54136 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/pom.xml @@ -0,0 +1,105 @@ + + + + + org.apache.tuscany + tuscany-sca + incubating-M1 + + 4.0.0 + tuscany-tomcat + Tuscany Apache Tomcat Integration + Integration of the Tuscany runtime with Apache Tomcat. + incubating-M1 + + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + compile + + + org.apache.tuscany.sca.bindings + tuscany-binding-axis2 + ${pom.version} + compile + + + + tomcat + servlet-api + 5.0.18 + provided + + + tomcat + catalina + 5.5.15 + provided + + + tomcat + tomcat-util + 5.5.15 + provided + + + tomcat + tomcat-coyote + 5.5.15 + provided + + + tomcat + tomcat-http + 5.5.15 + provided + + + tomcat + naming-factory + 5.5.15 + provided + + + tomcat + naming-resources + 5.5.15 + provided + + + commons-logging + commons-logging + 1.0.4 + provided + + + commons-modeler + commons-modeler + 1.1M1 + provided + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/ContainerLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/ContainerLoader.java new file mode 100644 index 0000000000..60c9a7961f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/ContainerLoader.java @@ -0,0 +1,100 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat; + +import java.beans.PropertyChangeListener; + +import org.apache.catalina.Container; +import org.apache.catalina.Loader; + +/** + * Implementation of a TomcatLoader that allows privileged servlets from the container + * classloader to be loaded into an unprivileged application. This allows the Tuscany + * integration code to add servlets to the application, for example, to handle web + * services requests. + * + * @version $Rev$ $Date$ + */ +public class ContainerLoader implements Loader { + private static final String INFO = ContainerLoader.class.getName() + "/SNAPSHOT"; + private final ClassLoader cl; + private Container container; + + /** + * Constructor specifying the classloader to be used. + * + * @param cl the classloader this Loader wraps, typically the container classloader + */ + public ContainerLoader(ClassLoader cl) { + this.cl = cl; + } + + public void backgroundProcess() { + } + + public ClassLoader getClassLoader() { + return cl; + } + + public Container getContainer() { + return container; + } + + public void setContainer(Container container) { + this.container = container; + } + + public boolean getDelegate() { + return false; + } + + public void setDelegate(boolean delegate) { + throw new UnsupportedOperationException(); + } + + public String getInfo() { + return INFO; + } + + public boolean getReloadable() { + return false; + } + + public void setReloadable(boolean reloadable) { + throw new UnsupportedOperationException(); + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + throw new UnsupportedOperationException(); + } + + public void addRepository(String repository) { + throw new UnsupportedOperationException(); + } + + public String[] findRepositories() { + throw new UnsupportedOperationException(); + } + + public boolean modified() { + throw new UnsupportedOperationException(); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + throw new UnsupportedOperationException(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TomcatHost.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TomcatHost.java new file mode 100644 index 0000000000..8351da8edd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TomcatHost.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat; + +import javax.servlet.Servlet; + +import org.osoa.sca.annotations.Scope; + +import org.apache.tuscany.core.webapp.ServletHost; + +/** + * SCA Component that acts as a proxy for the Tomcat Host container that created the runtime. + * + * @version $Rev$ $Date$ + */ +@Scope("MODULE") +public class TomcatHost implements ServletHost { + private TuscanyHost host; + + public void setHost(TuscanyHost host) { + this.host = host; + } + + public TuscanyHost getHost() { + return host; + } + + public void registerMapping(String mapping, Servlet servlet) { + host.registerMapping(mapping, servlet); + } + + public void unregisterMapping(String mapping) { + host.unregisterMapping(mapping); + } + + public Servlet getMapping(String mapping) { + return host.getMapping(mapping); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java new file mode 100644 index 0000000000..7e3edf67f9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java @@ -0,0 +1,152 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat; + +import javax.servlet.ServletContext; + +import org.apache.catalina.Context; +import org.apache.catalina.Lifecycle; +import org.apache.catalina.LifecycleEvent; +import org.apache.catalina.LifecycleListener; +import org.apache.catalina.util.StringManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tuscany.common.resource.ResourceLoader; +import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.core.config.ConfigurationException; +import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.EventException; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl; +import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; + +/** + * @version $Rev$ $Date$ + */ +public class TuscanyContextListener implements LifecycleListener { + private static final Log log = LogFactory.getLog(TuscanyContextListener.class); + private static final StringManager sm = StringManager.getManager("org.apache.tuscany.tomcat"); + private static final String TUSCANY_RUNTIME_NAME = RuntimeContext.class.getName(); + public static final String MODULE_COMPONENT_NAME = "org.apache.tuscany.core.webapp.ModuleComponentContext"; + + private final AssemblyFactory modelFactory; + private final AssemblyModelLoader modelLoader; + private final RuntimeContext runtime; + private CompositeContext moduleContext; + private TuscanyValve valve; + + public TuscanyContextListener(RuntimeContext runtimeContext, AssemblyFactory modelFactory, AssemblyModelLoader modelLoader) { + this.runtime = runtimeContext; + this.modelFactory = modelFactory; + this.modelLoader = modelLoader; + } + + public void lifecycleEvent(LifecycleEvent event) { + String type = event.getType(); + if (Lifecycle.AFTER_START_EVENT.equals(type)) { + startContext((Context) event.getLifecycle()); + } else if (Lifecycle.STOP_EVENT.equals(type)) { + stopContext((Context) event.getLifecycle()); + } + } + + private void startContext(Context ctx) { + ClassLoader appLoader = ctx.getLoader().getClassLoader(); + if (appLoader.getResource("sca.module") == null) { + return; + } + + log.info(sm.getString("context.configLoad", ctx.getName())); + try { + loadContext(ctx); + } catch (ConfigurationException e) { + log.error(sm.getString("context.configError"), e); + // todo mark application as unavailable + return; + } + + try { + moduleContext.publish(new ModuleStart(this)); + } catch (EventException e) { + log.error(sm.getString("context.moduleStartError"), e); + // todo unload module component from runtime + // todo mark application as unavailable + return; + } catch (RuntimeException e) { + log.error(sm.getString("context.unknownRuntimeException"), e); + // todo unload module component from runtime + throw e; + } + + // add a valve to this context's pipeline that will associate the request with the runtime + if (valve == null) { + valve = new TuscanyValve(moduleContext); + } else { + valve.setContext(moduleContext); + valve.setEnabled(true); + } + ctx.getPipeline().addValve(valve); + // add the RuntimeContext in as a servlet context parameter + ServletContext servletContext = ctx.getServletContext(); + servletContext.setAttribute(TUSCANY_RUNTIME_NAME, runtime); + servletContext.setAttribute(MODULE_COMPONENT_NAME, moduleContext); + } + + private void loadContext(Context ctx) throws ConfigurationException { + ResourceLoader resourceLoader = new ResourceLoaderImpl(ctx.getLoader().getClassLoader()); + ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); + try { + AssemblyContextImpl modelContext = new AssemblyContextImpl(modelFactory, modelLoader, resourceLoader, ctx.getName()); + + ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(runtime.getSystemContext(), modelContext); + + // Load the SCDL configuration of the application module + ModuleComponent moduleComponent = loader.loadModuleComponent(ctx.getName(), ctx.getPath()); + + // Register it under the root application context + CompositeContext rootContext = runtime.getRootContext(); + rootContext.registerModelObject(moduleComponent); + moduleContext = (CompositeContext) rootContext.getContext(moduleComponent.getName()); + //TODO remove the hack below + moduleContext.setAssemblyContext(modelContext); + } finally { + Thread.currentThread().setContextClassLoader(oldCl); + } + } + + private void stopContext(Context ctx) { + if (moduleContext != null) { + moduleContext.publish(new ModuleStop(this)); + } + CompositeContext rootContext = runtime.getRootContext(); + rootContext.removeContext(moduleContext.getName()); + valve.setEnabled(false); + //ctx.getPipeline().removeValve(valve); + //valve = null; + moduleContext.stop(); + moduleContext = null; + // todo unload module component from runtime + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyHost.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyHost.java new file mode 100644 index 0000000000..37984ef40d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyHost.java @@ -0,0 +1,185 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat; + +import javax.servlet.Servlet; + +import org.apache.catalina.Container; +import org.apache.catalina.Context; +import org.apache.catalina.LifecycleException; +import org.apache.catalina.Wrapper; +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.core.StandardHost; +import org.apache.catalina.util.StringManager; +import org.apache.tomcat.util.buf.MessageBytes; +import org.apache.tomcat.util.http.mapper.MappingData; + +import org.apache.tuscany.common.monitor.impl.NullMonitorFactory; +import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; +import org.apache.tuscany.core.builder.impl.DefaultWireBuilder; +import org.apache.tuscany.core.client.BootstrapHelper; +import org.apache.tuscany.core.config.ConfigurationLoadException; +import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader; +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.SystemCompositeContext; +import org.apache.tuscany.core.context.event.ModuleStart; +import org.apache.tuscany.core.context.event.ModuleStop; +import org.apache.tuscany.core.runtime.RuntimeContext; +import org.apache.tuscany.core.runtime.RuntimeContextImpl; +import org.apache.tuscany.core.webapp.ServletHost; +import org.apache.tuscany.model.assembly.AssemblyContext; +import org.apache.tuscany.model.assembly.AssemblyFactory; +import org.apache.tuscany.model.assembly.ModuleComponent; +import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader; + +/** + * A specialied Tomcat Host that extends the Standardhost implementation and adds SCA capabilities. + *

+ * As children are added, they are examined for the presence of SCA configuration + * information and if any is found then the web application is treated as an + * SCA Module defintion which is used to create a ModuleComponent. The name of the + * context is used as the name of the ModuleComponent and its context path is used + * as the URI. + * + * @version $Rev$ $Date$ + */ +@SuppressWarnings({"serial"}) +public class TuscanyHost extends StandardHost implements ServletHost { + private static final String SYSTEM_MODULE_COMPONENT = "org.apache.tuscany.core.system"; + + private static final StringManager sm = StringManager.getManager("org.apache.tuscany.tomcat"); + + private RuntimeContext runtime; + private AssemblyModelLoader modelLoader; + private AssemblyFactory modelFactory; + + public synchronized void start() throws LifecycleException { + startRuntime(); + super.start(); + } + + public synchronized void stop() throws LifecycleException { + super.stop(); + stopRuntime(); + } + + private void startRuntime() { + // Create an assembly model context + AssemblyContext modelContext = BootstrapHelper.getModelContext(getClass().getClassLoader()); + modelFactory = modelContext.getAssemblyFactory(); + modelLoader = modelContext.getAssemblyLoader(); + + // Create and start the runtime + NullMonitorFactory monitorFactory = new NullMonitorFactory(); + ContextFactoryBuilderRegistry builderRegistry = BootstrapHelper.bootstrapContextFactoryBuilders(monitorFactory); + runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, new DefaultWireBuilder()); + runtime.start(); + + // Load and start the system configuration + try { + SystemCompositeContext systemContext = runtime.getSystemContext(); + BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext); + ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext); + ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT); + CompositeContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent); + context.publish(new ModuleStart(this)); + + TomcatHost host = systemContext.resolveInstance(TomcatHost.class); + host.setHost(this); + } catch (ConfigurationLoadException e) { + getLogger().warn(sm.getString("runtime.loadSystemFailed", e.getResourceURI()), e); + return; + } catch (Exception e) { + getLogger().warn(sm.getString("runtime.registerSystemFailed"), e); + runtime.stop(); + runtime = null; + return; + } + + getLogger().info(sm.getString("runtime.started")); + } + + private void stopRuntime() { + if (runtime == null) { + return; + } + runtime.getSystemContext().publish(new ModuleStop(this)); + + runtime.stop(); + runtime = null; + getLogger().info(sm.getString("runtime.stopped")); + } + + public synchronized void addChild(Container child) { + if (!(child instanceof StandardContext)) { + throw new IllegalArgumentException(sm.getString("tuscanyHost.notContext")); + } + StandardContext ctx = (StandardContext) child; + ctx.addLifecycleListener(new TuscanyContextListener(runtime, modelFactory, modelLoader)); + super.addChild(child); + } + + public String toString() { + StringBuilder sb = new StringBuilder(132); + if (getParent() != null) { + sb.append(getParent().toString()).append('.'); + } + sb.append("TuscanyHost[").append(getName()).append(']'); + return (sb.toString()); + } + + public void registerMapping(String mapping, Servlet servlet) { + Context ctx = map(mapping); + if (ctx == null) { + throw new UnsupportedOperationException("Cannot find context for mapping " + mapping); + } + String contextPath = ctx.getPath(); + assert mapping.startsWith(contextPath); + mapping = mapping.substring(contextPath.length()); + Wrapper wrapper = new TuscanyWrapper(servlet); + wrapper.setName(mapping.substring(0,mapping.lastIndexOf('/'))); + ctx.addChild(wrapper); + wrapper.addMapping(mapping); + ctx.getMapper().addWrapper(mapping, wrapper, false); + } + + public void unregisterMapping(String mapping) { + } + + public Servlet getMapping(String mapping) { + Context ctx = map(mapping); + if (ctx == null) { + return null; + } + String contextPath = ctx.getPath(); + assert mapping.startsWith(contextPath); + + MappingData mappingData = new MappingData(); + MessageBytes mb = MessageBytes.newInstance(); + mb.setString(mapping); + try { + ctx.getMapper().map(mb, mappingData); + } catch (Exception e) { + return null; + } + if (!(mappingData.wrapper instanceof TuscanyWrapper)) { + return null; + } + TuscanyWrapper wrapper = (TuscanyWrapper) mappingData.wrapper; + return wrapper.getServlet(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java new file mode 100644 index 0000000000..352a04bde0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyValve.java @@ -0,0 +1,130 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpSession; + +import org.apache.catalina.connector.Request; +import org.apache.catalina.connector.Response; +import org.apache.catalina.valves.ValveBase; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + +import org.apache.tuscany.core.context.CompositeContext; +import org.apache.tuscany.core.context.event.HttpSessionBound; +import org.apache.tuscany.core.context.event.RequestStart; +import org.apache.tuscany.core.context.event.RequestEnd; +import org.apache.tuscany.core.webapp.LazyHTTPSessionId; + +/** + * Valve that can be added to a pipeline to automatically set the SCA environment as each request is processed. + * + * @version $Rev$ $Date$ + */ +public class TuscanyValve extends ValveBase { + /** + * Name of the note that contains the request id + */ + private static final String REQUEST_ID = "org.apache.tuscany.tomcat.REQUEST_ID"; + + private static final ContextBinder BINDER = new ContextBinder(); + + private CompositeContext moduleComponentContext; + + private boolean enabled = true; + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public void setContext(CompositeContext moduleComponentContext) { + this.moduleComponentContext = moduleComponentContext; + } + + public TuscanyValve(CompositeContext moduleComponentContext) { + this.moduleComponentContext = moduleComponentContext; + } + + public void invoke(Request request, Response response) throws IOException, ServletException { + if (!enabled){ + return; + } + Object oldRequestId = request.getNote(REQUEST_ID); + ModuleContext oldContext = CurrentModuleContext.getContext(); + // bind the current module context to the thread for use by CurrentModuleContext + BINDER.setContext((ModuleContext) moduleComponentContext); + try { + if (oldRequestId != null) { + // the request has already been started, just invoke the next valve + next.invoke(request, response); + } else { + // tell the runtime a new request is starting + Object requestId = new Object(); + + HttpSession session = request.getSession(false); + if (session != null) { + // A session is already active + moduleComponentContext .publish(new HttpSessionBound(this,session)); + } else { + // Create a lazy wrapper since a session is not yet active + moduleComponentContext.publish(new HttpSessionBound(this, new LazyHTTPSessionId(request))); + } + + try { + moduleComponentContext.publish(new RequestStart(this, requestId)); + } catch (Exception e) { + throw new ServletException(e.getMessage(), e); + } + request.setNote(REQUEST_ID, requestId); + + try { + // invoke the next valve in the pipeline + next.invoke(request, response); + } finally { + // notify the runtime the request is ending + request.removeNote(REQUEST_ID); + try { + moduleComponentContext.publish(new RequestEnd(this, requestId)); + } catch (Exception e) { + // the application already did its work, log and ignore + // todo log this exception + } + } + } + } finally { + // restore the previous module context onto the thread + BINDER.setContext(oldContext); + } + } + + private static class ContextBinder extends SCA { + public void setContext(ModuleContext context) { + setModuleContext(context); + } + + public void start() { + throw new AssertionError(); + } + + public void stop() { + throw new AssertionError(); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyWrapper.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyWrapper.java new file mode 100644 index 0000000000..de53ad4d45 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyWrapper.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat; + +import javax.servlet.Servlet; + +import org.apache.catalina.core.StandardWrapper; + +/** + * @version $Rev$ $Date$ + */ +public class TuscanyWrapper extends StandardWrapper { + private static final long serialVersionUID = 1L; + + private final Servlet servlet; + + public TuscanyWrapper(Servlet servlet) { + super(); + this.servlet = servlet; + } + + public synchronized Servlet loadServlet() { + return servlet; + } + + public Servlet getServlet() { + return servlet; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties new file mode 100644 index 0000000000..43fc99958e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties @@ -0,0 +1,25 @@ +# Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +runtime.loadSystemFailed = Error loading system configuration from: {0} +runtime.registerSystemFailed = Error registering system configuration: +runtime.started = Started Tuscany runtime +runtime.stopped = Stopped Tuscany runtime + +tuscanyHost.notContext = Child of a TuscanyHost must be a StandardContext +context.configLoad = Loading SCA configuration for application {0} + +context.configError = Error loading the SCA configuration +context.moduleStartError = Error starting SCA module +context.unknownRuntimeException = Unexpected RuntimeException diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/Messages.properties b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/Messages.properties new file mode 100644 index 0000000000..f926ca6488 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/Messages.properties @@ -0,0 +1,39 @@ +# 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. +# ==================================================================== +# To code developer: +# Do NOT change the properties between this line and the +# "%%% END OF TRANSLATED PROPERTIES %%%" line. +# Make a new property name, append to the end of the file and change +# the code to use the new property. +# ==================================================================== + +# ===================================================================== +# %%% END OF TRANSLATED PROPERTIES %%% +# ===================================================================== +# NLS_MESSAGEFORMAT_ALL + +SCA_STARTING =Tuscany: Starting SCA runtime. +SCA_STARTED =Tuscany: Started SCA runtime. +SCA_STOPPING =Tuscany: Stopping SCA runtime. +SCA_STOPPED =Tuscany: Stopped SCA runtime. +SCA_STARTING_MODULE =Tuscany: Starting SCA module component {0}. +SCA_LOADED_MODULE =Tuscany: Loaded SCA module {0}. +SCA_STARTED_MODULE =Tuscany: Started SCA module component {0}. +SCA_STOPPING_MODULE =Tuscany: Stopping SCA module component {0}. +SCA_STOPPED_MODULE =Tuscany: Stopped SCA module component {0}. +SCA_START_MODULE_FAILED =Tuscany: Error starting SCA module component {0}: {1}. +SCA_STOP_MODULE_FAILED =Tuscany: Error stopping SCA module component {0}: {1}. +SCA_START_WEBAPP_FAILED =Tuscany: Error starting Web application {0}: {1}. +SCA_STOP_WEBAPP_FAILED =Tuscany: Error stopping Web application {0}: {1}. \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/system.fragment b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/system.fragment new file mode 100644 index 0000000000..e379e1d90b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/main/resources/system.fragment @@ -0,0 +1,31 @@ + + + + + + + + TomcatHost + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java new file mode 100644 index 0000000000..babe25adc7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/AbstractTomcatTest.java @@ -0,0 +1,298 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat.integration; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.Vector; + +import javax.servlet.ServletInputStream; +import javax.servlet.ServletOutputStream; + +import junit.framework.TestCase; + +import org.apache.catalina.Globals; +import org.apache.catalina.Host; +import org.apache.catalina.connector.Connector; +import org.apache.catalina.connector.Request; +import org.apache.catalina.connector.Response; +import org.apache.catalina.core.ApplicationFilterFactory; +import org.apache.catalina.core.StandardEngine; + +/** + * @version $Rev$ $Date$ + */ +public class AbstractTomcatTest extends TestCase { + protected Map> classes; + protected Host host; + protected MockRequest request; + protected MockResponse response; + protected StandardEngine engine; + + protected void setUp() throws Exception { + super.setUp(); + classes = new HashMap>(); + classes.put(TestServlet.class.getName(), TestServlet.class); + classes.put(HelloWorldService.class.getName(), HelloWorldService.class); + classes.put(HelloWorldImpl.class.getName(), HelloWorldImpl.class); + } + + protected void setupTomcat(File baseDir, Host host) throws Exception { + File appBase = new File(baseDir, "webapps").getCanonicalFile(); + + // Configure a Tomcat Engine + engine = new StandardEngine(); + engine.setName("Catalina"); + engine.setDefaultHost("localhost"); + engine.setBaseDir(baseDir.getAbsolutePath()); + + this.host = host; + host.setName("localhost"); + host.setAppBase(appBase.getAbsolutePath()); + engine.addChild(host); + + // buildSource a empty request/response + Connector connector = new Connector("HTTP/1.1"); + request = new MockRequest(); + request.setConnector(connector); + response = new MockResponse(); + request.setResponse(response); + request.setMethod("POST"); + request.setScheme("http"); + } + + public static class MockRequest extends Request { + private String method; + private String scheme; + private String requestURI; + private String contentType; + private Map headers = new HashMap(); + private ServletInputStream inputStream; + + public void setScheme(String scheme) { + this.scheme = scheme; + } + + public void setMethod(String method) { + this.method = method; + } + + public void setRequestURI(String requestURI) { + this.requestURI = requestURI; + } + + public String getScheme() { + return scheme; + } + + public String getMethod() { + return method; + } + + public int getServerPort() { + return 80; + } + + public String getServerName() { + return "localhost"; + } + + public String getRequestURI() { + return requestURI; + } + + public void setAttribute(String name, Object value) { + if (name.startsWith("org.apache.tomcat.")) { + return; + } + super.setAttribute(name, value); + } + + public Object getAttribute(String name) { + if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) { + return (dispatcherType == null) + ? ApplicationFilterFactory.REQUEST_INTEGER + : dispatcherType; + } else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) { + return (requestDispatcherPath == null) + ? getRequestPathMB().toString() + : requestDispatcherPath.toString(); + } + + return attributes.get(name); + } + + public String getHeader(String name) { + return headers.get(name); + } + + public Enumeration getHeaderNames() { + return Collections.enumeration(headers.keySet()); + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getContentType() { + return contentType; + } + + public ServletInputStream getInputStream() throws IOException { + return inputStream; + } + + public InputStream getStream() { + return inputStream; + } + + public void setStream(ServletInputStream stream) { + inputStream = stream; + } + + @Override + public String getRemoteHost() { + + return "locahost"; + } + + @Override + public int getRemotePort() { + + return 1080; + } + + @Override + public String getRemoteAddr() { + + return "127.0.0.1"; + } + + @Override + public Enumeration getParameterNames() { + return new Vector().elements(); + } + + @Override + public String getParameter(String param) { + if ("wsdl".equals(param)) { + return ""; + } else { + return null; + } + } + } + + public static class MockResponse extends Response { + private boolean suspended; + private String contentType; + private int status = 200; + private Map headers = new HashMap(); + private MockOutputStream outputStream = new MockOutputStream(); + + public boolean isCommitted() { + return false; + } + + public boolean isAppCommitted() { + return false; + } + + public void sendAcknowledgement() { + } + + public void setSuspended(boolean suspended) { + this.suspended = suspended; + } + + public boolean isSuspended() { + return suspended; + } + + public void setStatus(int status, String message) { + this.status = status; + } + + public int getStatus() { + return status; + } + + public void reset() { + } + + public void addHeader(String name, String value) { + headers.put(name, value); + } + + public String[] getHeaderNames() { + return (String[]) headers.keySet().toArray(new String[headers.size()]); + } + + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public OutputStream getStream() { + return outputStream; + } + + public ServletOutputStream getOutputStream() throws IOException { + return outputStream; + } + } + + public static class MockInputStream extends ServletInputStream { + private final byte[] bytes; + private int index; + + public MockInputStream(byte[] bytes) { + this.bytes = bytes; + } + + public int read() throws IOException { + if (index == bytes.length) { + return -1; + } + else { + return bytes[index++]; + } + } + } + + public static class MockOutputStream extends ServletOutputStream { + private ByteArrayOutputStream os = new ByteArrayOutputStream(); + + public void write(int b) throws IOException { + os.write(b); + } + + public String toString() { + return os.toString(); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldImpl.java new file mode 100644 index 0000000000..4db61fa58c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldImpl.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat.integration; + +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + public String getGreetings(String name) { + return "Hello " + name; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldService.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldService.java new file mode 100644 index 0000000000..a9b78cadf4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/HelloWorldService.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat.integration; + +/** + * @version $Rev$ $Date$ + */ +public interface HelloWorldService { + public String getGreetings(String name); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestClassLoader.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestClassLoader.java new file mode 100644 index 0000000000..486fec5bd4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestClassLoader.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat.integration; + +import java.util.Map; +import java.net.URL; + +import org.apache.catalina.loader.WebappClassLoader; + +/** + * A version of Tomcat's application classloader that only allows certain classes to be loaded. + * This is used in the integration tests to make sure that no Tuscany classes are exposed to the + * application except the ones needed to run the tests. + * + * @version $Rev$ $Date$ + */ +@SuppressWarnings({"CustomClassloader"}) +public class TestClassLoader extends WebappClassLoader { + private final Map> classes; + + public TestClassLoader(Map> classes, URL url, ClassLoader parent) { + super(parent); + this.classes = classes; + addURL(url); + } + + public Class findClass(String name) throws ClassNotFoundException { + Class clazz = classes.get(name); + if (clazz != null) { + return clazz; + } + if (name.startsWith("java.") || name.startsWith("javax.") || name.startsWith("org.osoa.")) { + return super.findClass(name); + } + throw new ClassNotFoundException(name); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestServlet.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestServlet.java new file mode 100644 index 0000000000..2cd8ce06a2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TestServlet.java @@ -0,0 +1,60 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat.integration; + +import java.io.IOException; +import javax.servlet.GenericServlet; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * @version $Rev$ $Date$ + */ +@SuppressWarnings({"serial"}) +public class TestServlet extends GenericServlet { + + public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { + Object runtime = getServletContext().getAttribute("org.apache.tuscany.core.runtime.RuntimeContext"); + if (runtime == null || "org.apache.tuscany.core.runtime.RuntimeContext".equals(runtime.getClass().getName())) { + throw new ServletException("Runtime not bound to org.apache.tuscany.core.runtime.RuntimeContext"); + } + + Object module = getServletContext().getAttribute("org.apache.tuscany.core.webapp.ModuleComponentContext"); + if (module == null || "org.apache.tuscany.core.context.CompositeContext".equals(module.getClass().getName())) { + throw new ServletException("Module composite not bound to org.apache.tuscany.core.webapp.ModuleComponentContext"); + } + + ModuleContext moduleContext = CurrentModuleContext.getContext(); + if (moduleContext == null) { + throw new ServletException("No module context returned"); + } + String name = moduleContext.getName(); + if (!"/testContext".equals(name)) { + throw new ServletException("Invalid module context name: " + name); + } + + HelloWorldService helloService = (HelloWorldService) moduleContext.locateService("HelloWorld"); + String greetings = helloService.getGreetings("World"); + if (!"Hello World".equals(greetings)) { + throw new ServletException("Serivce returned " + greetings); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java new file mode 100644 index 0000000000..75bd85cf65 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatIntegrationTestCase.java @@ -0,0 +1,200 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat.integration; + +import org.apache.catalina.Valve; +import org.apache.catalina.Loader; +import org.apache.catalina.Wrapper; +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.core.StandardWrapper; +import org.apache.catalina.startup.ContextConfig; +import org.apache.tomcat.util.buf.MessageBytes; +import org.apache.tomcat.util.http.mapper.MappingData; + +import org.apache.tuscany.tomcat.TuscanyHost; +import org.apache.tuscany.tomcat.TuscanyValve; +import org.apache.tuscany.tomcat.ContainerLoader; + +import java.io.File; +import java.io.IOException; +import javax.servlet.Servlet; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +/** + * @version $Rev$ $Date$ + */ +public class TomcatIntegrationTestCase extends AbstractTomcatTest { + protected File app1; + private Loader loader; + private StandardContext ctx; + + public void testComponentIntegration() throws Exception { + // define our test servlet + StandardWrapper wrapper = new StandardWrapper(); + wrapper.setServletClass(TestServlet.class.getName()); + ctx.addChild(wrapper); + + host.addChild(ctx); + boolean found = false; + for (Valve valve: ctx.getPipeline().getValves()) { + if (valve instanceof TuscanyValve) { + found = true; + break; + } + } + assertTrue("TuscanyValve not in pipeline", found); + + request.setContext(ctx); + request.setWrapper(wrapper); + host.invoke(request, response); + + host.removeChild(ctx); + } + + public void testWebServiceIntegration() throws Exception { + host.addChild(ctx); + + Wrapper wrapper = (Wrapper) ctx.findChild("/services"); + assertNotNull("No webservice wrapper present", wrapper); + request.setContext(ctx); + request.setRequestURI("/services/HelloWorldService"); + request.setWrapper(wrapper); + request.setContentType("text/xml"); + String xml = "\n" + + "\n" + + "\n" + + "World\n" + + "\n" + + "\n" + + "\n"; + request.setStream(new MockInputStream(xml.getBytes("UTF-8"))); + host.invoke(request, response); + xml = "\n" + + " Hello World\n" + + ""; + assertEquals(xml, response.getOutputStream().toString()); + + assertEquals(200, response.getStatus()); + host.removeChild(ctx); + } + + /** + * Test ?WSDL works + */ + public void testWebServiceIntegrationWSDL() throws Exception { +// ?WSDL doesn't work right now: TUSCANY-61 +// Wrapper wrapper = (Wrapper) ctx.findChild("/services"); +// assertNotNull("No webservice wrapper present", wrapper); +// request.setContext(ctx); +// request.setRequestURI("/services/HelloWorldService"); +// request.setMethod("GET"); +// +// request.setWrapper(wrapper); +// +// host.invoke(request, response); +// +// assertEquals(200, response.getStatus()); +// +// String s = response.getOutputStream().toString(); // would be better to validate with WSDl4J +// assertTrue(s.contains("")); +// +// host.removeChild(ctx); + } + + public void testServletMapping() throws Exception { + TuscanyHost tuscanyHost = (TuscanyHost) host; + host.addChild(ctx); + + MockServlet servlet = new MockServlet(); + tuscanyHost.registerMapping("/testContext/magicServlet", servlet); + assertSame(ctx, host.map("/testContext/magicServlet")); + MessageBytes uri = MessageBytes.newInstance(); + uri.setString("/testContext/magicServlet"); + MappingData mappingData = new MappingData(); + ctx.getMapper().map(uri, mappingData); + assertTrue(mappingData.requestPath.equals("/magicServlet")); + + assertSame(servlet, tuscanyHost.getMapping("/testContext/magicServlet")); + host.removeChild(ctx); + } + + public void testServletMappingWithWildard() throws Exception { + TuscanyHost tuscanyHost = (TuscanyHost) host; + host.addChild(ctx); + + MockServlet servlet = new MockServlet(); + tuscanyHost.registerMapping("/testContext/magicServlet/*", servlet); + assertSame(ctx, host.map("/testContext/magicServlet/foo")); + MessageBytes uri = MessageBytes.newInstance(); + uri.setString("/testContext/magicServlet/foo"); + MappingData mappingData = new MappingData(); + mappingData.recycle(); + ctx.getMapper().map(uri, mappingData); + assertTrue(mappingData.requestPath.equals("/magicServlet/foo")); + + assertSame(servlet, tuscanyHost.getMapping("/testContext/magicServlet/bar")); + host.removeChild(ctx); + } + + protected void setUp() throws Exception { + super.setUp(); + app1 = new File(getClass().getResource("/app1").toURI()); + File baseDir = new File(app1, "../../tomcat").getCanonicalFile(); + setupTomcat(baseDir, new TuscanyHost()); + engine.start(); + + TestClassLoader cl = new TestClassLoader(classes, new File(app1, "WEB-INF/classes").toURL(), getClass().getClassLoader()); + cl.start(); + loader = new ContainerLoader(cl); + + // create the webapp Context + ctx = new StandardContext(); + ctx.addLifecycleListener(new ContextConfig()); + ctx.setName("/testContext"); + ctx.setDocBase(app1.getAbsolutePath()); + ctx.setLoader(loader); + } + + protected void tearDown() throws Exception { + engine.stop(); + super.tearDown(); + } + + public static class MockServlet implements Servlet { + public void init(ServletConfig servletConfig) throws ServletException { + throw new UnsupportedOperationException(); + } + + public ServletConfig getServletConfig() { + throw new UnsupportedOperationException(); + } + + public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { + } + + public String getServletInfo() { + throw new UnsupportedOperationException(); + } + + public void destroy() { + throw new UnsupportedOperationException(); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatStandaloneTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatStandaloneTestCase.java new file mode 100644 index 0000000000..1aeb966625 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/java/org/apache/tuscany/tomcat/integration/TomcatStandaloneTestCase.java @@ -0,0 +1,79 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tomcat.integration; + +import java.io.File; + +import org.apache.catalina.Valve; +import org.apache.catalina.Wrapper; +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.core.StandardHost; +import org.apache.catalina.startup.ContextConfig; + +import org.apache.tuscany.tomcat.TuscanyValve; + +/** + * @version $Rev$ $Date$ + */ +@SuppressWarnings({"ClassLoader2Instantiation"}) +public class TomcatStandaloneTestCase extends AbstractTomcatTest { + protected File app2; + + public void testRuntimeIntegration() throws Exception { + StandardContext ctx = new StandardContext(); + + // caution: this sets the parent of the webapp loader to the test classloader so it can find TestServlet + // anything that relies on the TCCL may not work correctly + ClassLoader cl = TestServlet.class.getClassLoader(); + ctx.setParentClassLoader(cl); + + ctx.addLifecycleListener(new ContextConfig()); + ctx.setName("/testContext"); + ctx.setDocBase(app2.getAbsolutePath()); + +// Doesn't work, see TUSCANY-328 +// host.addChild(ctx); +// boolean found = false; +// for (Valve valve: ctx.getPipeline().getValves()) { +// if (valve instanceof TuscanyValve) { +// found = true; +// break; +// } +// } +// assertFalse("TuscanyValve in pipeline", found); + +// request.setContext(ctx); +// request.setWrapper((Wrapper) ctx.findChild("TestServlet")); +// host.invoke(request, response); + +// host.removeChild(ctx); + } + + protected void setUp() throws Exception { + super.setUp(); + app2 = new File(getClass().getResource("/app2").toURI()); + File baseDir = new File(app2, "../../tomcat").getCanonicalFile(); + setupTomcat(baseDir, new StandardHost()); + engine.start(); + } + + protected void tearDown() throws Exception { + engine.stop(); + super.tearDown(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/axis2.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/axis2.xml new file mode 100644 index 0000000000..07566475de --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/axis2.xml @@ -0,0 +1,183 @@ + + + + + + + false + false + false + + + + + admin + axis2 + + . + + 127.0.0.1 + 5555 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6060 + + + + + + + + + + + + + + + + + HTTP/1.1 + chunked + + + HTTP/1.1 + chunked + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/sca.module new file mode 100644 index 0000000000..4d19c4d192 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/sca.module @@ -0,0 +1,33 @@ + + + + + + + + + + + HelloWorld/HelloWorldService + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..3d299481e5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/classes/wsdl/helloworld.wsdl @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/web.xml new file mode 100644 index 0000000000..f109ddf404 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/WEB-INF/web.xml @@ -0,0 +1,21 @@ + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/index.html b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/index.html new file mode 100644 index 0000000000..71653b974f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app1/index.html @@ -0,0 +1,18 @@ + + +Hello World + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/sca.module new file mode 100644 index 0000000000..90ad0d44e0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/sca.module @@ -0,0 +1,33 @@ + + + + + + + + + + + HelloWorld/HelloWorldService + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/wsdl/helloworld.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..3d299481e5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/classes/wsdl/helloworld.wsdl @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/web.xml new file mode 100644 index 0000000000..9bd3882e81 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/WEB-INF/web.xml @@ -0,0 +1,45 @@ + + + + + + + org.apache.tuscany.core.webapp.ModuleComponentName + /testContext + + + TuscanyFilter + org.apache.tuscany.core.webapp.TuscanyRequestFilter + + + TuscanyFilter + TestServlet + + + org.apache.tuscany.core.webapp.TuscanyServletListener + + + TestServlet + org.apache.tuscany.tomcat.integration.TestServlet + + + TestServlet + /servlet + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/index.html b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/index.html new file mode 100644 index 0000000000..55ecbd81ba --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tomcat/src/test/resources/app2/index.html @@ -0,0 +1,3 @@ + +Hello World + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/pom.xml new file mode 100644 index 0000000000..52f6b0c682 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/pom.xml @@ -0,0 +1,155 @@ + + + + + org.apache.tuscany + tuscany-sca + incubating-M1 + + 4.0.0 + tuscany-sca-tools + Tuscany SCA Tools + SCA Tools. + incubating-M1 + + + + eclipse.emf + http://download.eclipse.org/tools/emf/maven2 + + true + + + + + + + org.apache.tuscany + tuscany-sdo-impl + incubating-M1 + compile + + + org.apache.tuscany + tuscany-model + incubating-M1 + compile + + + + org.eclipse.emf + codegen + 2.2.0-RC4 + compile + + + + org.eclipse.emf + codegen-ecore + 2.2.0-RC4 + compile + + + + axis2 + axis2-kernel + 1.0 + compile + + + + axis2 + axis2-codegen + 1.0 + compile + + + + wsdl4j + wsdl4j + 1.5.2 + compile + + + + commons-logging + commons-logging + 1.0.4 + compile + + + + log4j + log4j + 1.2.12 + compile + + + + ws-commons + policy + 1.0 + compile + + + ws-commons + axiom-api + 1.0 + compile + + + ws-commons + axiom-impl + 1.0 + compile + + + stax + stax-api + 1.0 + compile + + + woodstox + wstx-asl + 2.9.3 + compile + + + + org.apache.ws.commons + XmlSchema + 1.0.2 + compile + + + + annogen + annogen + 0.1.0 + compile + + + + junit + junit + 3.8.1 + test + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java new file mode 100644 index 0000000000..dfd5506af9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java @@ -0,0 +1,314 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Map; + +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption; + +/** + * This class encapsulates the parameters that effect the generation of the + * WSDL. For example they contain all user settings such as source class, + * target location etc. + * + */ +public class GenerationParameters +{ + public static final String WSDL_FILENAME_SUFFIX = ".wsdl"; + + private Map cmdLineOptions = null; + private FileOutputStream outputFileStream = null; + private String sourceClassName = null; + + private String targetNamespace = null; + private String targetNamespacePrefix = null; + private String schemaTargetNamespace = null; + private String schemaTargetNamespacePrefix = null; + private ClassLoader classLoader = null; + private String serviceName = null; + private String style = null; + private String use = null; + private String locationUri = null; + + public GenerationParameters(Map cmdLineOptions) throws Exception + { + this.cmdLineOptions = cmdLineOptions; + loadParameters(); + } + + protected void loadParameters() throws Exception + { + initializeSourceClassName(); + resolveFileOutputStream(); + resolveClassLoader4InputClasspath(); + initializeOtherParams(); + } + + private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption) { + //short option gets precedence + Java2WSDLCommandLineOption option = null; + if (longOption != null) { + option = (Java2WSDLCommandLineOption) cmdLineOptions.get(longOption); + if (option != null) { + return option; + } + } + if (shortOption != null) { + option = (Java2WSDLCommandLineOption) cmdLineOptions.get(shortOption); + } + + return option; + } + + protected void initializeSourceClassName() throws Exception + { + Java2WSDLCommandLineOption option = + loadOption(Java2WSDLConstants.CLASSNAME_OPTION, Java2WSDLConstants.CLASSNAME_OPTION_LONG); + sourceClassName = option == null ? null : option.getOptionValue(); + + if (sourceClassName == null || sourceClassName.equals("")) { + throw new Exception("class name must be present!"); + } + } + + /** + * @throws Exception + */ + protected void resolveFileOutputStream() throws Exception + { + File outputFolder; + Java2WSDLCommandLineOption option = loadOption(Java2WSDLConstants.OUTPUT_LOCATION_OPTION, + Java2WSDLConstants.OUTPUT_LOCATION_OPTION_LONG); + String outputFolderName = option == null ? System.getProperty("user.dir") : option.getOptionValue(); + + outputFolder = new File(outputFolderName); + if (!outputFolder.exists()) { + outputFolder.mkdirs(); + } else if (!outputFolder.isDirectory()) { + throw new Exception("The specified location " + outputFolderName + "is not a folder"); + } + + option = loadOption(Java2WSDLConstants.OUTPUT_FILENAME_OPTION, + Java2WSDLConstants.OUTPUT_FILENAME_OPTION_LONG); + String outputFileName = option == null ? null : option.getOptionValue(); + //derive a file name from the class name if the filename is not specified + if (outputFileName == null) + { + outputFileName = Java2WSDLUtils.getSimpleClassName(sourceClassName) + WSDL_FILENAME_SUFFIX; + } + + //first create a file in the given location + File outputFile = new File(outputFolder, outputFileName); + try + { + if (!outputFile.exists()) + { + outputFile.createNewFile(); + } + outputFileStream = new FileOutputStream(outputFile); + } + catch (IOException e) + { + throw new Exception(e); + } + } + + protected void resolveClassLoader4InputClasspath() throws Exception + { + Java2WSDLCommandLineOption option = null; + + if (option != null) { + ArrayList optionValues = option.getOptionValues(); + URL[] urls = new URL[optionValues.size()]; + String[] classPathEntries = (String[]) optionValues.toArray(new String[optionValues.size()]); + + try { + for (int i = 0; i < classPathEntries.length; i++) { + String classPathEntry = classPathEntries[i]; + //this should be a file(or a URL) + if (Java2WSDLUtils.isURL(classPathEntry)) { + urls[i] = new URL(classPathEntry); + } else { + urls[i] = new File(classPathEntry).toURL(); + } + } + } catch (MalformedURLException e) { + throw new Exception(e); + } + + classLoader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); + + } else { + classLoader = Thread.currentThread().getContextClassLoader(); + } + } + + protected void initializeOtherParams() + { +// set the other parameters to the builder + Java2WSDLCommandLineOption option = loadOption(Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_OPTION, + Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_OPTION_LONG); + schemaTargetNamespace = (option == null) ? null : option.getOptionValue(); + + option = loadOption(Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION, + Java2WSDLConstants.SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG); + schemaTargetNamespacePrefix = (option == null) ? null : option.getOptionValue(); + + option = loadOption(Java2WSDLConstants.TARGET_NAMESPACE_OPTION, + Java2WSDLConstants.TARGET_NAMESPACE_OPTION_LONG); + targetNamespace = (option == null) ? null : option.getOptionValue(); + + option = loadOption(Java2WSDLConstants.TARGET_NAMESPACE_PREFIX_OPTION, + Java2WSDLConstants.TARGET_NAMESPACE_PREFIX_OPTION_LONG); + targetNamespacePrefix = (option == null) ? null : option.getOptionValue(); + + option = loadOption(Java2WSDLConstants.SERVICE_NAME_OPTION, + Java2WSDLConstants.SERVICE_NAME_OPTION_LONG); + serviceName = (option == null) ? Java2WSDLUtils.getSimpleClassName(sourceClassName) : option.getOptionValue(); + + option = loadOption(Java2WSDLConstants.STYLE_OPTION,Java2WSDLConstants.STYLE_OPTION); + style = (option == null) ? null : option.getOptionValue(); + + + option = loadOption(Java2WSDLConstants.LOCATION_OPTION, + Java2WSDLConstants.LOCATION_OPTION); + locationUri = (option == null) ? null : option.getOptionValue(); + + option = loadOption(Java2WSDLConstants.USE_OPTION,Java2WSDLConstants.USE_OPTION); + use = (option == null) ? null : option.getOptionValue(); + } + + public ClassLoader getClassLoader() + { + return classLoader; + } + + public void setClassLoader(ClassLoader classLoader) + { + this.classLoader = classLoader; + } + + public String getLocationUri() + { + return locationUri; + } + + public void setLocationUri(String locationUri) + { + this.locationUri = locationUri; + } + + public FileOutputStream getOutputFileStream() + { + return outputFileStream; + } + + public void setOutputFileStream(FileOutputStream outputFileStream) + { + this.outputFileStream = outputFileStream; + } + + public String getSchemaTargetNamespace() + { + return schemaTargetNamespace; + } + + public void setSchemaTargetNamespace(String schemaTargetNamespace) + { + this.schemaTargetNamespace = schemaTargetNamespace; + } + + public String getSchemaTargetNamespacePrefix() + { + return schemaTargetNamespacePrefix; + } + + public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix) + { + this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix; + } + + public String getServiceName() + { + return serviceName; + } + + public void setServiceName(String serviceName) + { + this.serviceName = serviceName; + } + + public String getSourceClassName() + { + return sourceClassName; + } + + public void setSourceClassName(String sourceClassName) + { + this.sourceClassName = sourceClassName; + } + + public String getStyle() + { + return style; + } + + public void setStyle(String style) + { + this.style = style; + } + + public String getTargetNamespace() + { + return targetNamespace; + } + + public void setTargetNamespace(String targetNamespace) + { + this.targetNamespace = targetNamespace; + } + + public String getTargetNamespacePrefix() + { + return targetNamespacePrefix; + } + + public void setTargetNamespacePrefix(String targetNamespacePrefix) + { + this.targetNamespacePrefix = targetNamespacePrefix; + } + + public String getUse() + { + return use; + } + + public void setUse(String use) + { + this.use = use; + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java new file mode 100644 index 0000000000..5538ec1cfa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java @@ -0,0 +1,59 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser; +import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator; + +/** + * This class provides the tooling abstraction to Tuscany Java2WSDL and can be + * invoked from command line with the follwing options as with Axis2 Java2WSDL + * + */ +public class Java2WSDL { + /** + * @param args + */ + public static void main(String[] args) + { + //parse the cmd line args + Java2WSDLCommandLineOptionParser commandLineOptionParser = + new Java2WSDLCommandLineOptionParser(args); + // validate the arguments + validateCommandLineOptions(commandLineOptionParser); + + Java2WSDLGeneratorFactory.getInstance().createGenerator(). + generateWSDL(commandLineOptionParser.getAllOptions()); + + // Uncomment the following statement to directly run the Axis2 tool + // without + // runAxis2Tool(args); + } + + private static void runAxis2Tool(String[] args) { + org.apache.ws.java2wsdl.Java2WSDL.main(args); + } + + private static void validateCommandLineOptions(Java2WSDLCommandLineOptionParser parser) { + if (parser.getAllOptions().size() == 0) { + org.apache.ws.java2wsdl.Java2WSDL.printUsage(); + } else if (parser.getInvalidOptions(new Java2WSDLOptionsValidator()).size() > 0) { + org.apache.ws.java2wsdl.Java2WSDL.printUsage(); + } + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java new file mode 100644 index 0000000000..0decbd6011 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Map; + +/** + * This is the Java2WSDL Generator facade that will be used by Tuscany + * components for java to wsdl conversion. + * + */ +public interface Java2WSDLGenerator { + public void generateWSDL(String[] args); + + public void generateWSDL(Map commandLineOptions); + + public void addWSDLGenListener(WSDLGenListener l); + + public void removeWSDLGenListener(WSDLGenListener l); + + public Map getCommandLineOptions(); + + public void setCommandLineOptoins(Map cmdLineOpts); + + public WSDLModel getWSDLModel(); + + public OutputStream getOutputStream(); + + public void setOutputStream(OutputStream outStream); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java new file mode 100644 index 0000000000..3e9e745aee --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java @@ -0,0 +1,87 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.Vector; + +/** + * Factory that creates Java2WSDL Generators. Presently the there is a Default + * Generator that wraps around the AXIS2 Java2WSDL implementation. The factory + * can be extended to create generators that wrap around other implementations + * if required. + */ + +public class Java2WSDLGeneratorFactory { + /* + * singleton instance of this factory class + */ + private static Java2WSDLGeneratorFactory factory = null; + + /** + * code for the default generator + */ + public static final int DEFAULT_GENERATOR = 0; + + /** + * Default Generator class name + */ + public static final String DEFAULT_GENERATOR_CLASSNAME = "org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorImpl"; + + /** + * list of generator classnames in a position that corresponds to their + * code. For example the default generator's code is 0 and hence this + * generator's classname is stored at index '0' of the list + */ + protected Vector generatorClassNames = new Vector(); + + /** + * @return the singleton instance of this generator factory + */ + public static Java2WSDLGeneratorFactory getInstance() { + if (factory == null) { + factory = new Java2WSDLGeneratorFactory(); + } + return factory; + } + + private Java2WSDLGeneratorFactory() { + generatorClassNames.addElement(DEFAULT_GENERATOR_CLASSNAME); + } + + public Java2WSDLGenerator createGenerator() { + return createGenerator(DEFAULT_GENERATOR); + } + + /** + * creates an instance of a Java2WSDL Generator based on the input type + * + * @param genType + * type of the generator to be created + * @return an instance of a Java2WSDL Generator + */ + public Java2WSDLGenerator createGenerator(int genType) { + try { + return (Java2WSDLGenerator) (Class.forName(generatorClassNames + .elementAt(genType)).newInstance()); + } catch (Exception e) { + System.out + .println(" Unable to create Java2WSDL generator due to ....."); + System.out.println(e); + return null; + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java new file mode 100644 index 0000000000..1e3498be3d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java @@ -0,0 +1,286 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import org.apache.ws.java2wsdl.Java2WSDL; +import org.apache.axis2.wsdl.util.CommandLineOption; +import org.apache.axis2.wsdl.util.CommandLineOptionParser; +import org.apache.axis2.wsdl.util.Java2WSDLOptionsValidator; +import org.apache.ws.java2wsdl.Java2WSDLUtils; + +/** + * This is an implementation of the Java2WSDLGenerator facade. This + * implementation is a decorator around the Axis2 implementation of the + * Java2WSDL conversion. The WSDL generation is divided into phases that are + * stringed up as a template method. The phases are - User Input Validation - + * WSDL Java Model Generation - Serialization of WSDL Java Model The function of + * each phase is accomplished by delegation to the appropriate classes in Axis2. + * At the start and end of each phase an event is published to subcribers + * denoting the start and end of the phase. + * + * Such a spliting up of the Java2WSDL conversion into phases has been designed + * to enable interceptors to modify the model or apply transformations to the + * output. Typically the interceptors can subscribe to the start and end events + * of these phases and hence be able to intercept. + * + * Note: This class contains substantial AXIS2 Java2WSDL code refactored into + * it. These will be removed as and when the Axis2 code is fixed. + * + */ +public class Java2WSDLGeneratorImpl implements Java2WSDLGenerator +{ + private List genPhaseListeners = new Vector(); + private GenerationParameters genParams = null; + private Map commandLineOptions = null; + private TuscanyJava2WSDLBuilder java2WsdlBuilder; + private OutputStream outputStream = null; + + /*public static final String HTTP = "http://"; + + public static final String WSDL_FILENAME_SUFFIX = ".wsdl"; + + public static final String DEFAULT_PREFIX = "wsdl"; + + public static final char PACKAGE_CLASS_DELIMITER = '.'; + + public static final String DEFAULT_TARGET_NAMESPACE_PREFIX = "tns"; + + public static final String DEFAULT_SCHEMA_TARGET_NAMESPACE_PREFIX = "stns"; + + private String sourceClassName = null; + + + + private ClassLoader classLoader; + + private WSDLDescription wsdlDescription = null; + + private WSDLModel wsdlModel = null;*/ + + public Java2WSDLGeneratorImpl() + { + + } + + private void multicastGenPhaseCompletionEvent(int genPhase) { + WSDLGenEvent event = new WSDLGenEvent(this, genPhase); + Iterator iterator = genPhaseListeners.iterator(); + while (iterator.hasNext()) { + ((WSDLGenListener) iterator.next()).WSDLGenPhaseCompleted(event); + } + } + + private void initJava2WSDLBuilder() throws Exception + { +// Now we are done with loading the basic values - time to create the builder + java2WsdlBuilder = new TuscanyJava2WSDLBuilder(genParams.getOutputFileStream(), + genParams.getSourceClassName(), + genParams.getClassLoader()); + java2WsdlBuilder.setSchemaTargetNamespace(genParams.getSchemaTargetNamespace()); + java2WsdlBuilder.setSchemaTargetNamespacePrefix(genParams.getSchemaTargetNamespacePrefix()); + java2WsdlBuilder.setTargetNamespace(genParams.getTargetNamespace()); + java2WsdlBuilder.setTargetNamespacePrefix(genParams.getTargetNamespacePrefix()); + java2WsdlBuilder.setServiceName(genParams.getServiceName() == null ? + Java2WSDLUtils.getSimpleClassName(genParams.getSourceClassName()) : genParams.getServiceName()); + + if (genParams.getStyle() != null) + { + java2WsdlBuilder.setStyle(genParams.getStyle()); + } + + if (genParams.getLocationUri() != null) { + java2WsdlBuilder.setLocationUri(genParams.getLocationUri()); + } + + if (genParams.getUse() != null) + { + java2WsdlBuilder.setUse(genParams.getUse()); + } + } + + protected boolean validateInputArgs(String[] args) + { + boolean isValid = true; + CommandLineOptionParser parser = new CommandLineOptionParser(args); + if (parser.getAllOptions().size() == 0) { + Java2WSDL.printUsage(); + isValid = false; + } else if (parser.getInvalidOptions(new Java2WSDLOptionsValidator()) + .size() > 0) { + Java2WSDL.printUsage(); + isValid = false; + } + + if (isValid) + { + commandLineOptions = parser.getAllOptions(); + } + + return isValid; + } + + public boolean buildWSDLDocument() throws Exception + { + boolean isComplete = true; + initJava2WSDLBuilder(); + java2WsdlBuilder.buildWSDL(); + + return isComplete; + } + + public boolean serializeWSDLDocument() throws Exception { + boolean isComplete = true; + + if ( getOutputStream() == null ) + { + setOutputStream(genParams.getOutputFileStream()); + } + + java2WsdlBuilder.getWsdlDocument().serialize(getOutputStream()); + getOutputStream().flush(); + getOutputStream().close();; + + return isComplete; + } + + /* + * This is the template method that splits the Java2WSDL generation cycle + * into phase / steps. + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#generateWSDL(java.lang.String[]) + */ + public void generateWSDL(Map commandLineOptions) + { + try + { + // load the user options into an easy to access abstraction + genParams = new GenerationParameters(commandLineOptions); + + // if the WSDL Model generation was successul + if ( buildWSDLDocument() ) + { + // multicast event for generation of wsdl model + multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_CREATION); + // if the serialization of the generated (and fixed) model + // is successful + if (serializeWSDLDocument()) { + // multicast event for writing of the WSDL Model to + // supplied output stream + multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_WRITING); + } + } + } + catch (Exception e) + { + e.printStackTrace(); + } + + // TODO Auto-generated method stub + + } + + public void generateWSDL(String[] args) + { + // if the argument input are found to be valid + if (validateInputArgs(args)) + { + //multicast event for input args validation complete + multicastGenPhaseCompletionEvent(WSDLGenListener.INPUT_ARGS_VALIDATION); + generateWSDL(commandLineOptions); + } + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#addWSDLGenListener(tuscany.tools.WSDLGenListener) + */ + public void addWSDLGenListener(WSDLGenListener l) { + genPhaseListeners.add(l); + + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#removeWSDLGenListener(tuscany.tools.WSDLGenListener) + */ + public void removeWSDLGenListener(WSDLGenListener l) { + genPhaseListeners.remove(l); + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#getCommandLineOptions() + */ + public Map getCommandLineOptions() { + return commandLineOptions; + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#setCommandLineOptoins(java.util.Map) + */ + public void setCommandLineOptoins(Map cmdLineOpts) { + commandLineOptions = cmdLineOpts; + } + + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#getOutputStream() + */ + public OutputStream getOutputStream() { + // TODO Auto-generated method stub + return outputStream; + } + + /* + * (non-Javadoc) + * + * @see tuscany.tools.Java2WSDLGeneratorIfc#setOutputStream(java.io.OutputStream) + */ + public void setOutputStream(OutputStream outStream) { + outputStream = outStream; + } + + + public TuscanyJava2WSDLBuilder getJava2WsdlBuilder() + { + return java2WsdlBuilder; + } + + public void setJava2WsdlBuilder(TuscanyJava2WSDLBuilder java2WsdlBuilder) + { + this.java2WsdlBuilder = java2WsdlBuilder; + } + + public WSDLModel getWSDLModel() + { + // TODO Auto-generated method stub + return null; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java new file mode 100644 index 0000000000..49c3e4df9f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java @@ -0,0 +1,428 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.ByteArrayInputStream; +import java.io.StringWriter; +import java.util.Collection; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axiom.om.OMNode; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.ws.commons.schema.XmlSchema; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.utils.TypeTable; +import org.codehaus.jam.JMethod; + +public class TuscanyJava2OMBuilder implements Java2WSDLConstants { + + private TypeTable typeTable = null; + + private static int prefixCount = 1; + + private static final String NAMESPACE_PREFIX = "ns"; + + private JMethod method []; + + private Collection schemaCollection; + + private String serviceName; + + private String targetNamespace; + + private String targetNamespacePrefix; + + private OMNamespace ns1; + + private OMNamespace soap; + + private OMNamespace soap12; + + private OMNamespace tns; + + private OMNamespace wsdl; + + private OMNamespace mime; + + private OMNamespace http; + + private String style; + + private String use; + + private String locationURL; + + public TuscanyJava2OMBuilder(JMethod[] method, Collection schemaCollection, + TypeTable typeTab, String serviceName, String targetNamespace, + String targetNamespacePrefix, String style, String use, + String locationURL) { + this.method = method; + this.schemaCollection = schemaCollection; + this.typeTable = typeTab; + if (style == null) { + this.style = DOCUMNT; + } else { + this.style = style; + } + if (use == null) { + this.use = LITERAL; + } else { + this.use = use; + } + + if (locationURL == null) { + this.locationURL = DEFAULT_LOCATION_URL; + } else { + this.locationURL = locationURL; + } + this.serviceName = serviceName; + + if (targetNamespace != null && !targetNamespace.trim().equals("")) { + this.targetNamespace = targetNamespace; + } else { + this.targetNamespace = DEFAULT_TARGET_NAMESPACE; + } + + if (targetNamespacePrefix != null + && !targetNamespacePrefix.trim().equals("")) { + this.targetNamespacePrefix = targetNamespacePrefix; + } else { + this.targetNamespacePrefix = DEFAULT_TARGET_NAMESPACE_PREFIX; + } + } + + public OMElement generateOM() throws Exception { + OMFactory fac = OMAbstractFactory.getOMFactory(); + wsdl = fac.createOMNamespace(WSDL_NAMESPACE, + DEFAULT_WSDL_NAMESPACE_PREFIX); + OMElement ele = fac.createOMElement("definitions", wsdl); + + ele.addAttribute("targetNamespace", targetNamespace, null); + generateNamespaces(fac, ele); + generateTypes(fac, ele); + generateMessages(fac, ele); + generatePortType(fac, ele); + generateBinding(fac, ele); + generateService(fac, ele); + return ele; + } + + private void generateNamespaces(OMFactory fac, OMElement defintions) { + soap = defintions.declareNamespace(URI_WSDL11_SOAP, SOAP11_PREFIX); + tns = defintions.declareNamespace(targetNamespace, + targetNamespacePrefix); + soap12 = defintions.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX); + http = defintions.declareNamespace(HTTP_NAMESPACE, HTTP_PREFIX); + mime = defintions.declareNamespace(MIME_NAMESPACE, MIME_PREFIX); + } + + private void generateTypes(OMFactory fac, OMElement defintions) + throws Exception { + OMElement wsdlTypes = fac.createOMElement("types", wsdl); + StringWriter writer = new StringWriter(); + + // wrap the Schema elements with this start and end tags to create a + // document root + // under which the schemas can fall into + writer.write(""); + writeSchemas(writer); + writer.write(""); + XMLStreamReader xmlReader = XMLInputFactory.newInstance() + .createXMLStreamReader( + new ByteArrayInputStream(writer.toString().getBytes())); + + StAXOMBuilder staxOMBuilders = new StAXOMBuilder(fac, xmlReader); + Iterator iterator = staxOMBuilders.getDocumentElement() + .getChildElements(); + while (iterator.hasNext()) { + wsdlTypes.addChild((OMNode) iterator.next()); + } + defintions.addChild(wsdlTypes); + } + + private void writeSchemas(StringWriter writer) { + Iterator iterator = schemaCollection.iterator(); + XmlSchema xmlSchema = null; + //Iterator typeIterator = null; + while (iterator.hasNext()) { + xmlSchema = (XmlSchema) iterator.next(); + //typeIterator = xmlSchema.getSchemaTypes().getValues(); + /*while (typeIterator.hasNext()) { + xmlSchema.getItems().add((XmlSchemaObject) typeIterator.next()); + + }*/ + xmlSchema.write(writer); + } + } + + private void generateMessages(OMFactory fac, OMElement definitions) { + Hashtable namespaceMap = new Hashtable(); + String namespacePrefix = null; + String namespaceURI = null; + QName messagePartType = null; + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + + // only if a type for the message part has already been defined + if ((messagePartType = typeTable.getComplexSchemaType(jmethod + .getSimpleName())) != null) { + namespaceURI = messagePartType.getNamespaceURI(); + // avoid duplicate namespaces + if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) { + namespacePrefix = generatePrefix(); + namespaceMap.put(namespaceURI, namespacePrefix); + } + + //Request Message + OMElement requestMessge = fac.createOMElement( + MESSAGE_LOCAL_NAME, wsdl); + requestMessge.addAttribute(ATTRIBUTE_NAME, jmethod + .getSimpleName() + + MESSAGE_SUFFIX, null); + definitions.addChild(requestMessge); + OMElement requestPart = fac.createOMElement( + PART_ATTRIBUTE_NAME, wsdl); + requestMessge.addChild(requestPart); + requestPart.addAttribute(ATTRIBUTE_NAME, "part1", null); + + requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME, + namespacePrefix + COLON_SEPARATOR + + jmethod.getSimpleName(), null); + } + + // only if a type for the message part has already been defined + if ((messagePartType = typeTable.getComplexSchemaType(jmethod + .getSimpleName() + + RESPONSE)) != null) { + namespaceURI = messagePartType.getNamespaceURI(); + if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) { + namespacePrefix = generatePrefix(); + namespaceMap.put(namespaceURI, namespacePrefix); + } + //Response Message + OMElement responseMessge = fac.createOMElement( + MESSAGE_LOCAL_NAME, wsdl); + responseMessge.addAttribute(ATTRIBUTE_NAME, jmethod + .getSimpleName() + + RESPONSE_MESSAGE, null); + definitions.addChild(responseMessge); + OMElement responsePart = fac.createOMElement( + PART_ATTRIBUTE_NAME, wsdl); + responseMessge.addChild(responsePart); + responsePart.addAttribute(ATTRIBUTE_NAME, "part1", null); + + responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, + namespacePrefix + COLON_SEPARATOR + + jmethod.getSimpleName() + RESPONSE, null); + } + } + + // now add these unique namespaces to the the definitions element + Enumeration enumeration = namespaceMap.keys(); + while (enumeration.hasMoreElements()) { + namespaceURI = (String) enumeration.nextElement(); + definitions.declareNamespace(namespaceURI, (String) namespaceMap + .get(namespaceURI)); + } + } + + /** + * Generate the porttypes + */ + private void generatePortType(OMFactory fac, OMElement defintions) { + JMethod jmethod = null; + OMElement operation = null; + OMElement message = null; + OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, wsdl); + defintions.addChild(portType); + portType.addAttribute(ATTRIBUTE_NAME, serviceName + PORT_TYPE_SUFFIX, + null); + //adding message refs + for (int i = 0; i < method.length; i++) { + jmethod = method[i]; + operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl); + portType.addChild(operation); + operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(), + null); + + message = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl); + message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + + COLON_SEPARATOR + jmethod.getSimpleName() + + MESSAGE_SUFFIX, null); + operation.addChild(message); + + if (!jmethod.getReturnType().isVoidType()) { + message = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl); + message.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + + COLON_SEPARATOR + jmethod.getSimpleName() + + RESPONSE_MESSAGE, null); + operation.addChild(message); + } + } + + } + + /** + * Generate the service + */ + public void generateService(OMFactory fac, OMElement defintions) { + OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, wsdl); + defintions.addChild(service); + service.addAttribute(ATTRIBUTE_NAME, serviceName, null); + OMElement port = fac.createOMElement(PORT, wsdl); + service.addChild(port); + port.addAttribute(ATTRIBUTE_NAME, serviceName + SOAP11PORT, null); + port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + COLON_SEPARATOR + + serviceName + BINDING_NAME_SUFFIX, null); + addExtensionElement(fac, port, soap, SOAP_ADDRESS, LOCATION, locationURL + + serviceName); + + port = fac.createOMElement(PORT, wsdl); + service.addChild(port); + port.addAttribute(ATTRIBUTE_NAME, serviceName + SOAP12PORT, null); + port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix() + COLON_SEPARATOR + + serviceName + SOAP12BINDING_NAME_SUFFIX, null); + addExtensionElement(fac, port, soap12, SOAP_ADDRESS, LOCATION, locationURL + + serviceName); + } + + /** + * Generate the bindings + */ + private void generateBinding(OMFactory fac, OMElement defintions) { + generateSoap11Binding(fac, defintions); + generateSoap12Binding(fac, defintions); + } + + private void generateSoap11Binding(OMFactory fac, OMElement defintions) { + OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl); + defintions.addChild(binding); + binding.addAttribute(ATTRIBUTE_NAME, serviceName + BINDING_NAME_SUFFIX, + null); + binding.addAttribute("type", tns.getPrefix() + COLON_SEPARATOR + + serviceName + PORT_TYPE_SUFFIX, null); + + addExtensionElement(fac, binding, soap, BINDING_LOCAL_NAME, TRANSPORT, + TRANSPORT_URI, STYLE, style); + + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + binding.addChild(operation); + + addExtensionElement(fac, operation, soap, OPERATION_LOCAL_NAME, + SOAP_ACTION, URN_PREFIX + COLON_SEPARATOR + + jmethod.getSimpleName(), STYLE, style); + operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(), + null); + + OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl); + addExtensionElement(fac, input, soap, SOAP_BODY, SOAP_USE, use, + "namespace", targetNamespace); + operation.addChild(input); + + if (!jmethod.getReturnType().isVoidType()) { + OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl); + addExtensionElement(fac, output, soap, SOAP_BODY, SOAP_USE, use, + "namespace", targetNamespace); + operation.addChild(output); + } + } + } + + private void generateSoap12Binding(OMFactory fac, OMElement defintions) { + OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl); + defintions.addChild(binding); + binding.addAttribute(ATTRIBUTE_NAME, serviceName + SOAP12BINDING_NAME_SUFFIX, + null); + binding.addAttribute("type", tns.getPrefix() + COLON_SEPARATOR + + serviceName + PORT_TYPE_SUFFIX, null); + + addExtensionElement(fac, binding, soap12, BINDING_LOCAL_NAME, TRANSPORT, + TRANSPORT_URI, STYLE, style); + + for (int i = 0; i < method.length; i++) { + JMethod jmethod = method[i]; + OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, + wsdl); + binding.addChild(operation); + operation.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX); + + addExtensionElement(fac, operation, soap12, OPERATION_LOCAL_NAME, + SOAP_ACTION, URN_PREFIX + COLON_SEPARATOR + + jmethod.getSimpleName(), STYLE, style); + operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(), + null); + + OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl); + addExtensionElement(fac, input, soap12, SOAP_BODY, SOAP_USE, use, + "namespace", targetNamespace); + operation.addChild(input); + + if (!jmethod.getReturnType().isVoidType()) { + OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl); + addExtensionElement(fac, output, soap12, SOAP_BODY, SOAP_USE, use, + "namespace", targetNamespace); + operation.addChild(output); + } + } + } + +// private void addExtensionElement(OMFactory fac, OMElement element, String name, OMNamespace namespace, +// Hashtable attrs) { +// OMElement soapbinding = fac.createOMElement(name, namespace); +// element.addChild(soapbinding); +// Enumeration enumeration = attrs.keys(); +// String attrName = null; +// while (enumeration.hasMoreElements()) { +// attrName = (String) enumeration.nextElement(); +// soapbinding.addAttribute(attrName, (String) attrs.get(attrName), null); +// } +// } + + private void addExtensionElement(OMFactory fac, OMElement element, OMNamespace namespace, + String name, String att1Name, String att1Value, String att2Name, + String att2Value) { + OMElement soapbinding = fac.createOMElement(name, namespace); + element.addChild(soapbinding); + soapbinding.addAttribute(att1Name, att1Value, null); + soapbinding.addAttribute(att2Name, att2Value, null); + } + + private void addExtensionElement(OMFactory fac, OMElement element, OMNamespace namespace, + String name, String att1Name, String att1Value) { + OMElement soapbinding = fac.createOMElement(name, namespace); + element.addChild(soapbinding); + soapbinding.addAttribute(att1Name, att1Value, null); + } + + private String generatePrefix() { + return NAMESPACE_PREFIX + prefixCount++; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java new file mode 100644 index 0000000000..ede8b6e692 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java @@ -0,0 +1,165 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.OutputStream; +import java.util.Collection; + +import org.apache.axiom.om.OMElement; +import org.apache.ws.java2wsdl.Java2WSDLConstants; +import org.apache.ws.java2wsdl.Java2WSDLUtils; +import org.apache.ws.java2wsdl.SchemaGenerator; + +public class TuscanyJava2WSDLBuilder { + + private OutputStream out; + private String className; + private ClassLoader classLoader; + private String wsdlPrefix = "wsdl"; + + private String serviceName = null; + + //these apply for the WSDL + private String targetNamespace = null; + private String targetNamespacePrefix = null; + + private String schemaTargetNamespace = null; + private String schemaTargetNamespacePrefix = null; + private String style = Java2WSDLConstants.DOCUMNT; + private String use = Java2WSDLConstants.LITERAL; + private String locationUri = Java2WSDLConstants.DEFAULT_LOCATION_URL; + + private OMElement wsdlDocument = null; + + public String getSchemaTargetNamespace() { + return schemaTargetNamespace; + } + + public String getStyle() { + return style; + } + + public String getLocationUri() { + return locationUri; + } + + public void setLocationUri(String locationUri) { + this.locationUri = locationUri; + } + + public void setStyle(String style) { + this.style = style; + } + + public String getUse() { + return use; + } + + public void setUse(String use) { + this.use = use; + } + + public void setSchemaTargetNamespace(String schemaTargetNamespace) { + this.schemaTargetNamespace = schemaTargetNamespace; + } + + public String getSchemaTargetNamespacePrefix() { + return schemaTargetNamespacePrefix; + } + + public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix) { + this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix; + } + + public String getTargetNamespace() { + return targetNamespace; + } + + public void setTargetNamespace(String targetNamespace) { + this.targetNamespace = targetNamespace; + } + + public String getTargetNamespacePrefix() { + return targetNamespacePrefix; + } + + public void setTargetNamespacePrefix(String targetNamespacePrefix) { + this.targetNamespacePrefix = targetNamespacePrefix; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + + public String getWsdlPrefix() { + return wsdlPrefix; + } + + public void setWsdlPrefix(String wsdlPrefix) { + this.wsdlPrefix = wsdlPrefix; + } + + /** + * @param out + * @param className + * @param classLoader + */ + public TuscanyJava2WSDLBuilder(OutputStream out, String className, ClassLoader classLoader) { + this.out = out; + this.className = className; + this.classLoader = classLoader; + } + + + /** + * Externally visible generator method + * + * @throws Exception + */ + public void buildWSDL() throws Exception + { + SchemaGenerator sg = new SchemaGenerator(classLoader, className, + schemaTargetNamespace, schemaTargetNamespacePrefix); + Collection schemaCollection = sg.generateSchema(); + TuscanyJava2OMBuilder java2OMBuilder = new TuscanyJava2OMBuilder(sg.getMethods(), + schemaCollection, + sg.getTypeTable(), + serviceName == null ? Java2WSDLUtils.getSimpleClassName(className) : serviceName, + targetNamespace == null ? Java2WSDLUtils.namespaceFromClassName(className, classLoader).toString():targetNamespace, + targetNamespacePrefix, + style, + use, + locationUri); + wsdlDocument = java2OMBuilder.generateOM(); + } + + public OMElement getWsdlDocument() + { + return wsdlDocument; + } + + public void setWsdlDocument(OMElement wsdlDocument) + { + this.wsdlDocument = wsdlDocument; + } +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java new file mode 100644 index 0000000000..951742a255 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.util.EventObject; + +public class WSDLGenEvent extends EventObject { + private int generationPhase = WSDLGenListener.UNKNOWN; + + public WSDLGenEvent(Object source, int genPhase) { + super(source); + this.generationPhase = genPhase; + } + + public int getGenerationPhase() { + return generationPhase; + } + + public void setGenerationPhase(int generationPhase) { + this.generationPhase = generationPhase; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java new file mode 100644 index 0000000000..b4ae356bf6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +public interface WSDLGenListener { + public static int UNKNOWN = 0; + + public static int INPUT_ARGS_PARSING = 1; + + public static int INPUT_ARGS_VALIDATION = 2; + + public static int WSDL_MODEL_CREATION = 3; + + public static int WSDL_MODEL_WRITING = 4; + + public static String[] phaseAsString = { "Unknown", + "Input Arguments Parsing", "Input Arguments Validation", + "WSDL Model Creation", "WSDL Model Writing" }; + + public void WSDLGenPhaseStarted(WSDLGenEvent event); + + public void WSDLGenPhaseCompleted(WSDLGenEvent event); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLModel.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLModel.java new file mode 100644 index 0000000000..69446eb0ca --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLModel.java @@ -0,0 +1,29 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + + +/** + * This class provides a higher level abstraction to parts of the WSDL model + * generated by Axis to enable easy and straight forward access to these parts + * when the Tuscany Java2WSDL is applying fixes to the model. + * + */ +public class WSDLModel +{ + //this class is to be populated later after identifying requirements for it. +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java new file mode 100644 index 0000000000..7bb2559b62 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java @@ -0,0 +1,200 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.axis2.description.AxisMessage; +import org.apache.axis2.description.AxisOperation; +import org.apache.axis2.util.FileWriter; +import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.emitter.JavaEmitter; +import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter; +import org.apache.axis2.wsdl.databinding.TypeMapper; +import org.apache.tuscany.model.util.XMLNameUtil; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * Overrides the Axis2 JavaEmitter to generate unwrapped methods. + */ +public class JavaInterfaceEmitter extends JavaEmitter { + + private CodeGenConfiguration codegenConfiguration; + private TypeMapper typeMapper; + + public void setCodeGenConfiguration(CodeGenConfiguration configuration) { + super.setCodeGenConfiguration(configuration); + codegenConfiguration=configuration; + } + + public void setMapper(TypeMapper typeMapper) { + super.setMapper(typeMapper); + this.typeMapper = typeMapper; + } + + private List getParameterElementList(Document doc, AxisMessage message, boolean wrapped) { + List parameterElementList = new ArrayList(); + + if (message != null && message.getElementQName()!=null) { + + SDODataBindingTypeMappingEntry typeMappingEntry = + (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(message.getElementQName()); + List typeMappings; + if (wrapped) { + typeMappings = (List)typeMappingEntry.getPropertyClassNames(); + } else { + typeMappings = new ArrayList(); + typeMappings.add(typeMappingEntry.getClassName()); + } + + for (int i=0; i> Generating Java class " + packageName + "." + className); + File outputFile = FileWriter.createClassFile(this.codegenConfiguration.getOutputLocation(), + packageName, className, ".java"); + if (outputFile.exists()) { + outputFile.delete(); + } + + writeClass(interfaceModel, interfaceWriter); + } + + protected String makeJavaClassName(String word) { + return XMLNameUtil.getJavaNameFromXMLName(word, true); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java new file mode 100644 index 0000000000..7c31e0535c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java @@ -0,0 +1,219 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import javax.wsdl.Binding; +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.PortType; +import javax.wsdl.Service; +import javax.wsdl.WSDLException; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.WSDL2AxisServiceBuilder; +import org.apache.axis2.util.XMLUtils; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; +import org.apache.axis2.wsdl.codegen.CodeGenerationException; +import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension; +import org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension; +import org.apache.axis2.wsdl.codegen.extension.PackageFinder; +import org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension; +import org.apache.axis2.wsdl.databinding.JavaTypeMapper; +import org.apache.tuscany.model.util.XMLNameUtil; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +public class JavaInterfaceGenerator { + + private List codegenExtensions = new ArrayList(); + private List codegenConfigurations= new LinkedList(); + + + + + public JavaInterfaceGenerator(String uri, String ports[], String outputLocation, String packageName, + Map typeMapping) throws CodeGenerationException { + + Definition definition; + try { + definition = readWSDL(uri); + } catch (WSDLException e) { + throw new CodeGenerationException(e); + } + + HashSet interestedPorts= ports == null ? null : new HashSet(Arrays.asList(ports)); + + // Service service=(Service)definition.getServices().values().().next(); + + HashSet donePortTypes= new HashSet(); + + for (Iterator sIter = definition.getServices().values().iterator(); sIter.hasNext(); ) { + Service service = (Service) sIter.next(); + + QName serviceQname = service.getQName(); + for (Iterator pIter= service.getPorts().values().iterator(); pIter.hasNext(); ) { + Port port= (Port) pIter.next(); + if(interestedPorts != null && ! interestedPorts.contains(port.getName())) continue;//not iterested. + PortType portType= getPortType(port); + if(null == portType) continue; // not connected. + QName pQName= portType.getQName(); + if(donePortTypes.contains(pQName)) continue; //allready did it. + donePortTypes.add(pQName); + + if (packageName == null) { + packageName = XMLNameUtil.getPackageNameFromNamespace(definition.getTargetNamespace()); + } + JavaTypeMapper typeMapper = new JavaTypeMapper(); + for (Map.Entry e : typeMapping.entrySet()) { + typeMapper.addTypeMappingObject(e.getKey(), e.getValue()); + } + AxisService axisService; + try { + axisService = new WSDL2AxisServiceBuilder(definition, serviceQname, port.getName()).populateService(); + } catch (AxisFault e) { + throw new CodeGenerationException(e); + } + axisService.setName(port.getBinding().getPortType().getQName().getLocalPart()); + CodeGenConfiguration codegenConfiguration = new CodeGenConfiguration(Collections.EMPTY_MAP); + codegenConfigurations.add(codegenConfiguration); + codegenConfiguration.setAxisService(axisService); + codegenConfiguration.setAdvancedCodeGenEnabled(false); + codegenConfiguration.setAsyncOn(false); + codegenConfiguration.setDatabindingType("sdo"); + codegenConfiguration.setGenerateAll(true); + codegenConfiguration.setGenerateDeployementDescriptor(false); + codegenConfiguration.setOutputLanguage("java"); + codegenConfiguration.setOutputLocation(new File(outputLocation)); + codegenConfiguration.setPackageName(packageName); + codegenConfiguration.setPackClasses(false); + codegenConfiguration.setPolicyMap(Collections.EMPTY_MAP); + codegenConfiguration.setPortName(port.getName()); + codegenConfiguration.setServerSide(false); + codegenConfiguration.setServiceName(service.getQName().getLocalPart()); + codegenConfiguration.setSyncOn(true); + codegenConfiguration.setTypeMapper(typeMapper); + codegenConfiguration.setWriteMessageReceiver(false); + codegenConfiguration.setWriteTestCase(false); + addExtension(new WSDLValidatorExtension(), codegenConfiguration); + addExtension(new PackageFinder(), codegenConfiguration); + addExtension(new SDODataBindingCodegenExtension(typeMapper), codegenConfiguration); + addExtension(new DefaultDatabindingExtension(), codegenConfiguration); + } + } + } + + + private PortType getPortType(Port port) { + Binding binding = port.getBinding(); + if(null != binding){ + return binding.getPortType(); + } + return null; + + } + + + @SuppressWarnings("unchecked") + private void addExtension(CodeGenExtension ext, CodeGenConfiguration codegenConfiguration) { + ext.init(codegenConfiguration); + codegenExtensions.add(ext); + } + + public void generate() throws CodeGenerationException { + try { + for (int i = 0; i < codegenExtensions.size(); i++) { + ((CodeGenExtension)codegenExtensions.get(i)).engage(); + } + + for(CodeGenConfiguration codegenConfiguration : codegenConfigurations){ + JavaInterfaceEmitter emitter = new JavaInterfaceEmitter(); + emitter.setCodeGenConfiguration(codegenConfiguration); + emitter.setMapper(codegenConfiguration.getTypeMapper()); + + emitter.writeInterface(false); + } + + } catch (Exception e) { + throw new CodeGenerationException(e); + } + } + + /** + * Read the WSDL file + * @param uri + * @return + * @throws WSDLException + */ + private Definition readWSDL(String uri) throws WSDLException { + + WSDLReader reader = + WSDLFactory.newInstance().newWSDLReader(); + reader.setFeature("javax.wsdl.importDocuments", true); + + File file = new File(uri); + String baseURI; + + if (uri.startsWith("http://")){ + baseURI = uri; + } else{ + if(file.getParentFile() == null){ + try { + baseURI = new File(".").getCanonicalFile().toURI().toString(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } else { + baseURI = file.getParentFile().toURI().toString(); + } + } + + Document doc; + try { + doc = XMLUtils.newDocument(uri); + } catch (ParserConfigurationException e) { + throw new WSDLException(WSDLException.PARSER_ERROR, + "Parser Configuration Error", + e); + } catch (SAXException e) { + throw new WSDLException(WSDLException.PARSER_ERROR, + "Parser SAX Error", + e); + + } catch (IOException e) { + throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e); + } + + return reader.readWSDL(baseURI, doc); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java new file mode 100644 index 0000000000..2523b7efd6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import org.apache.axis2.wsdl.codegen.extension.AbstractDBProcessingExtension; +import org.apache.axis2.wsdl.databinding.TypeMapper; + +/** + * SDO data binding codegen extension. + */ +public class SDODataBindingCodegenExtension extends AbstractDBProcessingExtension { + + private TypeMapper typeMapper; + + public SDODataBindingCodegenExtension(TypeMapper typeMapper) { + this.typeMapper=typeMapper; + } + + protected boolean testFallThrough(String dbFrameworkName) { + return !dbFrameworkName.equals("sdo"); + } + + public void engage() { + if (testFallThrough(configuration.getDatabindingType())) { + return; + } + + // Set the type mapper into the config + configuration.setTypeMapper(typeMapper); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java new file mode 100644 index 0000000000..2f2e5521be --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.util.List; + +/** + * This represents a type mapping entry, used by the JavaInterfaceEmitter to generate + * method signatures. + */ +public class SDODataBindingTypeMappingEntry { + + private final boolean anonymous; + private final List propertyClassNames; + private final String className; + + public SDODataBindingTypeMappingEntry(String className, boolean anonymous, List propertyClassNames) { + this.className = className; + this.anonymous = anonymous; + this.propertyClassNames = propertyClassNames; + } + + public boolean isAnonymous() { + return anonymous; + } + + public String getClassName() { + return className; + } + + public List getPropertyClassNames() { + return propertyClassNames; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java new file mode 100644 index 0000000000..5cf3426c7e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java @@ -0,0 +1,347 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.codegen.ecore.genmodel.GenClass; +import org.eclipse.emf.codegen.ecore.genmodel.GenModel; +import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.codegen.util.CodeGenUtil; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +import commonj.sdo.helper.XSDHelper; + +public class WSDL2JavaGenerator { + + /** + * Generate Java interfaces from WSDL Usage arguments: [ -targetDirectory + * ] [ -javaPackage ] + * For example: generate somedir/somefile.wsdl Basic options: + * -targetDirectory Generates the Java source code in the specified + * directory. By default, the code is generated in the same directory as the + * input wsdl file. -javaPackage Overrides the Java package for the + * generated classes. By default the package name is derived from the + * targetNamespace of the WSDL definition being generated. For example, if + * the targetNamespace is "http://www.example.com/simple", the default + * package will be "com.example.simple". + */ + public static void main(String args[]) { + if (args.length == 0) { + printUsage(); + return; + } + + String portName = null; + String targetDirectory = null; + String wsdlJavaPackage = null; + String xsdJavaPackage = null; + + int index = 0; + for (; index < args.length && args[index].startsWith("-"); ++index) { + if (args[index].equalsIgnoreCase("-port")) { + portName = args[++index]; + } else if (args[index].equalsIgnoreCase("-targetDirectory")) { + targetDirectory = args[++index]; + } else if (args[index].equalsIgnoreCase("-javaPackage")) { + wsdlJavaPackage = args[++index]; + } + // else if (...) + else { + printUsage(); + return; + } + } + + String wsdlFileName = args[index]; + if (wsdlFileName == null || targetDirectory == null) { + printUsage(); + return; + } + + generateFromWSDL(wsdlFileName, portName!=null? new String[]{portName}:null, targetDirectory, wsdlJavaPackage, xsdJavaPackage, 0); + + } + + @SuppressWarnings("unchecked") + public static void generateFromWSDL(String wsdlFileName, String targetDirectory, + String wsdlJavaPackage, + String xsdJavaPackage, int genOptions){ + generateFromWSDL( wsdlFileName, null, targetDirectory, + wsdlJavaPackage, + xsdJavaPackage, genOptions); + + } + + + @SuppressWarnings("unchecked") + public static void generateFromWSDL(String wsdlFileName, String[] ports, + String targetDirectory, String wsdlJavaPackage, + String xsdJavaPackage, int genOptions) + { + + // Initialize the SDO runtime + DataObjectUtil.initRuntime(); + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData); + + try { + + // Load the WSDL file + File inputFile = new File(wsdlFileName).getAbsoluteFile(); + InputStream inputStream = new FileInputStream(inputFile); + + // Define SDO metadata + xsdHelper.define(inputStream, inputFile.toURI().toString()); + + if (targetDirectory == null) { + targetDirectory = new File(wsdlFileName).getCanonicalFile().getParent(); + } else { + targetDirectory = new File(targetDirectory).getCanonicalPath(); + } + + // Populate the typeMapping table that will be given to the Axis2 WSDL2Java + Map typeMapping = + new HashMap(); + if (!packageRegistry.values().isEmpty()) { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + + // Populate list of GenPackages and a map of GenClasses keyed by EClass + List genPackages = new ArrayList(); + Map genClasses = new HashMap(); + for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) { + EPackage currentEPackage = (EPackage)iter.next(); + String currentBasePackage = extractBasePackageName(currentEPackage, xsdJavaPackage); + String currentPrefix = CodeGenUtil.capName(currentEPackage.getName()); + + GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage, + currentPrefix, genOptions, resourceSet); + genPackages.add(currentGenPackage); + for (GenClass genClass : (List)currentGenPackage.getGenClasses()) { + genClasses.put(genClass.getEcoreClass(), genClass); + } + + } + + // Process all the SDO packages + // Populate the qname -> interfaceName typeMapping table + for (GenPackage currentGenPackage : genPackages) { + EPackage currentEPackage = currentGenPackage.getEcorePackage(); + + // Populate the type mappings for all the complex types + for (GenClass genClass : (List)currentGenPackage.getGenClasses()) { + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(genClass.getEcoreClass())); + String interfaceName = currentGenPackage.getInterfacePackageName() + '.' + + genClass.getInterfaceName(); + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(interfaceName, false, null); + typeMapping.put(qname, typeMappingEntry); + } + + // Process all the global XSD elements + EClass documentRoot = extendedMetaData.getDocumentRoot(currentEPackage); + if (documentRoot != null) { + for (EStructuralFeature element : (List)extendedMetaData + .getElements(documentRoot)) { + EClassifier elementType = element.getEType(); + + // Handle a complex type + if (elementType instanceof EClass) { + EClass eClass = (EClass)elementType; + + GenClass genClass = genClasses.get(elementType); + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(element)); + String interfaceName = genClass.getGenPackage().getInterfacePackageName() + + '.' + genClass.getInterfaceName(); + boolean anonymous = extendedMetaData.isAnonymous(eClass); + + // Build list of property class names + List propertyClassNames=new ArrayList(); + for (EStructuralFeature feature : (List)eClass.getEStructuralFeatures()) { + EClassifier propertyType = feature.getEType(); + if (propertyType instanceof EClass) { + GenClass propertyGenClass = genClasses.get(propertyType); + String propertyClassName = propertyGenClass.getGenPackage().getInterfacePackageName() + + '.' + propertyGenClass.getInterfaceName(); + propertyClassNames.add(propertyClassName); + } else if (propertyType instanceof EClassifier) { + String propertyClassName = propertyType.getInstanceClass().getName(); + propertyClassNames.add(propertyClassName); + } + } + + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(interfaceName, anonymous, propertyClassNames); + typeMapping.put(qname, typeMappingEntry); + + } else { + + // Handle a simple type + QName qname = new QName(extendedMetaData.getNamespace(currentEPackage), + extendedMetaData.getName(element)); + String className = elementType.getInstanceClass().getName(); + SDODataBindingTypeMappingEntry typeMappingEntry = + new SDODataBindingTypeMappingEntry(className, false, null); + typeMapping.put(qname, typeMappingEntry); + } + } + } + } + } + + try { + JavaInterfaceGenerator codeGenerator = new JavaInterfaceGenerator(wsdlFileName, + ports, + targetDirectory, + wsdlJavaPackage, + typeMapping); + codeGenerator.generate(); + } catch (Exception e) { + throw new IllegalArgumentException(e); + } + + } catch (IOException e) { + throw new IllegalArgumentException(e); + } + } + + @SuppressWarnings("unchecked") + public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix, + int genOptions, ResourceSet resourceSet) { + GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions); + + URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore"); + URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); + + Resource ecoreResource = resourceSet.createResource(ecoreURI); + ecoreResource.getContents().add(ePackage); + + Resource genModelResource = resourceSet.createResource(genModelURI); + genModelResource.getContents().add(genModel); + + return (GenPackage)genModel.getGenPackages().get(0); + } + + public static GenModel ecore2GenModel(EPackage ePackage, String basePackage, + String prefix, int genOptions) { + GenModel genModel = GenModelFactory.eINSTANCE.createGenModel(); + genModel.initialize(Collections.singleton(ePackage)); + + genModel.setRootExtendsInterface(""); + genModel.setRootImplementsInterface("commonj.sdo.DataObject"); + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.DataObjectImpl"); + genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence"); + genModel.setFeatureMapWrapperInternalInterface("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setFeatureMapWrapperClass("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setSuppressEMFTypes(true); + genModel.setSuppressEMFMetaData(true); + genModel.setSuppressEMFModelTags(true); + genModel.setCanGenerate(true); + // FIXME workaround java.lang.NoClassDefFoundError: + // org/eclipse/jdt/core/jdom/IDOMNode with 02162006 build + genModel.setFacadeHelperClass("Hack"); + genModel.setForceOverwrite(true); + + GenPackage genPackage = (GenPackage)genModel.getGenPackages().get(0); + + if (basePackage != null) { + genPackage.setBasePackage(basePackage); + } + if (prefix != null) { + genPackage.setPrefix(prefix); + } + + return genModel; + } + + public static String extractBasePackageName(EPackage ePackage, String javaPackage) { + String qualifiedName = javaPackage != null ? javaPackage : ePackage.getName(); + String name = /* CodeGenUtil. */shortName(qualifiedName); + String baseName = qualifiedName.substring(0, qualifiedName.length() - name.length()); + if (javaPackage != null || !name.equals(qualifiedName)) { + ePackage.setName(name); + } + return baseName != null ? /* CodeGenUtil. */safeQualifiedName(baseName) : null; + } + + public static String shortName(String qualifiedName) { + int index = qualifiedName.lastIndexOf("."); + return index != -1 ? qualifiedName.substring(index + 1) : qualifiedName; + } + + public static String safeQualifiedName(String qualifiedName) { + StringBuffer safeQualifiedName = new StringBuffer(); + for (StringTokenizer stringTokenizer = new StringTokenizer(qualifiedName, "."); + stringTokenizer.hasMoreTokens();) { + String name = stringTokenizer.nextToken(); + safeQualifiedName.append(CodeGenUtil.safeName(name)); + if (stringTokenizer.hasMoreTokens()) { + safeQualifiedName.append('.'); + } + } + return safeQualifiedName.toString(); + } + + protected static void printDiagnostic(Diagnostic diagnostic, String indent) { + System.out.print(indent); + System.out.println(diagnostic.getMessage()); + for (Iterator i = diagnostic.getChildren().iterator(); i.hasNext();) { + printDiagnostic((Diagnostic)i.next(), indent + " "); + } + } + + protected static void printUsage() { + System.out.println("Usage arguments:"); + System.out.println(" [ -targetDirectory ]"); + System.out.println(" [ -javaPackage ]"); + System.out.println(" "); + System.out.println(""); + System.out.println("For example:"); + System.out.println(""); + System.out.println(" generate somedir/somefile.wsdl"); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Account.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Account.java new file mode 100644 index 0000000000..110f206700 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Account.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.math.BigDecimal; + +public class Account { + int accountType; + + String accountNo; + + BigDecimal balance; + + public String getAccountNo() { + return accountNo; + } + + public void setAccountNo(String accountNo) { + this.accountNo = accountNo; + } + + public int getAccountType() { + return accountType; + } + + public void setAccountType(int accountType) { + this.accountType = accountType; + } + + public BigDecimal getBalance() { + return balance; + } + + public void setBalance(BigDecimal balance) { + this.balance = balance; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Customer.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Customer.java new file mode 100644 index 0000000000..a1ff6d9771 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/Customer.java @@ -0,0 +1,27 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +public class Customer { + private String name = ""; + + public int custType = 0; + + public String getName() { + return name; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java new file mode 100644 index 0000000000..8f84925f58 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +public class CustomerValue { + + public int getValue(String custId, String stockSymbol) { + return 0; + } + + public Customer getCustomerDetails(String custId) { + return new Customer(); + } + + /* + * private String privateOperation() { return ""; } + */ +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java new file mode 100644 index 0000000000..a117c47626 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +public class CustomerWithAccount { + + private Customer customer = new Customer(); + + private Account[] accounts; + + public int getValue(String custId, String stockSymbol) { + return 123; + } + + public Customer getCustomerDetails(String custId) { + return customer; + } + + public Account getCustomerAccount(String custId, String accountId) { + return accounts[0]; + } + + public Account[] getAccounts() { + return accounts; + } + + public void setAccounts(Account[] accounts) { + this.accounts = accounts; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java new file mode 100644 index 0000000000..c064ee4abe --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java @@ -0,0 +1,86 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.java2wsdl.generate; + +import java.io.File; + +import junit.framework.TestCase; + +/** + * A JUnit test case to test the Tuscany Java 2 WSDL Generation + */ +public class TuscanyJava2WSDLTestCase extends TestCase { + + /** + * setup the pre-requisites for the test case to run + * + * @exception Exception + */ + protected void setUp() throws Exception { + // System.out.println("inside setup"); + super.setUp(); + } + + /** + * @exception Exception + */ + protected void tearDown() throws Exception { + // System.out.println("inside tearDown"); + super.tearDown(); + } + + /** + * Simple WSDL generation test. + */ + public void testSimpleWSDLGeneration() { + String[] arguments = new String[] { "-cn", + "org.apache.tuscany.tools.java2wsdl.generate.CustomerValue", + "-o", "target/java2wsdl-source", }; + + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CustomerValue.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + /** + * Test WSDL generation where a parameter Object[] is involved. + */ + public void testWsdlGeneration2() { + + String[] arguments = new String[] { + "-cn", + "org.apache.tuscany.tools.java2wsdl.generate.CustomerWithAccount", + "-o", "target/java2wsdl-source", }; + Java2WSDL.main(arguments); + + File file = new File("target/java2wsdl-source/CustomerWithAccount.wsdl"); + assertTrue(file.exists() && file.isFile()); + } + + /** + * Test WSDL generation from a java interface and then generate the java + * interface using the generated WSDL. + */ + public void testRoundTrip() { + // TODO implement round trip + // this should re-generate java interfaces from the generated wsdl + // and compile (?) the generated java code. + // fail(); + + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java new file mode 100644 index 0000000000..a5ee20f9fb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.tools.wsdl2java.generate; + +import junit.framework.TestCase; + +/** + * Test case for WSDL2Java + */ +public class WSDL2JavaGeneratorTestCase extends TestCase { + + public void testAccountService() { + + String basedir = System.getProperty("basedir"); + if (basedir == null) + basedir ="."; + + + String[] args=new String[] { "-targetDirectory", basedir + "/target/wsdl2java-source", + "-javaPackage", "org.apache.tuscany.tools.wsdl2java.generate.account", + basedir + "/src/test/resources/AccountService.wsdl"}; + + WSDL2JavaGenerator.main(args); + + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/resources/AccountService.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/resources/AccountService.wsdl new file mode 100644 index 0000000000..8a694fa4fd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sca/tools/src/test/resources/AccountService.wsdl @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.ecore b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.ecore new file mode 100644 index 0000000000..dce261ecd2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.ecore @@ -0,0 +1,962 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ + + + + +
+ + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + +
+ + + + + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.genmodel b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.genmodel new file mode 100644 index 0000000000..d28946204c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.genmodel @@ -0,0 +1,564 @@ + + + SDO.mdl + VABASE_PLUGINS_PATH + ../.. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.mdl b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.mdl new file mode 100644 index 0000000000..2288766bab --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/model/SDO.mdl @@ -0,0 +1,7670 @@ + +(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 FALSE + snapToGrid TRUE + gridX 16 + gridY 16 + defaultFont (object Font + size 10 + face "Arial" + bold FALSE + italics FALSE + underline FALSE + strike FALSE + color 0 + default_color TRUE) + showMessageNum 1 + showClassOfObject TRUE + notation "Unified") + root_usecase_package (object Class_Category "Use Case View" + quid "3FAA8E8700BE" + exportControl "Public" + global TRUE + logical_models (list unit_reference_list) + logical_presentations (list unit_reference_list + (object UseCaseDiagram "Main" + quid "3FAA8E8700EF" + 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 "3FAA8E8700BD" + exportControl "Public" + global TRUE + subsystem "Component View" + quidu "3FAA8E8700BF" + logical_models (list unit_reference_list + (object Class_Category "sdo" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "nsPrefix" + value "sdo") + (object Attribute + tool "Ecore" + name "nsURI" + value "http://www.apache.org/tuscany/2005/SDO") + (object Attribute + tool "Ecore" + name "basePackage" + value "org.apache.tuscany") + (object Attribute + tool "Ecore" + name "prefix" + value "SDO")) + quid "3FAA8E8B0306" + exportControl "Public" + logical_models (list unit_reference_list + (object Class "ChangeSummary" + quid "3FAB7C360208" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "4361480602D8" + supplier "Logical View::change::ChangeDescription" + quidu "4FAB6F110198")) + operations (list Operations + (object Operation "beginLogging" + quid "3FAB8899003B" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "endLogging" + quid "3FAB88AB0145" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isCreated" + quid "3FAB89650125" + parameters (list Parameters + (object Parameter "dataObject" + type "DataObject")) + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isDeleted" + quid "3FAB896F0314" + parameters (list Parameters + (object Parameter "dataObject" + type "DataObject")) + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getOldValues" + quid "3FAB89A4039C" + parameters (list Parameters + (object Parameter "dataObject" + type "DataObject")) + result "EJavaList" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isModified" + quid "435500FB024C" + parameters (list Parameters + (object Parameter "dataObject" + type "DataObject")) + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getOldValue" + quid "435501180185" + parameters (list Parameters + (object Parameter "dataObject" + type "DataObject") + (object Parameter "property" + type "Property")) + result "ChangeSummarySetting" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getOldContainer" + quid "43550265035B" + parameters (list Parameters + (object Parameter "dataObject" + type "DataObject")) + result "DataObject" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getOldContainmentProperty" + quid "4355027F01D2" + parameters (list Parameters + (object Parameter "dataObject" + type "DataObject")) + result "Property" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getOldSequence" + quid "4355029E03A3" + parameters (list Parameters + (object Parameter "dataObject" + type "DataObject")) + result "Sequence" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "undoChanges" + quid "435502B303D5" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isLogging" + quid "435D2CB50354" + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getDataGraph" + quid "435D2CC200A0" + result "DataGraph" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getChangedDataObjects" + quid "435D2D2B001F" + result "EJavaList" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getRootObject" + quid "435D2D360151" + result "DataObject" + concurrency "Sequential" + opExportControl "Public" + uid 0)) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.ChangeSummary" + quid "3FAB7C4D0373" + stereotype "javaclass" + exportControl "Public"))) + (object Class "ChangeSummarySetting" + quid "3FAB8BF8005A" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "436134F001A6" + supplier "Logical View::change::FeatureChange" + quidu "4FC39D6D0177")) + operations (list Operations + (object Operation "isSet" + quid "3FD14B5800BD" + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getValue" + quid "3FDEF80600EA" + result "EJavaObject" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getProperty" + quid "435D2C440045" + result "Property" + concurrency "Sequential" + opExportControl "Public" + uid 0)) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.ChangeSummary$Setting" + quid "3FAB8C05003A" + stereotype "javaclass" + exportControl "Public"))) + (object Class "DataGraph" + quid "3FAB7BFE03C0" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "43612C7B0243" + supplier "Logical View::ecore::EObject" + quidu "3C4F1C860123")) + operations (list Operations + (object Operation "createRootObject" + quid "3FAB86D40102" + parameters (list Parameters + (object Parameter "namespaceURI" + type "String") + (object Parameter "typeName" + type "String")) + result "DataObject" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "createRootObject" + quid "3FAB87520135" + parameters (list Parameters + (object Parameter "type" + type "Type")) + result "DataObject" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getType" + quid "3FAB87E20024" + parameters (list Parameters + (object Parameter "namespaceURI" + type "String") + (object Parameter "typeName" + type "String")) + result "Type" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getRootObject" + quid "435D2C900120" + result "DataObject" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getChangeSummary" + quid "435D2C9B039D" + result "ChangeSummary" + concurrency "Sequential" + opExportControl "Public" + uid 0)) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.DataGraph" + quid "3FAB7C1A0171" + stereotype "javaclass" + exportControl "Public") + (object ClassAttribute "resourceSet" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isTransient" + value TRUE)) + quid "436129AF0208" + type "EResourceSet" + exportControl "Public") + (object ClassAttribute "rootResource" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isTransient" + value TRUE) + (object Attribute + tool "Ecore" + name "isVolatile" + value TRUE) + (object Attribute + tool "Ecore" + name "isChangeable" + value FALSE)) + quid "436129BF0016" + type "EResource" + exportControl "Public" + derived TRUE))) + (object Class "DataObject" + quid "3FAB6F7501C4" + operations (list Operations + (object Operation "get" + quid "3FAB8EF201A0" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "EJavaObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.get(this, path);") + opExportControl "Public" + uid 0) + (object Operation "set" + quid "3FAB8FE502FE" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "EJavaObject")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.set(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "isSet" + quid "3FAB901001BF" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "boolean" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.isSet(this, path);") + opExportControl "Public" + uid 0) + (object Operation "unset" + quid "3FAB901803B6" + parameters (list Parameters + (object Parameter "path" + type "String")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.unset(this, path);") + opExportControl "Public" + uid 0) + (object Operation "get" + quid "01EDEDEDEDED" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "EJavaObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.get(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "set" + quid "02EDEDEDEDED" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "EJavaObject")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.set(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "isSet" + quid "03EDEDEDEDED" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "boolean" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.isSet(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "unset" + quid "04EDEDEDEDED" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.unset(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "get" + quid "01ADEDEDEDED" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "EJavaObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.get(this, property);") + opExportControl "Public" + uid 0) + (object Operation "set" + quid "02ADEDEDEDED" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "EJavaObject")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.set(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "isSet" + quid "03ADEDEDEDED" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "boolean" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.isSet(this, property);") + opExportControl "Public" + uid 0) + (object Operation "unset" + quid "04ADEDEDEDED" + parameters (list Parameters + (object Parameter "property" + type "Property")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.unset(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getContainer" + quid "AAEDEDEDEDE0" + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getContainer(this);") + opExportControl "Public" + uid 0) + (object Operation "getContainmentProperty" + quid "AAEDEDEDEDE2" + result "Property" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getContainmentProperty(this);") + opExportControl "Public" + uid 0) + (object Operation "getDataGraph" + quid "AAEDEDEDEDE3" + result "DataGraph" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getDataGraph(this);") + opExportControl "Public" + uid 0) + (object Operation "getType" + quid "AAEDEDEDEDE1" + result "Type" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getType(this);") + opExportControl "Public" + uid 0) + (object Operation "getBigDecimal" + quid "EDEDEDED0000" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "EBigDecimal" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBigDecimal(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getBigInteger" + quid "EDEDEDED0001" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "EBigInteger" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBigInteger(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getBoolean" + quid "EDEDEDED0002" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "boolean" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBoolean(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getByte" + quid "EDEDEDED0003" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "byte" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getByte(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getBytes" + quid "EDEDEDED0004" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "EByteArray" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBytes(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getChar" + quid "EDEDEDED0005" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "char" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getChar(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getDataObject" + quid "EDEDEDED0006" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getDataObject(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getDate" + quid "EDEDEDED0007" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "EDate" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getDate(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getDouble" + quid "EDEDEDED0008" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "double" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getDouble(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getFloat" + quid "EDEDEDED0009" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "float" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getFloat(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getInt" + quid "EDEDEDED000A" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "int" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getInt(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getList" + quid "EDEDEDED000B" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "EJavaList" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getList(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getLong" + quid "EDEDEDED000C" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "long" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getLong(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getSequence" + quid "EDEDEDED000D" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "Sequence" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getSequence(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getShort" + quid "EDEDEDED000E" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "short" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getShort(this, path);") + opExportControl "Public" + uid 0) + (object Operation "getString" + quid "EDEDEDED000F" + parameters (list Parameters + (object Parameter "path" + type "String")) + result "String" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getString(this, path);") + opExportControl "Public" + uid 0) + (object Operation "setBigDecimal" + quid "EDEDEDED1000" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "EBigDecimal")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBigDecimal(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setBigInteger" + quid "EDEDEDED1001" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "EBigInteger")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBigInteger(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setBoolean" + quid "EDEDEDED1002" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "boolean")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBoolean(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setByte" + quid "EDEDEDED1003" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "byte")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setByte(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setBytes" + quid "EDEDEDED1004" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "EByteArray")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBytes(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setChar" + quid "EDEDEDED1005" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "char")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setChar(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setDataObject" + quid "EDEDEDED1006" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "DataObject")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setDataObject(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setDate" + quid "EDEDEDED1007" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "EDate")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setDate(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setDouble" + quid "EDEDEDED1008" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "double")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setDouble(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setFloat" + quid "EDEDEDED1009" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "float")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setFloat(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setInt" + quid "EDEDEDED100A" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "int")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setInt(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setList" + quid "EDEDEDED100B" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "EJavaList")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setList(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setLong" + quid "EDEDEDED100C" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "long")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setLong(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setShort" + quid "EDEDEDED100E" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "short")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setShort(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "setString" + quid "EDEDEDED100F" + parameters (list Parameters + (object Parameter "path" + type "String") + (object Parameter "value" + type "String")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setString(this, path, value);") + opExportControl "Public" + uid 0) + (object Operation "getBigDecimal" + quid "EDEDEDED2000" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "EBigDecimal" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBigDecimal(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getBigInteger" + quid "EDEDEDED2001" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "EBigInteger" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBigInteger(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getBoolean" + quid "EDEDEDED2002" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "boolean" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBoolean(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getByte" + quid "EDEDEDED2003" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "byte" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getByte(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getBytes" + quid "EDEDEDED2004" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "EByteArray" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBytes(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getChar" + quid "EDEDEDED2005" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "char" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getChar(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getDataObject" + quid "EDEDEDED2006" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getDataObject(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getDate" + quid "EDEDEDED2007" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "EDate" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getDate(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getDouble" + quid "EDEDEDED2008" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "double" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getDouble(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getFloat" + quid "EDEDEDED2009" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "float" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getFloat(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getInt" + quid "EDEDEDED200A" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "int" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getInt(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getList" + quid "EDEDEDED200B" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "EJavaList" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getList(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getLong" + quid "EDEDEDED200C" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "long" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getLong(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getSequence" + quid "EDEDEDED200D" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "Sequence" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getSequence(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getShort" + quid "EDEDEDED200E" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "short" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getShort(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "getString" + quid "EDEDEDED200F" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "String" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getString(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "setBigDecimal" + quid "EDEDEDED3000" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "EBigDecimal")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBigDecimal(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setBigInteger" + quid "EDEDEDED3001" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "EBigInteger")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBigInteger(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setBoolean" + quid "EDEDEDED3002" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "boolean")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBoolean(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setByte" + quid "EDEDEDED3003" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "byte")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setByte(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setBytes" + quid "EDEDEDED3004" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "EByteArray")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBytes(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setChar" + quid "EDEDEDED3005" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "char")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setChar(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setDataObject" + quid "EDEDEDED3006" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "DataObject")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setDataObject(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setDate" + quid "EDEDEDED3007" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "EDate")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setDate(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setDouble" + quid "EDEDEDED3008" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "double")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setDouble(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setFloat" + quid "EDEDEDED3009" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "float")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setFloat(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setInt" + quid "EDEDEDED300A" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "int")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setInt(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setList" + quid "EDEDEDED300B" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "EJavaList")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setList(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setLong" + quid "EDEDEDED300C" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "long")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setLong(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setShort" + quid "EDEDEDED300E" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "short")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setShort(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "setString" + quid "EDEDEDED300F" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "String")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setString(this, propertyIndex, value);") + opExportControl "Public" + uid 0) + (object Operation "getBigDecimal" + quid "EDEDEEEE2000" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "EBigDecimal" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBigDecimal(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getBigInteger" + quid "EDEDEEEE2001" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "EBigInteger" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBigInteger(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getBoolean" + quid "EDEDEEEE2002" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "boolean" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBoolean(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getByte" + quid "EDEDEEEE2003" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "byte" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getByte(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getBytes" + quid "EDEDEEEE2004" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "EByteArray" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getBytes(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getChar" + quid "EDEDEEEE2005" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "char" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getChar(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getDataObject" + quid "EDEDEEEE2006" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getDataObject(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getDate" + quid "EDEDEEEE2007" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "EDate" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getDate(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getDouble" + quid "EDEDEEEE2008" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "double" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getDouble(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getFloat" + quid "EDEDEEEE2009" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "float" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getFloat(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getInt" + quid "EDEDEEEE200A" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "int" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getInt(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getList" + quid "EDEDEEEE200B" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "EJavaList" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getList(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getLong" + quid "EDEDEEEE200C" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "long" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getLong(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getSequence" + quid "EDEDEEEE200D" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "Sequence" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getSequence(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getShort" + quid "EDEDEEEE200E" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "short" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getShort(this, property);") + opExportControl "Public" + uid 0) + (object Operation "getString" + quid "EDEDEEEE200F" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "String" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getString(this, property);") + opExportControl "Public" + uid 0) + (object Operation "setBigDecimal" + quid "EDEDEEEE3000" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "EBigDecimal")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBigDecimal(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setBigInteger" + quid "EDEDEEEE3001" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "EBigInteger")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBigInteger(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setBoolean" + quid "EDEDEEEE3002" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "boolean")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBoolean(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setByte" + quid "EDEDEEEE3003" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "byte")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setByte(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setBytes" + quid "EDEDEEEE3004" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "EByteArray")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setBytes(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setChar" + quid "EDEDEEEE3005" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "char")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setChar(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setDataObject" + quid "EDEDEEEE3006" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "DataObject")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setDataObject(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setDate" + quid "EDEDEEEE3007" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "EDate")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setDate(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setDouble" + quid "EDEDEEEE3008" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "double")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setDouble(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setFloat" + quid "EDEDEEEE3009" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "float")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setFloat(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setInt" + quid "EDEDEEEE300A" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "int")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setInt(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setList" + quid "EDEDEEEE300B" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "EJavaList")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setList(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setLong" + quid "EDEDEEEE300C" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "long")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setLong(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setShort" + quid "EDEDEEEE300E" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "short")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setShort(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "setString" + quid "EDEDEEEE300F" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "String")) + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.setString(this, property, value);") + opExportControl "Public" + uid 0) + (object Operation "createDataObject" + quid "EDEDEEEEEEE0" + parameters (list Parameters + (object Parameter "propertyName" + type "String")) + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyName);") + opExportControl "Public" + uid 0) + (object Operation "createDataObject" + quid "EDEDEEEEEEE1" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int")) + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyIndex);") + opExportControl "Public" + uid 0) + (object Operation "createDataObject" + quid "EDEDEEEEEEE2" + parameters (list Parameters + (object Parameter "property" + type "Property")) + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, property);") + opExportControl "Public" + uid 0) + (object Operation "createDataObject" + quid "EDEDEEEEEEE3" + parameters (list Parameters + (object Parameter "propertyName" + type "String") + (object Parameter "namespaceURI" + type "String") + (object Parameter "typeName" + type "String")) + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyName, namespaceURI, typeName);") + opExportControl "Public" + uid 0) + (object Operation "createDataObject" + quid "EDEDEEEEEEE4" + parameters (list Parameters + (object Parameter "propertyIndex" + type "int") + (object Parameter "namespaceURI" + type "String") + (object Parameter "typeName" + type "String")) + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyIndex, namespaceURI, typeName);") + opExportControl "Public" + uid 0) + (object Operation "createDataObject" + quid "EDEDEEEEEEE5" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "type" + type "Type")) + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, property, type);") + opExportControl "Public" + uid 0) + (object Operation "delete" + quid "EDEDEEEEEEE6" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.delete(this);") + opExportControl "Public" + uid 0) + (object Operation "getSequence" + quid "4354FB2702D3" + result "Sequence" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getSequence(this);") + opExportControl "Public" + uid 0) + (object Operation "getInstanceProperties" + quid "4354FB9F00CC" + result "EJavaList" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getInstanceProperties(this);") + opExportControl "Public" + uid 0) + (object Operation "getProperty" + quid "4354FBB20369" + parameters (list Parameters + (object Parameter "propertyName" + type "String")) + result "Property" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getProperty(this, propertyName);") + opExportControl "Public" + uid 0) + (object Operation "getRootObject" + quid "4354FBDD01B2" + result "DataObject" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getRootObject(this);") + opExportControl "Public" + uid 0) + (object Operation "getChangeSummary" + quid "4354FC0400F0" + result "ChangeSummary" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "return <%org.apache.sdo.util.SDOUtil%>.getChangeSummary(this);") + opExportControl "Public" + uid 0) + (object Operation "detach" + quid "4354FC150068" + concurrency "Sequential" + semantics (object Semantic_Info + PDL "<%org.apache.sdo.util.SDOUtil%>.detach(this);") + opExportControl "Public" + uid 0)) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.DataObject" + quid "3FAB6F8B0284" + stereotype "javaclass" + exportControl "Public")) + abstract TRUE) + (object Class "Property" + quid "3FAB7CA1031A" + stereotype "Interface" + operations (list Operations + (object Operation "getName" + quid "4357B5A1009C" + result "String" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getType" + quid "4358FF1A0291" + result "Type" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isMany" + quid "4357B64B019A" + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isContainment" + quid "4357B76501FA" + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isReadOnly" + quid "4358FF3501DC" + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getContainingType" + quid "4358FF3C03D1" + result "Type" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getAliasNames" + quid "4358FF4D02EF" + result "EJavaList" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getOpposite" + quid "4358FF59013D" + result "Property" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getDefault" + quid "4358FF66029B" + result "EJavaObject" + concurrency "Sequential" + opExportControl "Public" + uid 0)) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.Property" + quid "3FAB7CAB00E4" + stereotype "javaclass" + exportControl "Public"))) + (object Class "Sequence" + quid "3FAB7CC302B5" + stereotype "Interface" + operations (list Operations + (object Operation "size" + quid "3FD1F958017D" + result "int" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getProperty" + quid "3FAC32F4028D" + parameters (list Parameters + (object Parameter "index" + type "int")) + result "Property" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getValue" + quid "3FAC3318010E" + parameters (list Parameters + (object Parameter "index" + type "int")) + result "EJavaObject" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "setValue" + quid "3FAC33270259" + parameters (list Parameters + (object Parameter "index" + type "int") + (object Parameter "value" + type "EJavaObject")) + result "EJavaObject" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "add" + quid "3FAC333D017C" + parameters (list Parameters + (object Parameter "propertyName" + type "String") + (object Parameter "value" + type "EJavaObject")) + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "add" + quid "3FAC3371009F" + parameters (list Parameters + (object Parameter "propertIndex" + type "int") + (object Parameter "value" + type "EJavaObject")) + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "add" + quid "3FAC338C00CE" + parameters (list Parameters + (object Parameter "property" + type "Property") + (object Parameter "value" + type "EJavaObject")) + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "add" + quid "3FAC33AD02C6" + parameters (list Parameters + (object Parameter "index" + type "int") + (object Parameter "propertyName" + type "String") + (object Parameter "value" + type "EJavaObject")) + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "add" + quid "3FAC33C40263" + parameters (list Parameters + (object Parameter "index" + type "int") + (object Parameter "propertyIndex" + type "int") + (object Parameter "value" + type "EJavaObject")) + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "add" + quid "3FAC33C70375" + parameters (list Parameters + (object Parameter "index" + type "int") + (object Parameter "property" + type "Property") + (object Parameter "value" + type "EJavaObject")) + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "add" + quid "43550F7D01DE" + parameters (list Parameters + (object Parameter "text" + type "String")) + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "add" + quid "43550F930352" + parameters (list Parameters + (object Parameter "index" + type "int") + (object Parameter "text" + type "String")) + concurrency "Sequential" + opExportControl "Public" + uid 0)) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.Sequence" + quid "3FAB7CEB00D2" + stereotype "javaclass" + exportControl "Public"))) + (object Class "Type" + quid "3FAB7C7C0349" + stereotype "Interface" + operations (list Operations + (object Operation "getName" + quid "4357B56E012E" + result "String" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getURI" + quid "4358FE18013C" + result "String" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getInstanceClass" + quid "4357B6380265" + result "EJavaClass" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isInstance" + quid "3FAB82AD0027" + parameters (list Parameters + (object Parameter "object" + type "EJavaObject")) + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isDataType" + quid "4358FE26031D" + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isSequenced" + quid "4358FE33020D" + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isOpen" + quid "4358FE4000F3" + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "isAbstract" + quid "4357B7440365" + result "boolean" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getBaseTypes" + quid "4358FE4B0316" + result "EJavaList" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getAliasNames" + quid "4358FE740351" + result "EJavaList" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getProperties" + quid "4358FE8D0248" + result "EJavaList" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getDeclaredProperties" + quid "4358FE9C02A4" + result "EJavaList" + concurrency "Sequential" + opExportControl "Public" + uid 0) + (object Operation "getProperty" + quid "3FAB831701D8" + parameters (list Parameters + (object Parameter "propertyName" + type "String")) + result "Property" + concurrency "Sequential" + opExportControl "Public" + uid 0)) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.Type" + quid "3FAB7C8B0015" + stereotype "javaclass" + exportControl "Public"))) + (object Class "EJavaList" + quid "3FAB8A010237" + stereotype "datatype" + class_attributes (list class_attribute_list + (object ClassAttribute "java.util.List" + quid "3FAB8A0F01F1" + stereotype "javaclass" + exportControl "Public")) + abstract TRUE) + (object Class "EObjectStreamException" + quid "3FC352DE038F" + stereotype "datatype" + class_attributes (list class_attribute_list + (object ClassAttribute "java.io.ObjectStreamException" + quid "3FC352F90171" + stereotype "javaclass" + exportControl "Public")) + abstract TRUE) + (object Class "AnyTypeDataObject" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "xmlContentKind" + value ("ContentKind" 3))) + quid "4069645E0146" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "406964870375" + supplier "Logical View::type::AnyType" + quidu "40695FE40332") + (object Inheritance_Relationship + quid "436141F003E7" + stereotype "extend" + supplier "Logical View::sdo::DataObject" + quidu "3FAB6F7501C4"))) + (object Class "SimpleAnyTypeDataObject" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "xmlContentKind" + value ("ContentKind" 2))) + quid "406964710189" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "4069648302E3" + stereotype "extend" + supplier "Logical View::sdo::AnyTypeDataObject" + quidu "4069645E0146") + (object Inheritance_Relationship + quid "4069648D02E8" + supplier "Logical View::type::SimpleAnyType" + quidu "406961210099"))) + (object Class "Class" + quid "43559BB702E7" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "43559D3A01A3" + supplier "Logical View::ecore::EClass" + quidu "3903D5BF000A") + (object Inheritance_Relationship + quid "435901C600DC" + supplier "Logical View::sdo::Type" + quidu "3FAB7C7C0349")) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.Type" + quid "435900CF00F5" + stereotype "javaclass" + exportControl "Public"))) + (object Class "DataType" + quid "43559BE502F7" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "43590C6F016D" + supplier "Logical View::sdo::Type" + quidu "3FAB7C7C0349") + (object Inheritance_Relationship + quid "43590C73038F" + supplier "Logical View::ecore::EDataType" + quidu "3903D525033E")) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.Type" + quid "4358FFE30331" + stereotype "javaclass" + exportControl "Public"))) + (object Class "Attribute" + quid "43559E690004" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "43559ED801E4" + supplier "Logical View::ecore::EAttribute" + quidu "39238472039D") + (object Inheritance_Relationship + quid "43567DFD03B6" + supplier "Logical View::sdo::Property" + quidu "3FAB7CA1031A")) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.Property" + quid "4359014A0246" + stereotype "javaclass" + exportControl "Public"))) + (object Class "Reference" + quid "43559E86025E" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "43559EE0011D" + supplier "Logical View::ecore::EReference" + quidu "39238479039D") + (object Inheritance_Relationship + quid "43567DF9022A" + supplier "Logical View::sdo::Property" + quidu "3FAB7CA1031A")) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.Property" + quid "4359018E0226" + stereotype "javaclass" + exportControl "Public"))) + (object Class "Enum" + quid "4357B1010017" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "4357B1410218" + supplier "Logical View::sdo::Type" + quidu "3FAB7C7C0349") + (object Inheritance_Relationship + quid "4357B14701DA" + supplier "Logical View::ecore::EEnum" + quidu "39A473E901D4")) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.Type" + quid "4359006102CE" + stereotype "javaclass" + exportControl "Public"))) + (object Class "DynamicDataObject" + quid "435E94210124" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "435E9435008D" + supplier "Logical View::sdo::DataObject" + quidu "3FAB6F7501C4")) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.DataObject" + quid "435E9459021F" + stereotype "javaclass" + exportControl "Public"))) + (object Class "StoreDataObject" + quid "43621EBA03B4" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "43621F0B03A6" + supplier "Logical View::sdo::DataObject" + quidu "3FAB6F7501C4")) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.DataObject" + quid "43621EDF015E" + stereotype "javaclass" + exportControl "Public"))) + (object Class "DynamicStoreDataObject" + quid "43621F4203CD" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "43621F920242" + supplier "Logical View::sdo::StoreDataObject" + quidu "43621EBA03B4")) + class_attributes (list class_attribute_list + (object ClassAttribute "commonj.sdo.DataObject" + quid "43621F5701ED" + stereotype "javaclass" + exportControl "Public"))) + (object Association "$UNNAMED$0" + quid "3FAD10CA01D5" + roles (list role_list + (object Role "eDataGraph" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isResolveProxies" + value FALSE) + (object Attribute + tool "Ecore" + name "isTransient" + value TRUE)) + quid "3FAD10CC001F" + label "eDataGraph" + supplier "Logical View::sdo::DataGraph" + quidu "3FAB7BFE03C0" + client_cardinality (value cardinality "1") + is_navigable TRUE) + (object Role "eChangeSummary" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isResolveProxies" + value FALSE)) + quid "3FAD10CC0020" + label "eChangeSummary" + supplier "Logical View::sdo::ChangeSummary" + quidu "3FAB7C360208" + client_cardinality (value cardinality "1") + Containment "By Value" + is_navigable TRUE))) + (object Association "$UNNAMED$1" + quid "3FAD26E802F5" + roles (list role_list + (object Role "$UNNAMED$2" + quid "3FAD26ED00E9" + supplier "Logical View::sdo::DataGraph" + quidu "3FAB7BFE03C0") + (object Role "eRootObject" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isResolveProxies" + value FALSE)) + quid "3FAD26ED00F3" + label "eRootObject" + supplier "Logical View::ecore::EObject" + quidu "3C4F1C860123" + client_cardinality (value cardinality "1") + is_navigable TRUE))) + (object Association "$UNNAMED$3" + quid "406962A200CF" + roles (list role_list + (object Role "$UNNAMED$4" + quid "406962A30076" + supplier "Logical View::type::SimpleAnyType" + quidu "406961210099") + (object Role "instanceType" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isResolveProxies" + value FALSE)) + quid "406962A30077" + label "instanceType" + supplier "Logical View::ecore::EDataType" + quidu "3903D525033E" + client_cardinality (value cardinality "1") + is_navigable TRUE)))) + logical_presentations (list unit_reference_list + (object ClassDiagram "SDO Interfaces" + quid "3FAB8BAA0329" + title "SDO Interfaces" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 764 + origin_y 0 + items (list diagram_item_list + (object ClassView "Class" "Logical View::sdo::Sequence" @1 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (2560, 2032) + label (object ItemLabel + Parent_View @1 + location (1999, 1673) + fill_color 13434879 + nlines 1 + max_width 1122 + justify 0 + label "Sequence") + stereotype (object ItemLabel + Parent_View @1 + location (1999, 1623) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 1122 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7CC302B5" + compartment (object Compartment + Parent_View @1 + location (1999, 1733) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 14 + max_width 1128) + width 1140 + height 842 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::DataGraph" @2 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (768, 304) + label (object ItemLabel + Parent_View @2 + location (65, 48) + fill_color 13434879 + nlines 1 + max_width 1406 + justify 0 + label "DataGraph") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7BFE03C0" + compartment (object Compartment + Parent_View @2 + location (65, 108) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 9 + max_width 1412) + width 1424 + height 536 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::DataObject" @3 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + ShowOperationSignature TRUE + location (976, 1280) + font (object Font + italics TRUE) + label (object ItemLabel + Parent_View @3 + location (62, 674) + fill_color 13434879 + nlines 1 + max_width 1828 + justify 0 + label "DataObject") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB6F7501C4" + compartment (object Compartment + Parent_View @3 + location (62, 734) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 23 + max_width 1834 + compartmentItems (list Compartment + "+ get(property : Property) : EJavaObject" + "+ set(property : Property, value : EJavaObject)" + "+ isSet(property : Property) : boolean" + "+ unset(property : Property)" + "+ getContainer() : DataObject" + "+ getContainmentProperty() : Property" + "+ getDataGraph() : DataGraph" + "+ getType() : Type" + "+ createDataObject(propertyName : String) : DataObject" + "+ createDataObject(propertyIndex : int) : DataObject" + "+ createDataObject(property : Property) : DataObject" + "+ createDataObject(propertyName : String, namespaceURI : String, typeName : String) : DataObject" + "+ createDataObject(propertyIndex : int, namespaceURI : String, typeName : String) : DataObject" + "+ createDataObject(property : Property, type : Type) : DataObject" + "+ delete()" + "+ getSequence() : Sequence" + "+ getInstanceProperties() : EJavaList" + "+ getProperty(propertyName : String) : Property" + "+ getRootObject() : DataObject" + "+ getChangeSummary() : ChangeSummary" + "+ detach()")) + width 1846 + height 1236 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::ChangeSummary" @4 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (2768, 528) + label (object ItemLabel + Parent_View @4 + location (1979, 72) + fill_color 13434879 + nlines 1 + max_width 1578 + justify 0 + label "ChangeSummary") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7C360208" + compartment (object Compartment + Parent_View @4 + location (1979, 132) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 17 + max_width 1575) + width 1596 + height 936 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::Type" @5 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (512, 2448) + label (object ItemLabel + Parent_View @5 + location (75, 2064) + fill_color 13434879 + nlines 1 + max_width 874 + justify 0 + label "Type") + stereotype (object ItemLabel + Parent_View @5 + location (75, 2014) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 874 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7C7C0349" + compartment (object Compartment + Parent_View @5 + location (75, 2124) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 15 + max_width 881) + width 892 + height 892 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::Property" @6 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (1424, 2352) + label (object ItemLabel + Parent_View @6 + location (1054, 2068) + fill_color 13434879 + nlines 1 + max_width 740 + justify 0 + label "Property") + stereotype (object ItemLabel + Parent_View @6 + location (1054, 2018) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 740 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7CA1031A" + compartment (object Compartment + Parent_View @6 + location (1054, 2128) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 11 + max_width 746) + width 758 + height 692 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::ChangeSummarySetting" @7 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (2528, 1328) + label (object ItemLabel + Parent_View @7 + location (2003, 1144) + fill_color 13434879 + nlines 1 + max_width 1050 + justify 0 + label "ChangeSummarySetting") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB8BF8005A" + compartment (object Compartment + Parent_View @7 + location (2003, 1204) + icon_style "Icon" + fill_color 16777215 + anchor 2 + nlines 5 + max_width 1056) + width 1068 + height 392 + annotation 8 + autoResize TRUE))) + (object ClassDiagram "SDO DataObject Access" + quid "3FAC2D8D008D" + title "SDO DataObject Access" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list + (object ClassView "Class" "Logical View::sdo::DataObject" @8 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + ShowOperationSignature TRUE + location (528, 1360) + font (object Font + italics TRUE) + label (object ItemLabel + Parent_View @8 + location (53, 79) + fill_color 13434879 + nlines 1 + max_width 950 + justify 0 + label "DataObject") + icon_style "Icon" + line_color 3342489 + fill_color 16316638 + quidu "3FAB6F7501C4" + compartment (object Compartment + Parent_View @8 + location (53, 139) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 50 + max_width 0 + compartmentItems (list Compartment + "+ getBigDecimal(path : String) : EBigDecimal" + "+ getBigInteger(path : String) : EBigInteger" + "+ getBoolean(path : String) : boolean" + "+ getByte(path : String) : byte" + "+ getBytes(path : String) : EByteArray" + "+ getChar(path : String) : char" + "+ getDataObject(path : String) : DataObject" + "+ getDate(path : String) : EDate" + "+ getDouble(path : String) : double" + "+ getFloat(path : String) : float" + "+ getInt(path : String) : int" + "+ getList(path : String) : EJavaList" + "+ getLong(path : String) : long" + "+ getSequence(path : String) : Sequence" + "+ getShort(path : String) : short" + "+ getString(path : String) : String" + "+ getBigDecimal(propertyIndex : int) : EBigDecimal" + "+ getBigInteger(propertyIndex : int) : EBigInteger" + "+ getBoolean(propertyIndex : int) : boolean" + "+ getByte(propertyIndex : int) : byte" + "+ getBytes(propertyIndex : int) : EByteArray" + "+ getChar(propertyIndex : int) : char" + "+ getDataObject(propertyIndex : int) : DataObject" + "+ getDate(propertyIndex : int) : EDate" + "+ getDouble(propertyIndex : int) : double" + "+ getFloat(propertyIndex : int) : float" + "+ getInt(propertyIndex : int) : int" + "+ getList(propertyIndex : int) : EJavaList" + "+ getLong(propertyIndex : int) : long" + "+ getSequence(propertyIndex : int) : Sequence" + "+ getShort(propertyIndex : int) : short" + "+ getString(propertyIndex : int) : String" + "+ getBigDecimal(property : Property) : EBigDecimal" + "+ getBigInteger(property : Property) : EBigInteger" + "+ getBoolean(property : Property) : boolean" + "+ getByte(property : Property) : byte" + "+ getBytes(property : Property) : EByteArray" + "+ getChar(property : Property) : char" + "+ getDataObject(property : Property) : DataObject" + "+ getDate(property : Property) : EDate" + "+ getDouble(property : Property) : double" + "+ getFloat(property : Property) : float" + "+ getInt(property : Property) : int" + "+ getList(property : Property) : EJavaList" + "+ getLong(property : Property) : long" + "+ getSequence(property : Property) : Sequence" + "+ getShort(property : Property) : short" + "+ getString(property : Property) : String" + "<> + commonj.sdo.DataObject")) + width 968 + height 2586 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::DataObject" @9 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + ShowOperationSignature TRUE + location (1664, 1280) + font (object Font + italics TRUE) + label (object ItemLabel + Parent_View @9 + location (1131, 74) + fill_color 13434879 + nlines 1 + max_width 1066 + justify 0 + label "DataObject") + icon_style "Icon" + line_color 3342489 + fill_color 16316638 + quidu "3FAB6F7501C4" + compartment (object Compartment + Parent_View @9 + location (1131, 134) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 47 + max_width 0 + compartmentItems (list Compartment + "+ setBigDecimal(path : String, value : EBigDecimal)" + "+ setBigInteger(path : String, value : EBigInteger)" + "+ setBoolean(path : String, value : boolean)" + "+ setByte(path : String, value : byte)" + "+ setBytes(path : String, value : EByteArray)" + "+ setChar(path : String, value : char)" + "+ setDataObject(path : String, value : DataObject)" + "+ setDate(path : String, value : EDate)" + "+ setDouble(path : String, value : double)" + "+ setFloat(path : String, value : float)" + "+ setInt(path : String, value : int)" + "+ setList(path : String, value : EJavaList)" + "+ setLong(path : String, value : long)" + "+ setShort(path : String, value : short)" + "+ setString(path : String, value : String)" + "+ setBigDecimal(propertyIndex : int, value : EBigDecimal)" + "+ setBigInteger(propertyIndex : int, value : EBigInteger)" + "+ setBoolean(propertyIndex : int, value : boolean)" + "+ setByte(propertyIndex : int, value : byte)" + "+ setBytes(propertyIndex : int, value : EByteArray)" + "+ setChar(propertyIndex : int, value : char)" + "+ setDataObject(propertyIndex : int, value : DataObject)" + "+ setDate(propertyIndex : int, value : EDate)" + "+ setDouble(propertyIndex : int, value : double)" + "+ setFloat(propertyIndex : int, value : float)" + "+ setInt(propertyIndex : int, value : int)" + "+ setList(propertyIndex : int, value : EJavaList)" + "+ setLong(propertyIndex : int, value : long)" + "+ setShort(propertyIndex : int, value : short)" + "+ setString(propertyIndex : int, value : String)" + "+ setBigDecimal(property : Property, value : EBigDecimal)" + "+ setBigInteger(property : Property, value : EBigInteger)" + "+ setBoolean(property : Property, value : boolean)" + "+ setByte(property : Property, value : byte)" + "+ setBytes(property : Property, value : EByteArray)" + "+ setChar(property : Property, value : char)" + "+ setDataObject(property : Property, value : DataObject)" + "+ setDate(property : Property, value : EDate)" + "+ setDouble(property : Property, value : double)" + "+ setFloat(property : Property, value : float)" + "+ setInt(property : Property, value : int)" + "+ setList(property : Property, value : EJavaList)" + "+ setLong(property : Property, value : long)" + "+ setShort(property : Property, value : short)" + "+ setString(property : Property, value : String)" + "<> + commonj.sdo.DataObject")) + width 1084 + height 2436 + annotation 8 + autoResize TRUE))) + (object ClassDiagram "Ecore SDO" + quid "3FAC379A02D5" + title "Ecore SDO" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list + (object ClassView "Class" "Logical View::sdo::DataGraph" @10 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + location (464, 160) + label (object ItemLabel + Parent_View @10 + location (74, 104) + fill_color 13434879 + nlines 1 + max_width 780 + justify 0 + label "DataGraph") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7BFE03C0" + compartment (object Compartment + Parent_View @10 + location (74, 164) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 1 + max_width 0 + compartmentItems (list Compartment + "<> + commonj.sdo.DataGraph")) + width 798 + height 136 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::ChangeSummary" @11 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + location (528, 400) + label (object ItemLabel + Parent_View @11 + location (78, 344) + fill_color 13434879 + nlines 1 + max_width 900 + justify 0 + label "ChangeSummary") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7C360208" + compartment (object Compartment + Parent_View @11 + location (78, 404) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 1 + max_width 0 + compartmentItems (list Compartment + "<> + commonj.sdo.ChangeSummary")) + width 918 + height 136 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::Type" @12 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + location (416, 1088) + label (object ItemLabel + Parent_View @12 + location (79, 1054) + fill_color 13434879 + nlines 1 + max_width 674 + justify 0 + label "Type") + stereotype (object ItemLabel + Parent_View @12 + location (79, 1004) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 674 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7C7C0349" + compartment (object Compartment + Parent_View @12 + location (79, 1114) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 1 + max_width 0 + compartmentItems (list Compartment + "<> + commonj.sdo.Type")) + width 692 + height 192 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::Property" @13 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + location (448, 1648) + label (object ItemLabel + Parent_View @13 + location (78, 1614) + fill_color 13434879 + nlines 1 + max_width 740 + justify 0 + label "Property") + stereotype (object ItemLabel + Parent_View @13 + location (78, 1564) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 740 + justify 0 + label "<>") + icon "Interface" + icon_style "Label" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7CA1031A" + compartment (object Compartment + Parent_View @13 + location (78, 1674) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 1 + max_width 0 + compartmentItems (list Compartment + "<> + commonj.sdo.Property")) + width 758 + height 192 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::ChangeSummarySetting" @14 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeOperation TRUE + location (608, 640) + label (object ItemLabel + Parent_View @14 + location (83, 584) + fill_color 13434879 + nlines 1 + max_width 1050 + justify 0 + label "ChangeSummarySetting") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB8BF8005A" + compartment (object Compartment + Parent_View @14 + location (83, 644) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 1 + max_width 0 + compartmentItems (list Compartment + "<> + commonj.sdo.ChangeSummary$Setting")) + width 1068 + height 136 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::change::ChangeDescription" @15 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2496, 400) + label (object ItemLabel + Parent_View @15 + location (2311, 350) + fill_color 13434879 + nlines 1 + max_width 370 + justify 0 + label "ChangeDescription") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "4FAB6F110198" + width 388 + height 124 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::ecore::EObject" @16 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + location (2592, 160) + label (object ItemLabel + Parent_View @16 + location (2503, 110) + fill_color 13434879 + nlines 1 + max_width 178 + justify 0 + label "EObject") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C4F1C860123" + width 196 + height 124 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::change::FeatureChange" @17 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2528, 640) + label (object ItemLabel + Parent_View @17 + location (2374, 590) + fill_color 13434879 + nlines 1 + max_width 308 + justify 0 + label "FeatureChange") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "4FC39D6D0177" + width 326 + height 124 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::Class" @18 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1648, 1296) + label (object ItemLabel + Parent_View @18 + location (1311, 1241) + fill_color 13434879 + nlines 1 + max_width 674 + justify 0 + label "Class") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "43559BB702E7" + width 692 + height 134 + annotation 8) + (object ClassView "Class" "Logical View::sdo::DataType" @19 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1648, 880) + label (object ItemLabel + Parent_View @19 + location (1311, 825) + fill_color 13434879 + nlines 1 + max_width 674 + justify 0 + label "DataType") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "43559BE502F7" + width 692 + height 134 + annotation 8) + (object ClassView "Class" "Logical View::ecore::EClass" @20 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2592, 1296) + label (object ItemLabel + Parent_View @20 + location (2502, 1246) + fill_color 13434879 + nlines 1 + max_width 181 + justify 0 + label "EClass") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3903D5BF000A" + width 199 + height 124 + annotation 8) + (object ClassView "Class" "Logical View::ecore::EDataType" @21 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2560, 880) + label (object ItemLabel + Parent_View @21 + location (2444, 830) + fill_color 13434879 + nlines 1 + max_width 232 + justify 0 + label "EDataType") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3903D525033E" + width 250 + height 124 + annotation 8) + (object ClassView "Class" "Logical View::sdo::Attribute" @22 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1664, 1536) + label (object ItemLabel + Parent_View @22 + location (1294, 1481) + fill_color 13434879 + nlines 1 + max_width 740 + justify 0 + label "Attribute") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "43559E690004" + width 758 + height 134 + annotation 8) + (object ClassView "Class" "Logical View::sdo::Reference" @23 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1664, 1760) + label (object ItemLabel + Parent_View @23 + location (1294, 1705) + fill_color 13434879 + nlines 1 + max_width 740 + justify 0 + label "Reference") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "43559E86025E" + width 758 + height 134 + annotation 8) + (object ClassView "Class" "Logical View::ecore::EAttribute" @24 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2576, 1536) + label (object ItemLabel + Parent_View @24 + location (2470, 1486) + fill_color 13434879 + nlines 1 + max_width 212 + justify 0 + label "EAttribute") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "39238472039D" + width 230 + height 124 + annotation 8) + (object ClassView "Class" "Logical View::ecore::EReference" @25 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2576, 1760) + label (object ItemLabel + Parent_View @25 + location (2458, 1710) + fill_color 13434879 + nlines 1 + max_width 236 + justify 0 + label "EReference") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "39238479039D" + width 254 + height 124 + annotation 8) + (object InheritView "" @26 + stereotype TRUE + line_color 3342489 + quidu "43559ED801E4" + client @22 + supplier @24 + line_style 0) + (object InheritView "" @27 + stereotype TRUE + line_color 3342489 + quidu "43559EE0011D" + client @23 + supplier @25 + line_style 0) + (object InheritView "" @28 + stereotype TRUE + line_color 3342489 + quidu "43567DF9022A" + client @23 + supplier @13 + line_style 0) + (object InheritView "" @29 + stereotype TRUE + line_color 3342489 + quidu "43567DFD03B6" + client @22 + supplier @13 + line_style 0) + (object ClassView "Class" "Logical View::sdo::Enum" @30 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1648, 1088) + label (object ItemLabel + Parent_View @30 + location (1311, 1033) + fill_color 13434879 + nlines 1 + max_width 674 + justify 0 + label "Enum") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "4357B1010017" + width 692 + height 134 + annotation 8) + (object ClassView "Class" "Logical View::ecore::EEnum" @31 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (2592, 1088) + label (object ItemLabel + Parent_View @31 + location (2502, 1038) + fill_color 13434879 + nlines 1 + max_width 181 + justify 0 + label "EEnum") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "39A473E901D4" + width 199 + height 124 + annotation 8) + (object InheritView "" @32 + stereotype TRUE + line_color 3342489 + quidu "4357B1410218" + client @30 + supplier @12 + line_style 0) + (object InheritView "" @33 + stereotype TRUE + line_color 3342489 + quidu "4357B14701DA" + client @30 + supplier @31 + line_style 0) + (object InheritView "" @34 + stereotype TRUE + line_color 3342489 + quidu "43559D3A01A3" + client @18 + supplier @20 + line_style 0) + (object InheritView "" @35 + stereotype TRUE + line_color 3342489 + quidu "435901C600DC" + client @18 + supplier @12 + line_style 0) + (object InheritView "" @36 + stereotype TRUE + line_color 3342489 + quidu "43590C6F016D" + client @19 + supplier @12 + line_style 0) + (object InheritView "" @37 + stereotype TRUE + line_color 3342489 + quidu "43590C73038F" + client @19 + supplier @21 + line_style 0) + (object InheritView "" @38 + stereotype TRUE + line_color 3342489 + quidu "43612C7B0243" + client @10 + supplier @16 + line_style 0) + (object InheritView "" @39 + stereotype TRUE + line_color 3342489 + quidu "436134F001A6" + client @14 + supplier @17 + line_style 0) + (object InheritView "" @40 + stereotype TRUE + line_color 3342489 + quidu "4361480602D8" + client @11 + supplier @15 + line_style 0))) + (object ClassDiagram "Ecore Data Graph" + quid "3FAD029E0142" + title "Ecore Data Graph" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list + (object ClassView "Class" "Logical View::ecore::EObject" @41 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (464, 832) + label (object ItemLabel + Parent_View @41 + location (375, 782) + fill_color 13434879 + nlines 1 + max_width 178 + justify 0 + label "EObject") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3C4F1C860123" + width 196 + height 124 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::DataGraph" @42 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (768, 256) + label (object ItemLabel + Parent_View @42 + location (378, 150) + fill_color 13434879 + nlines 1 + max_width 780 + justify 0 + label "DataGraph") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7BFE03C0" + width 798 + height 236 + annotation 8) + (object AssociationViewNew "$UNNAMED$1" @43 + location (469, 572) + stereotype TRUE + quidu "3FAD26E802F5" + roleview_list (list RoleViews + (object RoleView "$UNNAMED$2" @44 + Parent_View @43 + location (-1067, -932) + stereotype TRUE + line_color 3342489 + quidu "3FAD26ED00E9" + client @43 + supplier @42 + line_style 3 + origin_attachment (469, 572) + terminal_attachment (469, 374)) + (object RoleView "eRootObject" @45 + Parent_View @43 + location (-1067, -932) + label (object SegLabel @46 + Parent_View @45 + location (324, 683) + anchor 1 + anchor_loc 1 + nlines 1 + max_width 252 + justify 0 + label "+eRootObject" + pctDist 0.567708 + height 146 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3FAD26ED00F3" + client @43 + supplier @41 + line_style 3 + origin_attachment (469, 572) + terminal_attachment (469, 770) + label (object SegLabel @47 + Parent_View @45 + location (512, 690) + anchor 2 + anchor_loc 1 + nlines 1 + max_width 15 + justify 0 + label "1" + pctDist 0.598958 + height 43 + orientation 0)))) + (object ClassView "Class" "Logical View::sdo::ChangeSummary" @48 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1072, 832) + label (object ItemLabel + Parent_View @48 + location (881, 782) + fill_color 13434879 + nlines 1 + max_width 382 + justify 0 + label "ChangeSummary") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB7C360208" + width 400 + height 125 + annotation 8) + (object AssociationViewNew "$UNNAMED$0" @49 + location (1078, 572) + stereotype TRUE + quidu "3FAD10CA01D5" + roleview_list (list RoleViews + (object RoleView "eDataGraph" @50 + Parent_View @49 + location (662, -692) + label (object SegLabel @51 + Parent_View @50 + location (929, 437) + anchor 1 + anchor_loc 1 + nlines 1 + max_width 240 + justify 0 + label "+eDataGraph" + pctDist 0.686170 + height 150 + orientation 0) + stereotype TRUE + line_color 3342489 + quidu "3FAD10CC001F" + client @49 + supplier @42 + line_style 3 + origin_attachment (1078, 572) + terminal_attachment (1078, 374) + label (object SegLabel @52 + Parent_View @50 + location (1115, 437) + anchor 2 + anchor_loc 1 + nlines 1 + max_width 15 + justify 0 + label "1" + pctDist 0.686170 + height 37 + orientation 1)) + (object RoleView "eChangeSummary" @53 + Parent_View @49 + location (662, -692) + label (object SegLabel @54 + Parent_View @53 + location (876, 692) + anchor 1 + anchor_loc 1 + nlines 1 + max_width 360 + justify 0 + label "+eChangeSummary" + pctDist 0.611702 + height 203 + orientation 1) + stereotype TRUE + line_color 3342489 + quidu "3FAD10CC0020" + client @49 + supplier @48 + line_style 3 + origin_attachment (1078, 572) + terminal_attachment (1078, 770) + label (object SegLabel @55 + Parent_View @53 + location (1114, 692) + anchor 2 + anchor_loc 1 + nlines 1 + max_width 15 + justify 0 + label "1" + pctDist 0.611702 + height 36 + orientation 0)))))) + (object ClassDiagram "External Types" + quid "3FAB907F00F7" + title "External Types" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list + (object ClassView "Class" "Logical View::sdo::EObjectStreamException" @56 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (1184, 176) + font (object Font + italics TRUE) + label (object ItemLabel + Parent_View @56 + location (741, 142) + fill_color 13434879 + nlines 1 + max_width 886 + justify 0 + label "EObjectStreamException") + stereotype (object ItemLabel + Parent_View @56 + location (741, 92) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 886 + justify 0 + label "<>") + icon_style "Icon" + line_color 3342489 + fill_color 12303359 + quidu "3FC352DE038F" + width 904 + height 192 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::EJavaList" @57 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (352, 176) + font (object Font + italics TRUE) + label (object ItemLabel + Parent_View @57 + location (80, 142) + fill_color 13434879 + nlines 1 + max_width 544 + justify 0 + label "EJavaList") + stereotype (object ItemLabel + Parent_View @57 + location (80, 92) + fill_color 13434879 + anchor 10 + nlines 1 + max_width 544 + justify 0 + label "<>") + icon_style "Icon" + line_color 3342489 + fill_color 8963327 + quidu "3FAB8A010237" + width 562 + height 192 + annotation 8))) + (object ClassDiagram "SDO XML Type" + quid "406964270056" + title "SDO XML Type" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list + (object ClassView "Class" "Logical View::type::AnyType" @58 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (1488, 576) + label (object ItemLabel + Parent_View @58 + location (1075, 421) + fill_color 13434879 + nlines 1 + max_width 826 + justify 0 + label "AnyType") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "40695FE40332" + width 844 + height 334 + annotation 8) + (object ClassView "Class" "Logical View::type::SimpleAnyType" @59 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (1488, 1040) + label (object ItemLabel + Parent_View @59 + location (1272, 910) + fill_color 13434879 + nlines 1 + max_width 432 + justify 0 + label "SimpleAnyType") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "406961210099" + width 450 + height 284 + annotation 8) + (object ClassView "Class" "Logical View::sdo::AnyTypeDataObject" @60 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (448, 560) + label (object ItemLabel + Parent_View @60 + location (250, 509) + fill_color 13434879 + nlines 1 + max_width 396 + justify 0 + label "AnyTypeDataObject") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "4069645E0146" + width 414 + height 126 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::SimpleAnyTypeDataObject" @61 + ShowCompartmentStereotypes TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + ShowOperationSignature TRUE + location (464, 1024) + label (object ItemLabel + Parent_View @61 + location (201, 973) + fill_color 13434879 + nlines 1 + max_width 526 + justify 0 + label "SimpleAnyTypeDataObject") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "406964710189" + width 544 + height 126 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::DataObject" @62 + ShowCompartmentStereotypes TRUE + SuppressAttribute TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (448, 208) + font (object Font + italics TRUE) + label (object ItemLabel + Parent_View @62 + location (328, 165) + fill_color 13434879 + nlines 1 + max_width 240 + justify 0 + label "DataObject") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB6F7501C4" + width 258 + height 110 + annotation 8) + (object InheritView "" @63 + stereotype (object SegLabel @64 + Parent_View @63 + location (298, 791) + anchor 10 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "<>" + pctDist 0.502959 + height 150 + orientation 0) + line_color 3342489 + quidu "4069648302E3" + client @61 + supplier @60 + line_style 3 + origin_attachment (448, 961) + terminal_attachment (448, 623)) + (object InheritView "" @65 + stereotype TRUE + line_color 3342489 + quidu "4069648D02E8" + client @61 + supplier @59 + line_style 3 + origin_attachment (736, 1002) + terminal_attachment (1263, 1002)) + (object InheritView "" @66 + stereotype TRUE + line_color 3342489 + quidu "40696143020B" + client @59 + supplier @58 + line_style 3 + origin_attachment (1479, 898) + terminal_attachment (1479, 743)) + (object InheritView "" @67 + stereotype TRUE + line_color 3342489 + quidu "406964870375" + client @60 + supplier @58 + line_style 3 + origin_attachment (655, 561) + terminal_attachment (1066, 561)) + (object InheritView "" @68 + stereotype (object SegLabel @69 + Parent_View @68 + location (294, 403) + anchor 10 + anchor_loc 1 + nlines 1 + max_width 450 + justify 0 + label "<>" + pctDist 0.405229 + height 155 + orientation 0) + line_color 3342489 + quidu "436141F003E7" + client @60 + supplier @62 + line_style 0))) + (object ClassDiagram "SDO DataObject Implementations" + quid "43621DF90149" + title "SDO DataObject Implementations" + zoom 100 + max_height 28350 + max_width 21600 + origin_x 0 + origin_y 0 + items (list diagram_item_list + (object ClassView "Class" "Logical View::sdo::DataObject" @70 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + location (1056, 368) + font (object Font + italics TRUE) + label (object ItemLabel + Parent_View @70 + location (661, 312) + fill_color 13434879 + nlines 1 + max_width 790 + justify 0 + label "DataObject") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAB6F7501C4" + compartment (object Compartment + Parent_View @70 + location (661, 372) + icon_style "Icon" + fill_color 13434879 + anchor 2 + nlines 1 + max_width 0 + compartmentItems (list Compartment + "<> + commonj.sdo.DataObject")) + width 808 + height 136 + annotation 8 + autoResize TRUE) + (object ClassView "Class" "Logical View::sdo::DynamicDataObject" @71 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (576, 720) + label (object ItemLabel + Parent_View @71 + location (181, 664) + fill_color 13434879 + nlines 1 + max_width 790 + justify 0 + label "DynamicDataObject") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "435E94210124" + width 808 + height 136 + annotation 8) + (object ClassView "Class" "Logical View::sdo::StoreDataObject" @72 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1680, 720) + label (object ItemLabel + Parent_View @72 + location (1285, 664) + fill_color 13434879 + nlines 1 + max_width 790 + justify 0 + label "StoreDataObject") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "43621EBA03B4" + width 808 + height 136 + annotation 8) + (object InheritTreeView "" @73 + location (1053, 559) + line_color 3342489 + fill_color 13434879 + supplier @70 + vertices (list Points + (1053, 559) + (1053, 436))) + (object InheritView "" @74 + stereotype TRUE + line_color 3342489 + quidu "435E9435008D" + client @71 + supplier @70 + line_style 3 + origin_attachment (562, 652) + terminal_attachment (562, 559) + drawSupplier @73) + (object ClassView "Class" "Logical View::sdo::DynamicStoreDataObject" @75 + ShowCompartmentStereotypes TRUE + SuppressOperation TRUE + IncludeAttribute TRUE + IncludeOperation TRUE + location (1680, 1056) + label (object ItemLabel + Parent_View @75 + location (1285, 1000) + fill_color 13434879 + nlines 1 + max_width 790 + justify 0 + label "DynamicStoreDataObject") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "43621F4203CD" + width 808 + height 136 + annotation 8) + (object InheritView "" @76 + stereotype TRUE + line_color 3342489 + quidu "43621F920242" + client @75 + supplier @72 + line_style 0) + (object InheritView "" @77 + stereotype TRUE + line_color 3342489 + quidu "43621F0B03A6" + client @72 + supplier @70 + line_style 3 + origin_attachment (1681, 652) + terminal_attachment (1681, 559) + drawSupplier @73))))) + (object Class_Category "ecore" + is_unit TRUE + is_loaded FALSE + file_name "$VABASE_PLUGINS_PATH\\org.eclipse.emf.ecore\\model\\org.eclipse.emf.Ecore.cat" + quid "39A5ED04004E") + (object Class_Category "change" + is_unit TRUE + is_loaded FALSE + file_name "$VABASE_PLUGINS_PATH\\org.eclipse.emf.ecore.change\\model\\org.eclipse.emf.ecore.Change.cat" + quid "4FAA8E8B0306") + (object Class_Category "type" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "packageName" + value "type") + (object Attribute + tool "Ecore" + name "nsPrefix" + value "xml.type") + (object Attribute + tool "Ecore" + name "nsURI" + value "http://www.eclipse.org/emf/2003/XMLType") + (object Attribute + tool "Ecore" + name "basePackage" + value "org.eclipse.emf.ecore.xml") + (object Attribute + tool "Ecore" + name "prefix" + value "XMLType")) + quid "40696924000C" + exportControl "Public" + logical_models (list unit_reference_list + (object Class "AnyType" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "xmlContentKind" + value ("ContentKind" 3))) + quid "40695FE40332" + class_attributes (list class_attribute_list + (object ClassAttribute "mixed" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isUnique" + value FALSE)) + quid "40696039001D" + stereotype "0..*" + type "EFeatureMapEntry" + exportControl "Public") + (object ClassAttribute "any" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isTransient" + value TRUE) + (object Attribute + tool "Ecore" + name "isVolatile" + value TRUE) + (object Attribute + tool "Ecore" + name "isUnique" + value FALSE)) + quid "40696084002F" + stereotype "0..*" + type "EFeatureMapEntry" + exportControl "Public" + derived TRUE) + (object ClassAttribute "anyAttribute" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isUnique" + value FALSE)) + quid "4069609A0153" + stereotype "0..*" + type "EFeatureMapEntry" + exportControl "Public"))) + (object Class "SimpleAnyType" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "xmlContentKind" + value ("ContentKind" 2))) + quid "406961210099" + superclasses (list inheritance_relationship_list + (object Inheritance_Relationship + quid "40696143020B" + supplier "Logical View::type::AnyType" + quidu "40695FE40332")) + class_attributes (list class_attribute_list + (object ClassAttribute "rawValue" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isTransient" + value TRUE) + (object Attribute + tool "Ecore" + name "isVolatile" + value TRUE) + (object Attribute + tool "Ecore" + name "isUnique" + value FALSE)) + quid "4069612E0391" + type "String" + exportControl "Public" + derived TRUE) + (object ClassAttribute "value" + attributes (list Attribute_Set + (object Attribute + tool "Ecore" + name "isTransient" + value TRUE) + (object Attribute + tool "Ecore" + name "isVolatile" + value TRUE) + (object Attribute + tool "Ecore" + name "isUnique" + value FALSE)) + quid "406961A40106" + type "EJavaObject" + exportControl "Public" + derived TRUE)))) + logical_presentations (list unit_reference_list))) + logical_presentations (list unit_reference_list + (object ClassDiagram "Main" + quid "3FAA8E8700D0" + 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::ecore" @78 + location (912, 272) + label (object ItemLabel + Parent_View @78 + location (768, 188) + fill_color 13434879 + nlines 2 + max_width 288 + justify 0 + label "ecore") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "39A5ED04004E" + width 300 + height 180) + (object CategoryView "Logical View::sdo" @79 + location (368, 272) + label (object ItemLabel + Parent_View @79 + location (224, 188) + fill_color 13434879 + nlines 2 + max_width 288 + justify 0 + label "sdo") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "3FAA8E8B0306" + width 300 + height 180) + (object CategoryView "Logical View::change" @80 + location (1440, 272) + label (object ItemLabel + Parent_View @80 + location (1296, 188) + fill_color 13434879 + nlines 2 + max_width 288 + justify 0 + label "change") + icon_style "Icon" + line_color 3342489 + fill_color 13434879 + quidu "4FAA8E8B0306" + width 300 + height 180))))) + root_subsystem (object SubSystem "Component View" + quid "3FAA8E8700BF" + physical_models (list unit_reference_list) + physical_presentations (list unit_reference_list + (object Module_Diagram "Main" + quid "3FAA8E8700EE" + 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 "3FAA8E8700C0" + ProcsNDevs (list + (object Process_Diagram "Deployment View" + quid "3FAA8E8700C2" + 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 "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 "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% @(#) plugins/org.eclipse.emf.ecore.sdo/model/SDO.mdl, emf.ecore.sdo, org.eclipse.dev")) + (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% @(#) plugins/org.eclipse.emf.ecore.sdo/model/SDO.mdl, emf.ecore.sdo, org.eclipse.dev")) + (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 "SCC" + name "HiddenTool" + value FALSE) + (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 "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 "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 "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 "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 "framework" + 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 "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 "3FAA8E8700C1")) diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/pom.xml new file mode 100644 index 0000000000..7e64ed96a6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/pom.xml @@ -0,0 +1,114 @@ + + + + + org.apache.tuscany + tuscany-sdo + incubating-M1 + + 4.0.0 + tuscany-sdo-impl + Tuscany SDO Implementation + Tuscany implementation of SDO API. + incubating-M1 + + + + eclipse.emf + http://download.eclipse.org/tools/emf/maven2 + + true + + + + + + + commonj + sdo-api + incubating-M1 + compile + + + + stax + stax-api + 1.0 + + provided + + + + asm + asm + 2.2 + compile + + + + org.eclipse.emf + common + 2.2.0-RC4 + compile + + + org.eclipse.emf + ecore + 2.2.0-RC4 + compile + + + org.eclipse.emf + ecore-change + 2.2.0-RC4 + compile + + + org.eclipse.emf + ecore-xmi + 2.2.0-RC4 + compile + + + org.eclipse.xsd + xsd + 2.2.0-RC4 + compile + + + + junit + junit + 3.8.1 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + src/main/resources/META-INF/MANIFEST.MF + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/AnyTypeDataObject.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/AnyTypeDataObject.java new file mode 100644 index 0000000000..5eea403613 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/AnyTypeDataObject.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo; + +import commonj.sdo.DataObject; + +import org.eclipse.emf.ecore.xml.type.AnyType; + +/** + * + * A representation of the model object 'Any Type Data Object'. + * + * + * + * @see org.apache.tuscany.sdo.SDOPackage#getAnyTypeDataObject() + * @model extendedMetaData="kind='mixed'" + * @generated + */ +public interface AnyTypeDataObject extends DataObject, AnyType { +} // AnyTypeDataObject diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOExtendedMetaData.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOExtendedMetaData.java new file mode 100644 index 0000000000..7bc75d8faa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOExtendedMetaData.java @@ -0,0 +1,35 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo; + +import java.util.List; + +import org.apache.tuscany.sdo.helper.SDOExtendedMetaDataImpl; +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +public interface SDOExtendedMetaData extends ExtendedMetaData { + + SDOExtendedMetaData INSTANCE = new SDOExtendedMetaDataImpl(); + + List getAliasNames(EModelElement eModelElement); + + void setAliasNames(EModelElement eModelElement, List aliasNames); + + void setAliasNames(EModelElement eModelElement, String aliasNames); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOFactory.java new file mode 100644 index 0000000000..5b066bb6e3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOFactory.java @@ -0,0 +1,173 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EStructuralFeature; + +import commonj.sdo.Property; +import commonj.sdo.Type; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.apache.tuscany.sdo.SDOPackage + * @generated + */ +public interface SDOFactory extends EFactory{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + SDOFactory eINSTANCE = org.apache.tuscany.sdo.impl.SDOFactoryImpl.init(); + + /** + * Returns a new object of class 'Change Summary'. + * + * + * @return a new object of class 'Change Summary'. + * @generated + */ + ChangeSummary createChangeSummary(); + + /** + * Returns a new object of class 'Change Summary Setting'. + * + * + * @return a new object of class 'Change Summary Setting'. + * @generated + */ + ChangeSummary.Setting createChangeSummarySetting(); + + /** + * Returns a new object of class 'Data Graph'. + * + * + * @return a new object of class 'Data Graph'. + * @generated + */ + DataGraph createDataGraph(); + + /** + * Returns a new object of class 'Any Type Data Object'. + * + * + * @return a new object of class 'Any Type Data Object'. + * @generated + */ + AnyTypeDataObject createAnyTypeDataObject(); + + /** + * Returns a new object of class 'Simple Any Type Data Object'. + * + * + * @return a new object of class 'Simple Any Type Data Object'. + * @generated + */ + SimpleAnyTypeDataObject createSimpleAnyTypeDataObject(); + + /** + * Returns a new object of class 'Class'. + * + * + * @return a new object of class 'Class'. + * @generated + */ + Type createClass(); + + /** + * Returns a new object of class 'Data Type'. + * + * + * @return a new object of class 'Data Type'. + * @generated + */ + Type createDataType(); + + /** + * Returns a new object of class 'Attribute'. + * + * + * @return a new object of class 'Attribute'. + * @generated + */ + Property createAttribute(); + + /** + * Returns a new object of class 'Reference'. + * + * + * @return a new object of class 'Reference'. + * @generated + */ + Property createReference(); + + /** + * Returns a new object of class 'Enum'. + * + * + * @return a new object of class 'Enum'. + * @generated + */ + Type createEnum(); + + /** + * Returns a new object of class 'Dynamic Data Object'. + * + * + * @return a new object of class 'Dynamic Data Object'. + * @generated + */ + DataObject createDynamicDataObject(); + + /** + * Returns a new object of class 'Store Data Object'. + * + * + * @return a new object of class 'Store Data Object'. + * @generated + */ + DataObject createStoreDataObject(); + + /** + * Returns a new object of class 'Dynamic Store Data Object'. + * + * + * @return a new object of class 'Dynamic Store Data Object'. + * @generated + */ + DataObject createDynamicStoreDataObject(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + SDOPackage getSDOPackage(); + + ChangeSummary.Setting createChangeSummarySetting(EStructuralFeature eStructuralFeature, Object value, boolean isSet); + +} //SDOFactory diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOPackage.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOPackage.java new file mode 100644 index 0000000000..caa154baf5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOPackage.java @@ -0,0 +1,1599 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.change.ChangePackage; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.apache.tuscany.sdo.SDOFactory + * @model kind="package" + * @generated + */ +public interface SDOPackage extends EPackage{ + /** + * The package name. + * + * + * @generated + */ + String eNAME = "sdo"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://www.apache.org/tuscany/2005/SDO"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "sdo"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + SDOPackage eINSTANCE = org.apache.tuscany.sdo.impl.SDOPackageImpl.init(); + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.DataGraphImpl Data Graph}' class. + * + * + * @see org.apache.tuscany.sdo.impl.DataGraphImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getDataGraph() + * @generated + */ + int DATA_GRAPH = 2; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.ChangeSummaryImpl Change Summary}' class. + * + * + * @see org.apache.tuscany.sdo.impl.ChangeSummaryImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getChangeSummary() + * @generated + */ + int CHANGE_SUMMARY = 0; + + /** + * The feature id for the 'Object Changes' map. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY__OBJECT_CHANGES = ChangePackage.CHANGE_DESCRIPTION__OBJECT_CHANGES; + + /** + * The feature id for the 'Objects To Detach' reference list. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY__OBJECTS_TO_DETACH = ChangePackage.CHANGE_DESCRIPTION__OBJECTS_TO_DETACH; + + /** + * The feature id for the 'Objects To Attach' containment reference list. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY__OBJECTS_TO_ATTACH = ChangePackage.CHANGE_DESCRIPTION__OBJECTS_TO_ATTACH; + + /** + * The feature id for the 'Resource Changes' containment reference list. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY__RESOURCE_CHANGES = ChangePackage.CHANGE_DESCRIPTION__RESOURCE_CHANGES; + + /** + * The feature id for the 'EData Graph' reference. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY__EDATA_GRAPH = ChangePackage.CHANGE_DESCRIPTION_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Change Summary' class. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY_FEATURE_COUNT = ChangePackage.CHANGE_DESCRIPTION_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.ChangeSummarySettingImpl Change Summary Setting}' class. + * + * + * @see org.apache.tuscany.sdo.impl.ChangeSummarySettingImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getChangeSummarySetting() + * @generated + */ + int CHANGE_SUMMARY_SETTING = 1; + + /** + * The feature id for the 'Feature Name' attribute. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY_SETTING__FEATURE_NAME = ChangePackage.FEATURE_CHANGE__FEATURE_NAME; + + /** + * The feature id for the 'Data Value' attribute. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY_SETTING__DATA_VALUE = ChangePackage.FEATURE_CHANGE__DATA_VALUE; + + /** + * The feature id for the 'Set' attribute. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY_SETTING__SET = ChangePackage.FEATURE_CHANGE__SET; + + /** + * The feature id for the 'Value' attribute. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY_SETTING__VALUE = ChangePackage.FEATURE_CHANGE__VALUE; + + /** + * The feature id for the 'Feature' reference. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY_SETTING__FEATURE = ChangePackage.FEATURE_CHANGE__FEATURE; + + /** + * The feature id for the 'Reference Value' reference. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY_SETTING__REFERENCE_VALUE = ChangePackage.FEATURE_CHANGE__REFERENCE_VALUE; + + /** + * The feature id for the 'List Changes' containment reference list. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY_SETTING__LIST_CHANGES = ChangePackage.FEATURE_CHANGE__LIST_CHANGES; + + /** + * The number of structural features of the 'Change Summary Setting' class. + * + * + * @generated + * @ordered + */ + int CHANGE_SUMMARY_SETTING_FEATURE_COUNT = ChangePackage.FEATURE_CHANGE_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Resource Set' attribute. + * + * + * @generated + * @ordered + */ + int DATA_GRAPH__RESOURCE_SET = EcorePackage.EOBJECT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Root Resource' attribute. + * + * + * @generated + * @ordered + */ + int DATA_GRAPH__ROOT_RESOURCE = EcorePackage.EOBJECT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'EChange Summary' reference. + * + * + * @generated + * @ordered + */ + int DATA_GRAPH__ECHANGE_SUMMARY = EcorePackage.EOBJECT_FEATURE_COUNT + 2; + + /** + * The feature id for the 'ERoot Object' reference. + * + * + * @generated + * @ordered + */ + int DATA_GRAPH__EROOT_OBJECT = EcorePackage.EOBJECT_FEATURE_COUNT + 3; + + /** + * The number of structural features of the 'Data Graph' class. + * + * + * @generated + * @ordered + */ + int DATA_GRAPH_FEATURE_COUNT = EcorePackage.EOBJECT_FEATURE_COUNT + 4; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.DataObjectImpl Data Object}' class. + * + * + * @see org.apache.tuscany.sdo.impl.DataObjectImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getDataObject() + * @generated + */ + int DATA_OBJECT = 3; + + /** + * The meta object id for the '{@link commonj.sdo.Property Property}' class. + * + * + * @see commonj.sdo.Property + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getProperty() + * @generated + */ + int PROPERTY = 4; + + /** + * The meta object id for the '{@link commonj.sdo.Sequence Sequence}' class. + * + * + * @see commonj.sdo.Sequence + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getSequence() + * @generated + */ + int SEQUENCE = 5; + + /** + * The meta object id for the '{@link commonj.sdo.Type Type}' class. + * + * + * @see commonj.sdo.Type + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getType() + * @generated + */ + int TYPE = 6; + + /** + * The number of structural features of the 'Data Object' class. + * + * + * @generated + * @ordered + */ + int DATA_OBJECT_FEATURE_COUNT = 0; + + /** + * The number of structural features of the 'Property' class. + * + * + * @generated + * @ordered + */ + int PROPERTY_FEATURE_COUNT = 0; + + /** + * The number of structural features of the 'Sequence' class. + * + * + * @generated + * @ordered + */ + int SEQUENCE_FEATURE_COUNT = 0; + + /** + * The number of structural features of the 'Type' class. + * + * + * @generated + * @ordered + */ + int TYPE_FEATURE_COUNT = 0; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.AnyTypeDataObjectImpl Any Type Data Object}' class. + * + * + * @see org.apache.tuscany.sdo.impl.AnyTypeDataObjectImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getAnyTypeDataObject() + * @generated + */ + int ANY_TYPE_DATA_OBJECT = 7; + + /** + * The feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + int ANY_TYPE_DATA_OBJECT__MIXED = DATA_OBJECT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Any' attribute list. + * + * + * @generated + * @ordered + */ + int ANY_TYPE_DATA_OBJECT__ANY = DATA_OBJECT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Any Attribute' attribute list. + * + * + * @generated + * @ordered + */ + int ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE = DATA_OBJECT_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Any Type Data Object' class. + * + * + * @generated + * @ordered + */ + int ANY_TYPE_DATA_OBJECT_FEATURE_COUNT = DATA_OBJECT_FEATURE_COUNT + 3; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.SimpleAnyTypeDataObjectImpl Simple Any Type Data Object}' class. + * + * + * @see org.apache.tuscany.sdo.impl.SimpleAnyTypeDataObjectImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getSimpleAnyTypeDataObject() + * @generated + */ + int SIMPLE_ANY_TYPE_DATA_OBJECT = 8; + + /** + * The feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + int SIMPLE_ANY_TYPE_DATA_OBJECT__MIXED = ANY_TYPE_DATA_OBJECT__MIXED; + + /** + * The feature id for the 'Any' attribute list. + * + * + * @generated + * @ordered + */ + int SIMPLE_ANY_TYPE_DATA_OBJECT__ANY = ANY_TYPE_DATA_OBJECT__ANY; + + /** + * The feature id for the 'Any Attribute' attribute list. + * + * + * @generated + * @ordered + */ + int SIMPLE_ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE = ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE; + + /** + * The feature id for the 'Raw Value' attribute. + * + * + * @generated + * @ordered + */ + int SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE = ANY_TYPE_DATA_OBJECT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Value' attribute. + * + * + * @generated + * @ordered + */ + int SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE = ANY_TYPE_DATA_OBJECT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Instance Type' reference. + * + * + * @generated + * @ordered + */ + int SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE = ANY_TYPE_DATA_OBJECT_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Simple Any Type Data Object' class. + * + * + * @generated + * @ordered + */ + int SIMPLE_ANY_TYPE_DATA_OBJECT_FEATURE_COUNT = ANY_TYPE_DATA_OBJECT_FEATURE_COUNT + 3; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.ClassImpl Class}' class. + * + * + * @see org.apache.tuscany.sdo.impl.ClassImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getClass_() + * @generated + */ + int CLASS = 9; + + /** + * The feature id for the 'EAnnotations' containment reference list. + * + * + * @generated + * @ordered + */ + int CLASS__EANNOTATIONS = EcorePackage.ECLASS__EANNOTATIONS; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int CLASS__NAME = EcorePackage.ECLASS__NAME; + + /** + * The feature id for the 'Instance Class Name' attribute. + * + * + * @generated + * @ordered + */ + int CLASS__INSTANCE_CLASS_NAME = EcorePackage.ECLASS__INSTANCE_CLASS_NAME; + + /** + * The feature id for the 'Instance Class' attribute. + * + * + * @generated + * @ordered + */ + int CLASS__INSTANCE_CLASS = EcorePackage.ECLASS__INSTANCE_CLASS; + + /** + * The feature id for the 'Default Value' attribute. + * + * + * @generated + * @ordered + */ + int CLASS__DEFAULT_VALUE = EcorePackage.ECLASS__DEFAULT_VALUE; + + /** + * The feature id for the 'EPackage' container reference. + * + * + * @generated + * @ordered + */ + int CLASS__EPACKAGE = EcorePackage.ECLASS__EPACKAGE; + + /** + * The feature id for the 'Abstract' attribute. + * + * + * @generated + * @ordered + */ + int CLASS__ABSTRACT = EcorePackage.ECLASS__ABSTRACT; + + /** + * The feature id for the 'Interface' attribute. + * + * + * @generated + * @ordered + */ + int CLASS__INTERFACE = EcorePackage.ECLASS__INTERFACE; + + /** + * The feature id for the 'ESuper Types' reference list. + * + * + * @generated + * @ordered + */ + int CLASS__ESUPER_TYPES = EcorePackage.ECLASS__ESUPER_TYPES; + + /** + * The feature id for the 'EOperations' containment reference list. + * + * + * @generated + * @ordered + */ + int CLASS__EOPERATIONS = EcorePackage.ECLASS__EOPERATIONS; + + /** + * The feature id for the 'EAll Attributes' reference list. + * + * + * @generated + * @ordered + */ + int CLASS__EALL_ATTRIBUTES = EcorePackage.ECLASS__EALL_ATTRIBUTES; + + /** + * The feature id for the 'EAll References' reference list. + * + * + * @generated + * @ordered + */ + int CLASS__EALL_REFERENCES = EcorePackage.ECLASS__EALL_REFERENCES; + + /** + * The feature id for the 'EReferences' reference list. + * + * + * @generated + * @ordered + */ + int CLASS__EREFERENCES = EcorePackage.ECLASS__EREFERENCES; + + /** + * The feature id for the 'EAttributes' reference list. + * + * + * @generated + * @ordered + */ + int CLASS__EATTRIBUTES = EcorePackage.ECLASS__EATTRIBUTES; + + /** + * The feature id for the 'EAll Containments' reference list. + * + * + * @generated + * @ordered + */ + int CLASS__EALL_CONTAINMENTS = EcorePackage.ECLASS__EALL_CONTAINMENTS; + + /** + * The feature id for the 'EAll Operations' reference list. + * + * + * @generated + * @ordered + */ + int CLASS__EALL_OPERATIONS = EcorePackage.ECLASS__EALL_OPERATIONS; + + /** + * The feature id for the 'EAll Structural Features' reference list. + * + * + * @generated + * @ordered + */ + int CLASS__EALL_STRUCTURAL_FEATURES = EcorePackage.ECLASS__EALL_STRUCTURAL_FEATURES; + + /** + * The feature id for the 'EAll Super Types' reference list. + * + * + * @generated + * @ordered + */ + int CLASS__EALL_SUPER_TYPES = EcorePackage.ECLASS__EALL_SUPER_TYPES; + + /** + * The feature id for the 'EID Attribute' reference. + * + * + * @generated + * @ordered + */ + int CLASS__EID_ATTRIBUTE = EcorePackage.ECLASS__EID_ATTRIBUTE; + + /** + * The feature id for the 'EStructural Features' containment reference list. + * + * + * @generated + * @ordered + */ + int CLASS__ESTRUCTURAL_FEATURES = EcorePackage.ECLASS__ESTRUCTURAL_FEATURES; + + /** + * The number of structural features of the 'Class' class. + * + * + * @generated + * @ordered + */ + int CLASS_FEATURE_COUNT = EcorePackage.ECLASS_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.DataTypeImpl Data Type}' class. + * + * + * @see org.apache.tuscany.sdo.impl.DataTypeImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getDataType() + * @generated + */ + int DATA_TYPE = 10; + + /** + * The feature id for the 'EAnnotations' containment reference list. + * + * + * @generated + * @ordered + */ + int DATA_TYPE__EANNOTATIONS = EcorePackage.EDATA_TYPE__EANNOTATIONS; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int DATA_TYPE__NAME = EcorePackage.EDATA_TYPE__NAME; + + /** + * The feature id for the 'Instance Class Name' attribute. + * + * + * @generated + * @ordered + */ + int DATA_TYPE__INSTANCE_CLASS_NAME = EcorePackage.EDATA_TYPE__INSTANCE_CLASS_NAME; + + /** + * The feature id for the 'Instance Class' attribute. + * + * + * @generated + * @ordered + */ + int DATA_TYPE__INSTANCE_CLASS = EcorePackage.EDATA_TYPE__INSTANCE_CLASS; + + /** + * The feature id for the 'Default Value' attribute. + * + * + * @generated + * @ordered + */ + int DATA_TYPE__DEFAULT_VALUE = EcorePackage.EDATA_TYPE__DEFAULT_VALUE; + + /** + * The feature id for the 'EPackage' container reference. + * + * + * @generated + * @ordered + */ + int DATA_TYPE__EPACKAGE = EcorePackage.EDATA_TYPE__EPACKAGE; + + /** + * The feature id for the 'Serializable' attribute. + * + * + * @generated + * @ordered + */ + int DATA_TYPE__SERIALIZABLE = EcorePackage.EDATA_TYPE__SERIALIZABLE; + + /** + * The number of structural features of the 'Data Type' class. + * + * + * @generated + * @ordered + */ + int DATA_TYPE_FEATURE_COUNT = EcorePackage.EDATA_TYPE_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.AttributeImpl Attribute}' class. + * + * + * @see org.apache.tuscany.sdo.impl.AttributeImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getAttribute() + * @generated + */ + int ATTRIBUTE = 11; + + /** + * The feature id for the 'EAnnotations' containment reference list. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__EANNOTATIONS = EcorePackage.EATTRIBUTE__EANNOTATIONS; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__NAME = EcorePackage.EATTRIBUTE__NAME; + + /** + * The feature id for the 'Ordered' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__ORDERED = EcorePackage.EATTRIBUTE__ORDERED; + + /** + * The feature id for the 'Unique' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__UNIQUE = EcorePackage.EATTRIBUTE__UNIQUE; + + /** + * The feature id for the 'Lower Bound' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__LOWER_BOUND = EcorePackage.EATTRIBUTE__LOWER_BOUND; + + /** + * The feature id for the 'Upper Bound' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__UPPER_BOUND = EcorePackage.EATTRIBUTE__UPPER_BOUND; + + /** + * The feature id for the 'Many' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__MANY = EcorePackage.EATTRIBUTE__MANY; + + /** + * The feature id for the 'Required' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__REQUIRED = EcorePackage.EATTRIBUTE__REQUIRED; + + /** + * The feature id for the 'EType' reference. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__ETYPE = EcorePackage.EATTRIBUTE__ETYPE; + + /** + * The feature id for the 'Changeable' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__CHANGEABLE = EcorePackage.EATTRIBUTE__CHANGEABLE; + + /** + * The feature id for the 'Volatile' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__VOLATILE = EcorePackage.EATTRIBUTE__VOLATILE; + + /** + * The feature id for the 'Transient' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__TRANSIENT = EcorePackage.EATTRIBUTE__TRANSIENT; + + /** + * The feature id for the 'Default Value Literal' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__DEFAULT_VALUE_LITERAL = EcorePackage.EATTRIBUTE__DEFAULT_VALUE_LITERAL; + + /** + * The feature id for the 'Default Value' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__DEFAULT_VALUE = EcorePackage.EATTRIBUTE__DEFAULT_VALUE; + + /** + * The feature id for the 'Unsettable' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__UNSETTABLE = EcorePackage.EATTRIBUTE__UNSETTABLE; + + /** + * The feature id for the 'Derived' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__DERIVED = EcorePackage.EATTRIBUTE__DERIVED; + + /** + * The feature id for the 'EContaining Class' container reference. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__ECONTAINING_CLASS = EcorePackage.EATTRIBUTE__ECONTAINING_CLASS; + + /** + * The feature id for the 'ID' attribute. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__ID = EcorePackage.EATTRIBUTE__ID; + + /** + * The feature id for the 'EAttribute Type' reference. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE__EATTRIBUTE_TYPE = EcorePackage.EATTRIBUTE__EATTRIBUTE_TYPE; + + /** + * The number of structural features of the 'Attribute' class. + * + * + * @generated + * @ordered + */ + int ATTRIBUTE_FEATURE_COUNT = EcorePackage.EATTRIBUTE_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.ReferenceImpl Reference}' class. + * + * + * @see org.apache.tuscany.sdo.impl.ReferenceImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getReference() + * @generated + */ + int REFERENCE = 12; + + /** + * The feature id for the 'EAnnotations' containment reference list. + * + * + * @generated + * @ordered + */ + int REFERENCE__EANNOTATIONS = EcorePackage.EREFERENCE__EANNOTATIONS; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__NAME = EcorePackage.EREFERENCE__NAME; + + /** + * The feature id for the 'Ordered' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__ORDERED = EcorePackage.EREFERENCE__ORDERED; + + /** + * The feature id for the 'Unique' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__UNIQUE = EcorePackage.EREFERENCE__UNIQUE; + + /** + * The feature id for the 'Lower Bound' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__LOWER_BOUND = EcorePackage.EREFERENCE__LOWER_BOUND; + + /** + * The feature id for the 'Upper Bound' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__UPPER_BOUND = EcorePackage.EREFERENCE__UPPER_BOUND; + + /** + * The feature id for the 'Many' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__MANY = EcorePackage.EREFERENCE__MANY; + + /** + * The feature id for the 'Required' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__REQUIRED = EcorePackage.EREFERENCE__REQUIRED; + + /** + * The feature id for the 'EType' reference. + * + * + * @generated + * @ordered + */ + int REFERENCE__ETYPE = EcorePackage.EREFERENCE__ETYPE; + + /** + * The feature id for the 'Changeable' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__CHANGEABLE = EcorePackage.EREFERENCE__CHANGEABLE; + + /** + * The feature id for the 'Volatile' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__VOLATILE = EcorePackage.EREFERENCE__VOLATILE; + + /** + * The feature id for the 'Transient' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__TRANSIENT = EcorePackage.EREFERENCE__TRANSIENT; + + /** + * The feature id for the 'Default Value Literal' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__DEFAULT_VALUE_LITERAL = EcorePackage.EREFERENCE__DEFAULT_VALUE_LITERAL; + + /** + * The feature id for the 'Default Value' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__DEFAULT_VALUE = EcorePackage.EREFERENCE__DEFAULT_VALUE; + + /** + * The feature id for the 'Unsettable' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__UNSETTABLE = EcorePackage.EREFERENCE__UNSETTABLE; + + /** + * The feature id for the 'Derived' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__DERIVED = EcorePackage.EREFERENCE__DERIVED; + + /** + * The feature id for the 'EContaining Class' container reference. + * + * + * @generated + * @ordered + */ + int REFERENCE__ECONTAINING_CLASS = EcorePackage.EREFERENCE__ECONTAINING_CLASS; + + /** + * The feature id for the 'Containment' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__CONTAINMENT = EcorePackage.EREFERENCE__CONTAINMENT; + + /** + * The feature id for the 'Container' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__CONTAINER = EcorePackage.EREFERENCE__CONTAINER; + + /** + * The feature id for the 'Resolve Proxies' attribute. + * + * + * @generated + * @ordered + */ + int REFERENCE__RESOLVE_PROXIES = EcorePackage.EREFERENCE__RESOLVE_PROXIES; + + /** + * The feature id for the 'EOpposite' reference. + * + * + * @generated + * @ordered + */ + int REFERENCE__EOPPOSITE = EcorePackage.EREFERENCE__EOPPOSITE; + + /** + * The feature id for the 'EReference Type' reference. + * + * + * @generated + * @ordered + */ + int REFERENCE__EREFERENCE_TYPE = EcorePackage.EREFERENCE__EREFERENCE_TYPE; + + /** + * The number of structural features of the 'Reference' class. + * + * + * @generated + * @ordered + */ + int REFERENCE_FEATURE_COUNT = EcorePackage.EREFERENCE_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.EnumImpl Enum}' class. + * + * + * @see org.apache.tuscany.sdo.impl.EnumImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getEnum() + * @generated + */ + int ENUM = 13; + + /** + * The feature id for the 'EAnnotations' containment reference list. + * + * + * @generated + * @ordered + */ + int ENUM__EANNOTATIONS = EcorePackage.EENUM__EANNOTATIONS; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int ENUM__NAME = EcorePackage.EENUM__NAME; + + /** + * The feature id for the 'Instance Class Name' attribute. + * + * + * @generated + * @ordered + */ + int ENUM__INSTANCE_CLASS_NAME = EcorePackage.EENUM__INSTANCE_CLASS_NAME; + + /** + * The feature id for the 'Instance Class' attribute. + * + * + * @generated + * @ordered + */ + int ENUM__INSTANCE_CLASS = EcorePackage.EENUM__INSTANCE_CLASS; + + /** + * The feature id for the 'Default Value' attribute. + * + * + * @generated + * @ordered + */ + int ENUM__DEFAULT_VALUE = EcorePackage.EENUM__DEFAULT_VALUE; + + /** + * The feature id for the 'EPackage' container reference. + * + * + * @generated + * @ordered + */ + int ENUM__EPACKAGE = EcorePackage.EENUM__EPACKAGE; + + /** + * The feature id for the 'Serializable' attribute. + * + * + * @generated + * @ordered + */ + int ENUM__SERIALIZABLE = EcorePackage.EENUM__SERIALIZABLE; + + /** + * The feature id for the 'ELiterals' containment reference list. + * + * + * @generated + * @ordered + */ + int ENUM__ELITERALS = EcorePackage.EENUM__ELITERALS; + + /** + * The number of structural features of the 'Enum' class. + * + * + * @generated + * @ordered + */ + int ENUM_FEATURE_COUNT = EcorePackage.EENUM_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.DynamicDataObjectImpl Dynamic Data Object}' class. + * + * + * @see org.apache.tuscany.sdo.impl.DynamicDataObjectImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getDynamicDataObject() + * @generated + */ + int DYNAMIC_DATA_OBJECT = 14; + + /** + * The number of structural features of the 'Dynamic Data Object' class. + * + * + * @generated + * @ordered + */ + int DYNAMIC_DATA_OBJECT_FEATURE_COUNT = DATA_OBJECT_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.StoreDataObjectImpl Store Data Object}' class. + * + * + * @see org.apache.tuscany.sdo.impl.StoreDataObjectImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getStoreDataObject() + * @generated + */ + int STORE_DATA_OBJECT = 15; + + /** + * The number of structural features of the 'Store Data Object' class. + * + * + * @generated + * @ordered + */ + int STORE_DATA_OBJECT_FEATURE_COUNT = DATA_OBJECT_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.impl.DynamicStoreDataObjectImpl Dynamic Store Data Object}' class. + * + * + * @see org.apache.tuscany.sdo.impl.DynamicStoreDataObjectImpl + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getDynamicStoreDataObject() + * @generated + */ + int DYNAMIC_STORE_DATA_OBJECT = 16; + + /** + * The number of structural features of the 'Dynamic Store Data Object' class. + * + * + * @generated + * @ordered + */ + int DYNAMIC_STORE_DATA_OBJECT_FEATURE_COUNT = STORE_DATA_OBJECT_FEATURE_COUNT + 0; + + /** + * The meta object id for the 'EJava List' data type. + * + * + * @see java.util.List + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getEJavaList() + * @generated + */ + int EJAVA_LIST = 17; + + /** + * The meta object id for the 'EObject Stream Exception' data type. + * + * + * @see java.io.ObjectStreamException + * @see org.apache.tuscany.sdo.impl.SDOPackageImpl#getEObjectStreamException() + * @generated + */ + int EOBJECT_STREAM_EXCEPTION = 18; + + + /** + * Returns the meta object for class '{@link commonj.sdo.ChangeSummary Change Summary}'. + * + * + * @return the meta object for class 'Change Summary'. + * @see commonj.sdo.ChangeSummary + * @model instanceClass="commonj.sdo.ChangeSummary" + * @generated + */ + EClass getChangeSummary(); + + /** + * Returns the meta object for the reference '{@link commonj.sdo.ChangeSummary#getEDataGraph EData Graph}'. + * + * + * @return the meta object for the reference 'EData Graph'. + * @see commonj.sdo.ChangeSummary#getEDataGraph() + * @see #getChangeSummary() + * @generated + */ + EReference getChangeSummary_EDataGraph(); + + /** + * Returns the meta object for class '{@link commonj.sdo.ChangeSummary.Setting Change Summary Setting}'. + * + * + * @return the meta object for class 'Change Summary Setting'. + * @see commonj.sdo.ChangeSummary.Setting + * @model instanceClass="commonj.sdo.ChangeSummary$Setting" + * @generated + */ + EClass getChangeSummarySetting(); + + /** + * Returns the meta object for class '{@link commonj.sdo.DataGraph Data Graph}'. + * + * + * @return the meta object for class 'Data Graph'. + * @see commonj.sdo.DataGraph + * @model instanceClass="commonj.sdo.DataGraph" + * @generated + */ + EClass getDataGraph(); + + /** + * Returns the meta object for the attribute '{@link commonj.sdo.DataGraph#getResourceSet Resource Set}'. + * + * + * @return the meta object for the attribute 'Resource Set'. + * @see commonj.sdo.DataGraph#getResourceSet() + * @see #getDataGraph() + * @generated + */ + EAttribute getDataGraph_ResourceSet(); + + /** + * Returns the meta object for the attribute '{@link commonj.sdo.DataGraph#getRootResource Root Resource}'. + * + * + * @return the meta object for the attribute 'Root Resource'. + * @see commonj.sdo.DataGraph#getRootResource() + * @see #getDataGraph() + * @generated + */ + EAttribute getDataGraph_RootResource(); + + /** + * Returns the meta object for the reference '{@link commonj.sdo.DataGraph#getEChangeSummary EChange Summary}'. + * + * + * @return the meta object for the reference 'EChange Summary'. + * @see commonj.sdo.DataGraph#getEChangeSummary() + * @see #getDataGraph() + * @generated + */ + EReference getDataGraph_EChangeSummary(); + + /** + * Returns the meta object for the reference '{@link commonj.sdo.DataGraph#getERootObject ERoot Object}'. + * + * + * @return the meta object for the reference 'ERoot Object'. + * @see commonj.sdo.DataGraph#getERootObject() + * @see #getDataGraph() + * @generated + */ + EReference getDataGraph_ERootObject(); + + /** + * Returns the meta object for class '{@link commonj.sdo.DataObject Data Object}'. + * + * + * @return the meta object for class 'Data Object'. + * @see commonj.sdo.DataObject + * @model instanceClass="commonj.sdo.DataObject" + * @generated + */ + EClass getDataObject(); + + /** + * Returns the meta object for class '{@link commonj.sdo.Property Property}'. + * + * + * @return the meta object for class 'Property'. + * @see commonj.sdo.Property + * @model instanceClass="commonj.sdo.Property" + * @generated + */ + EClass getProperty(); + + /** + * Returns the meta object for class '{@link commonj.sdo.Sequence Sequence}'. + * + * + * @return the meta object for class 'Sequence'. + * @see commonj.sdo.Sequence + * @model instanceClass="commonj.sdo.Sequence" + * @generated + */ + EClass getSequence(); + + /** + * Returns the meta object for class '{@link commonj.sdo.Type Type}'. + * + * + * @return the meta object for class 'Type'. + * @see commonj.sdo.Type + * @model instanceClass="commonj.sdo.Type" + * @generated + */ + EClass getType(); + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.AnyTypeDataObject Any Type Data Object}'. + * + * + * @return the meta object for class 'Any Type Data Object'. + * @see org.apache.tuscany.sdo.AnyTypeDataObject + * @generated + */ + EClass getAnyTypeDataObject(); + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.SimpleAnyTypeDataObject Simple Any Type Data Object}'. + * + * + * @return the meta object for class 'Simple Any Type Data Object'. + * @see org.apache.tuscany.sdo.SimpleAnyTypeDataObject + * @generated + */ + EClass getSimpleAnyTypeDataObject(); + + /** + * Returns the meta object for class '{@link commonj.sdo.Type Class}'. + * + * + * @return the meta object for class 'Class'. + * @see commonj.sdo.Type + * @model instanceClass="commonj.sdo.Type" + * @generated + */ + EClass getClass_(); + + /** + * Returns the meta object for class '{@link commonj.sdo.Type Data Type}'. + * + * + * @return the meta object for class 'Data Type'. + * @see commonj.sdo.Type + * @model instanceClass="commonj.sdo.Type" + * @generated + */ + EClass getDataType(); + + /** + * Returns the meta object for class '{@link commonj.sdo.Property Attribute}'. + * + * + * @return the meta object for class 'Attribute'. + * @see commonj.sdo.Property + * @model instanceClass="commonj.sdo.Property" + * @generated + */ + EClass getAttribute(); + + /** + * Returns the meta object for class '{@link commonj.sdo.Property Reference}'. + * + * + * @return the meta object for class 'Reference'. + * @see commonj.sdo.Property + * @model instanceClass="commonj.sdo.Property" + * @generated + */ + EClass getReference(); + + /** + * Returns the meta object for class '{@link commonj.sdo.Type Enum}'. + * + * + * @return the meta object for class 'Enum'. + * @see commonj.sdo.Type + * @model instanceClass="commonj.sdo.Type" + * @generated + */ + EClass getEnum(); + + /** + * Returns the meta object for class '{@link commonj.sdo.DataObject Dynamic Data Object}'. + * + * + * @return the meta object for class 'Dynamic Data Object'. + * @see commonj.sdo.DataObject + * @model instanceClass="commonj.sdo.DataObject" + * @generated + */ + EClass getDynamicDataObject(); + + /** + * Returns the meta object for class '{@link commonj.sdo.DataObject Store Data Object}'. + * + * + * @return the meta object for class 'Store Data Object'. + * @see commonj.sdo.DataObject + * @model instanceClass="commonj.sdo.DataObject" + * @generated + */ + EClass getStoreDataObject(); + + /** + * Returns the meta object for class '{@link commonj.sdo.DataObject Dynamic Store Data Object}'. + * + * + * @return the meta object for class 'Dynamic Store Data Object'. + * @see commonj.sdo.DataObject + * @model instanceClass="commonj.sdo.DataObject" + * @generated + */ + EClass getDynamicStoreDataObject(); + + /** + * Returns the meta object for data type '{@link java.util.List EJava List}'. + * + * + * @return the meta object for data type 'EJava List'. + * @see java.util.List + * @model instanceClass="java.util.List" serializable="false" + * @generated + */ + EDataType getEJavaList(); + + /** + * Returns the meta object for data type '{@link java.io.ObjectStreamException EObject Stream Exception}'. + * + * + * @return the meta object for data type 'EObject Stream Exception'. + * @see java.io.ObjectStreamException + * @model instanceClass="java.io.ObjectStreamException" serializable="false" + * @generated + */ + EDataType getEObjectStreamException(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + SDOFactory getSDOFactory(); + +} //SDOPackage diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOTypeVisitor.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOTypeVisitor.java new file mode 100644 index 0000000000..ced62cc058 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SDOTypeVisitor.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo; + +import commonj.sdo.Property; +import commonj.sdo.Type; + +/** + * Visitor interface that allows applications to process SDO type metadata. + * + * @version $Rev$ $Date$ + */ +public interface SDOTypeVisitor { + /** + * Visit a type definition. + * + * @param type the type to visit + */ + void visitType(Type type); + + /** + * Visit a property definition. + * + * @param property the property to visit + */ + void visitProperty(Property property); + + /** + * Visit after all properties. + */ + void visitEnd(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SimpleAnyTypeDataObject.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SimpleAnyTypeDataObject.java new file mode 100644 index 0000000000..5fed5829ae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/SimpleAnyTypeDataObject.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo; + +import org.eclipse.emf.ecore.xml.type.SimpleAnyType; + +/** + * + * A representation of the model object 'Simple Any Type Data Object'. + * + * + * + * @see org.apache.tuscany.sdo.SDOPackage#getSimpleAnyTypeDataObject() + * @model extendedMetaData="kind='simple'" + * @generated + */ +public interface SimpleAnyTypeDataObject extends AnyTypeDataObject, SimpleAnyType { +} // SimpleAnyTypeDataObject diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java new file mode 100644 index 0000000000..4375faa9f3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java @@ -0,0 +1,89 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.XMLDocument; + +/** + * Helper interface for reading and writing SDO DataObjects from XML streams. + * + * @version $Rev$ $Date$ + */ +public interface XMLStreamHelper { + /** + * Creates and returns an XMLDocument from an XML input stream. + * The reader must be positioned on a START_DOCUMENT event. + * + * @param reader the stream to read + * @return an XMLDocument created from the stream + * @throws XMLStreamException if there was a problem reading the stream + * @throws IllegalStateException if the reader is not positioned on a START_DOCUMENT event + */ + XMLDocument load(XMLStreamReader reader) throws XMLStreamException, IllegalStateException; + + /** + * Save a XMLDocument to an XML stream. + * + * @param document the document to be written + * @param writer the stream to write to + * @throws XMLStreamException if there was a problem writing to the stream + */ + void save(XMLDocument document, XMLStreamWriter writer) throws XMLStreamException; + + /** + * Creates and returns a XMLStreamReader that can be used to read an XMLDocument as a XML event stream. + * The reader will be positioned on a START_DOCUMENT event. + * + * @param document the XMLDocument to be read + * @return an XMLStreamReader that can be used to read the document + */ + XMLStreamReader createXMLStreamReader(XMLDocument document) throws XMLStreamException; + + /** + * Create a DataObject from an element in a XML stream. + * The reader must be positioned on a START_ELEMENT event. + * + * @param reader the stream to read + * @return a DataObject created from the element in the stream + * @throws XMLStreamException if there was a problem reading the stream + * @throws IllegalStateException if the reader is not positioned on a START_ELEMENT event + */ + DataObject loadObject(XMLStreamReader reader) throws XMLStreamException, IllegalStateException; + + /** + * Save a DataObject to an XML stream. + * + * @param sdo the DataObject to be written + * @param writer the stream to write to + * @throws XMLStreamException if there was a problem writing to the stream + */ + void saveObject(DataObject sdo, XMLStreamWriter writer) throws XMLStreamException; + + /** + * Creates and returns a XMLStreamReader that can be used to read a DataObject as a XML event stream. + * The reader will be positioned on a START_ELEMENT event. + * + * @param sdo the DataObject to be read + * @return an XMLStreamReader that can be used to read the DataObject + */ + XMLStreamReader createXMLStreamReader(DataObject sdo); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGenerator.java new file mode 100644 index 0000000000..6608357769 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGenerator.java @@ -0,0 +1,95 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.codegen; + +import java.util.List; + +import commonj.sdo.Property; +import commonj.sdo.Type; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Opcodes; + +import org.apache.tuscany.sdo.SDOTypeVisitor; + +/** + * Implementation of a generator that will directly emit bytecode for an interface that + * corresponds to the static properties of a SDO type. + * + * @version $Rev$ $Date$ + */ +public class BytecodeInterfaceGenerator implements SDOTypeVisitor { + private final ClassWriter cw; + + public BytecodeInterfaceGenerator() { + cw = new ClassWriter(false); + } + + public void visitType(Type type) { + String name = type.getName(); + int lastDot = name.lastIndexOf('.'); + if (lastDot != -1) { + name = name.replace('.', '/'); + } else { + name = Character.toUpperCase(name.charAt(0)) + name.substring(1); + } + + List baseTypes = type.getBaseTypes(); + String[] interfaces = new String[baseTypes.size()]; + for (int i = 0; i < baseTypes.size(); i++) { + Type baseType = (Type) baseTypes.get(i); + interfaces[i] = baseType.getInstanceClass().getName().replace('.', '/'); + } + + cw.visit(Opcodes.V1_4, + Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT + Opcodes.ACC_INTERFACE, + name, null, "java/lang/Object", interfaces); + } + + public void visitProperty(Property property) { + String name = property.getName(); + String propertyName = Character.toUpperCase(name.charAt(0)) + name.substring(1); + Class javaType = property.getType().getInstanceClass(); + String desc = org.objectweb.asm.Type.getDescriptor(javaType); + + if (property.isMany()) { + cw.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "get" + propertyName, "()Ljava/util/List;", null, null).visitEnd(); + } else { + if (boolean.class.equals(javaType)) { + cw.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "is" + propertyName, "()Z", null, null).visitEnd(); + } else { + cw.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "get" + propertyName, "()" + desc, null, null).visitEnd(); + } + if (!property.isReadOnly()) { + cw.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "set" + propertyName, '(' + desc + ")V", null, null).visitEnd(); + } + } + } + + public void visitEnd() { + cw.visitEnd(); + } + + /** + * Return the bytecode for the interface class in a form that can be written + * to disk, added to a JAR file, or passed to a ClassLoader. + * + * @return the bytecode for the SDO Type's interface class + */ + public byte[] getClassData() { + return cw.toByteArray(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/GenerationException.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/GenerationException.java new file mode 100644 index 0000000000..15ff8a7502 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/GenerationException.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.codegen; + +/** + * Exception indicating there was a problem with code generation. + * + * @version $Rev$ $Date$ + */ +public abstract class GenerationException extends RuntimeException { + public GenerationException() { + } + + public GenerationException(String message) { + super(message); + } + + public GenerationException(String message, Throwable cause) { + super(message, cause); + } + + public GenerationException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGenerator.java new file mode 100644 index 0000000000..b7048ed6ab --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGenerator.java @@ -0,0 +1,176 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.codegen; + +import java.io.PrintWriter; +import java.util.List; + +import commonj.sdo.Property; +import commonj.sdo.Type; + +import org.apache.tuscany.sdo.SDOTypeVisitor; + +/** + * Implementation of a generator that will output the source code for a Java interface + * that corresponds to the SDO Type's static properties. + * + * @version $Rev$ $Date$ + */ +public class JavaInterfaceGenerator implements SDOTypeVisitor { + + private static String canonicalize(String className) { + if (className == null) { + return ""; + } + if (className.charAt(0) != '[') { // if not array + return className; + } + // process array + boolean invalidClassName = false; + int nestLevel = 1; + StringBuffer sb = new StringBuffer(); + try { + while (className.charAt(nestLevel) == '[') { + nestLevel++; + } + char typeChar = className.charAt(nestLevel); + int end = nestLevel; + switch (typeChar) { + case 'L': + end = className.length() - 1; + if (className.charAt(end) != ';') { + invalidClassName = true; + } else { + sb.append(className.substring(nestLevel+1, end)); + } + break; + case 'Z': + sb.append("boolean"); + break; + case 'B': + sb.append("byte"); + break; + case 'C': + sb.append("char"); + break; + case 'D': + sb.append("double"); + break; + case 'F': + sb.append("float"); + break; + case 'I': + sb.append("int"); + break; + case 'J': + sb.append("long"); + break; + case 'S': + sb.append("short"); + break; + default: + invalidClassName = true; + break; + } + if (end != (className.length() - 1)) { + invalidClassName = true; // we have not used all the characters + } else { + for (int i=0; i 1 && i < name.length() && !Character.isDigit(name.charAt(i))) + { + --i; + } + return name.substring(0, i).toLowerCase() + name.substring(i); + } + } + +protected static String validNameStatic(String name, int casing, String prefix) + { + List parsedName = parseNameStatic(name, '_'); + StringBuffer result = new StringBuffer(); + for (Iterator i = parsedName.iterator(); i.hasNext(); ) + { + String nameComponent = (String)i.next(); + if (nameComponent.length() > 0) + { + if (result.length() > 0 || casing == UPPER_CASE) + { + result.append(Character.toUpperCase(nameComponent.charAt(0))); + result.append(nameComponent.substring(1)); + } + else + { + result.append(nameComponent); + } + } + } + + return + result.length() == 0 ? + prefix : + Character.isJavaIdentifierStart(result.charAt(0)) ? + casing == LOWER_CASE ? + uncapNameStatic(result.toString()) : + result.toString() : + prefix + result; + } + + protected static List parseNameStatic(String sourceName, char separator) + { + List result = new ArrayList(); + if (sourceName != null) + { + StringBuffer currentWord = new StringBuffer(); + boolean lastIsLower = false; + for (int index = 0, length = sourceName.length(); index < length; ++index) + { + char curChar = sourceName.charAt(index); + if (!Character.isJavaIdentifierPart(curChar)) + { + curChar = separator; + } + if (Character.isUpperCase(curChar) || (!lastIsLower && Character.isDigit(curChar)) || curChar == separator) + { + if (lastIsLower && currentWord.length() > 1 || curChar == separator && currentWord.length() > 0) + { + result.add(currentWord.toString()); + currentWord = new StringBuffer(); + } + lastIsLower = false; + } + else + { + if (!lastIsLower) + { + int currentWordLength = currentWord.length(); + if (currentWordLength > 1) + { + char lastChar = currentWord.charAt(--currentWordLength); + currentWord.setLength(currentWordLength); + result.add(currentWord.toString()); + currentWord = new StringBuffer(); + currentWord.append(lastChar); + } + } + lastIsLower = true; + } + + if (curChar != separator) + { + currentWord.append(curChar); + } + } + + result.add(currentWord.toString()); + } + return result; + } + +public static String getDefaultPackageName(String targetNamespace) + { + + URI uri = URI.createURI(targetNamespace); + List parsedName; + if (uri.isHierarchical()) + { + String host = uri.host(); + if (host != null && host.startsWith("www.")) + { + host = host.substring(4); + } + parsedName = parseNameStatic(host, '.'); + Collections.reverse(parsedName); + if (!parsedName.isEmpty()) + { + parsedName.set(0, ((String)parsedName.get(0)).toLowerCase()); + } + + parsedName.addAll(parseNameStatic(uri.trimFileExtension().path(), '/')); + } + else + { + String opaquePart = uri.opaquePart(); + int index = opaquePart.indexOf(":"); + if (index != -1 && "urn".equalsIgnoreCase(uri.scheme())) + { + parsedName = parseNameStatic(opaquePart.substring(0, index), '-'); + if (parsedName.size() > 0 && DOMAINS.contains(parsedName.get(parsedName.size() - 1))) + { + Collections.reverse(parsedName); + parsedName.set(0, ((String)parsedName.get(0)).toLowerCase()); + } + parsedName.addAll(parseNameStatic(opaquePart.substring(index + 1), '/')); + } + else + { + parsedName = parseNameStatic(opaquePart, '/'); + } + } + + StringBuffer qualifiedPackageName = new StringBuffer(); + for (Iterator i = parsedName.iterator(); i.hasNext(); ) + { + String packageName = (String)i.next(); + if (packageName.length() > 0) + { + if (qualifiedPackageName.length() > 0) + { + qualifiedPackageName.append('.'); + } + qualifiedPackageName.append(validNameStatic(packageName, LOWER_CASE,"_")); + } + } + + return qualifiedPackageName.toString().toLowerCase(); //make sure it's lower case .. we can't work with Axis if not. + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java new file mode 100644 index 0000000000..f4d39670b6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java @@ -0,0 +1,215 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.helper; + + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.sdo.model.impl.ModelPackageImpl; +import org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; + + +/** + * Look up a Type given the uri and typeName or interfaceClass. + * SDO Types are available through the + * getType("commonj.sdo", typeName) method. + * Defines Types from DataObjects. + */ +public class TypeHelperImpl implements TypeHelper +{ + protected ExtendedMetaData extendedMetaData; + + public ExtendedMetaData getExtendedMetaData() + { + return extendedMetaData; + } + + public TypeHelperImpl(ExtendedMetaData extendedMetaData) + { + this.extendedMetaData = extendedMetaData; + + // Register the standard (predefined) SDO types + ModelPackageImpl.init(); + JavaPackageImpl.init(); + MetadataPackageImpl.init(); + } + + public Type getType(String uri, String typeName) + { + EPackage ePackage = extendedMetaData.getPackage(uri); + if (ePackage != null) + { + EClassifier eClassifier = ePackage.getEClassifier(typeName); + if (eClassifier == null) + { + eClassifier = extendedMetaData.getType(ePackage, typeName); + } + return (Type)eClassifier; + } + return null; + } + + public Type getType(Class interfaceClass) + { + Type type = SDOUtil.getJavaSDOType(interfaceClass); + if (type != null) + { + return type; + } + + //TODO more efficient implementation ... this is a really bad one! + for (Iterator iter = EPackage.Registry.INSTANCE.values().iterator(); iter.hasNext(); ) + { + Object value = iter.next(); + if (value instanceof EPackage) + { + EPackage ePackage = (EPackage)value; + for (Iterator iter2 = ePackage.getEClassifiers().iterator(); iter2.hasNext(); ) + { + EClassifier eClassifier = (EClassifier)iter2.next(); + if (eClassifier.getInstanceClass() == interfaceClass) + { + return (Type)eClassifier; + } + } + } + } + + return null; + } + + public Type define(DataObject type) + { + if (!(type instanceof org.apache.tuscany.sdo.model.Type)) + throw new IllegalArgumentException(); + org.apache.tuscany.sdo.model.Type modeledType = (org.apache.tuscany.sdo.model.Type)type; + + boolean isDataType = modeledType.isDataType(); + Type definedType = SDOUtil.createType(this, modeledType.getUri(), modeledType.getName(), isDataType); + + SDOUtil.setJavaClassName(definedType, modeledType.getInstanceClassName()); + + if (!isDataType) + { + SDOUtil.setSequenced(definedType, modeledType.isSequenced()); + SDOUtil.setOpen(definedType, modeledType.isOpen()); + SDOUtil.setAbstract(definedType, modeledType.isAbstract()); + + for (Iterator iter = modeledType.getBaseType().iterator(); iter.hasNext(); ) + { + Type baseType = getDefinedType((org.apache.tuscany.sdo.model.Type)iter.next()); + SDOUtil.addBaseType(definedType, baseType); + } + + for (Iterator iter = modeledType.getAliasName().iterator(); iter.hasNext(); ) + { + String aliasName = (String)iter.next(); + SDOUtil.addAliasName(definedType, aliasName); + } + + for (Iterator iter = modeledType.getProperty().iterator(); iter.hasNext(); ) + { + org.apache.tuscany.sdo.model.Property modeledProperty = (org.apache.tuscany.sdo.model.Property)iter.next(); + + Type propertyType = getDefinedType(modeledProperty.getType_()); + Property definedProperty = SDOUtil.createProperty(definedType, modeledProperty.getName(), propertyType); + + SDOUtil.setMany(definedProperty, modeledProperty.isMany()); + SDOUtil.setDefault(definedProperty, modeledProperty.getDefault_()); + SDOUtil.setReadOnly(definedProperty, modeledProperty.isReadOnly()); + + for (Iterator iter2 = modeledProperty.getAliasName().iterator(); iter2.hasNext(); ) + { + String aliasName = (String)iter2.next(); + SDOUtil.addAliasName(definedProperty, aliasName); + } + + if (!propertyType.isDataType()) + { + SDOUtil.setContainment(definedProperty, modeledProperty.isContainment()); + if (modeledProperty.getOpposite_() != null) + { + SDOUtil.setOpposite(definedProperty, getDefinedProperty(modeledProperty.getOpposite_())); + } + } + } + } // if (!isDataType) + + return definedType; + } + + public List /*Type*/define(List /*DataObject*/types) + { + int count = types.size(); + List definedTypes = new ArrayList(count); + for (int i = 0; i < count; i++) + { + definedTypes.add(define((DataObject)types.get(i))); + } + return definedTypes; + } + + protected Type getDefinedType(org.apache.tuscany.sdo.model.Type modeledType) + { + if (modeledType instanceof Type) + { + return (Type)modeledType; + } + else + { + EClassifier eClassifier = extendedMetaData.getType(modeledType.getUri(), modeledType.getName()); + if (eClassifier != null) + { + return (Type)eClassifier; + } + else + { + return define((DataObject)modeledType); + } + } + } + + protected Property getDefinedProperty(org.apache.tuscany.sdo.model.Property modeledProperty) + { + if (modeledProperty instanceof Property) + { + return (Property)modeledProperty; + } + else + { + DataObject modeledContainingType = ((DataObject)modeledProperty).getContainer(); + + Type definedContainingType = getDefinedType((org.apache.tuscany.sdo.model.Type)modeledContainingType); + String propertyName = modeledProperty.getName(); + + return definedContainingType.getProperty(propertyName); + } + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLDocumentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLDocumentImpl.java new file mode 100644 index 0000000000..72fdc93f60 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLDocumentImpl.java @@ -0,0 +1,553 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.helper; + + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sdo.SDOFactory; +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.SimpleAnyTypeDataObject; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.eclipse.emf.common.util.EMap; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.ExtendedMetaData; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.xmi.XMLOptions; +import org.eclipse.emf.ecore.xmi.XMLParserPool; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.emf.ecore.xmi.impl.XMLOptionsImpl; +import org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl; +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; +import org.xml.sax.InputSource; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.XMLDocument; + + +/** + * Represents an XML Document containing a tree of DataObjects. + * + * An example XMLDocument fragment is: + * + * + * + * created from this XML Schema fragment: + * + * + * + * + * Upon loading this XMLDocument: + * DataObject is an instance of Type PurchaseOrderType. + * RootElementURI is null because the XSD has no targetNamespace URI. + * RootElementName is purchaseOrder. + * Encoding is null because the document did not specify an encoding. + * XMLDeclaration is true because the document contained an XML declaration. + * XMLVersion is 1.0 + * SchemaLocation and noNamespaceSchemaLocation are null because they are + * not specified in the document. + * + * When saving the root element, if the type of the root dataObject is not the + * type of global element specified by rootElementURI and rootElementName, + * or if a global element does not exist for rootElementURI and rootElementName, + * then an xsi:type declaration is written to record the root DataObject's Type. + * + * When loading the root element and an xsi:type declaration is found + * it is used as the type of the root DataObject. In this case, + * if validation is not being performed, it is not an error if the + * rootElementName is not a global element. + */ +public class XMLDocumentImpl implements XMLDocument +{ + protected ExtendedMetaData extendedMetaData; + + protected EObject rootObject; + + protected XMLResource resource; + + protected EStructuralFeature rootElement; + + protected EObject documentRoot; + + protected final static String WHITESPACE_REGEX = "\\s"; + + protected static XMLParserPool globalXMLParserPool = new XMLParserPoolImpl(); + + //TODO clean up the options thing + protected XMLDocumentImpl(ExtendedMetaData extendedMetaData, Object options) + { + this.extendedMetaData = extendedMetaData; + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + + if (options instanceof Map) + { + Class resourceFactoryClass = (Class)((Map)options).get("GENERATED_LOADER"); + if (resourceFactoryClass != null) + { + try + { + Object resourceFactory = resourceFactoryClass.newInstance(); + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + + resource = (XMLResource)resourceSet.createResource(URI.createURI("http:///temp.xml")); + + XMLOptions xmlOptions = new XMLOptionsImpl(); + xmlOptions.setProcessAnyXML(true); + resource.getDefaultLoadOptions().put(XMLResource.OPTION_XML_OPTIONS, xmlOptions); + + resource.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData); + resource.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData); + + resource.getDefaultLoadOptions().put(XMLResource.OPTION_USE_PARSER_POOL, globalXMLParserPool); + + resource.getDefaultLoadOptions().put(XMLResource.OPTION_USE_DEPRECATED_METHODS, Boolean.FALSE); + + resource.getDefaultSaveOptions().put(XMLResource.OPTION_CONFIGURATION_CACHE, Boolean.TRUE); + resource.getDefaultLoadOptions().put(XMLResource.OPTION_CONFIGURATION_CACHE, Boolean.TRUE); + + resource.getDefaultLoadOptions().put(XMLResource.OPTION_ANY_TYPE, SDOPackage.eINSTANCE.getAnyTypeDataObject()); + resource.getDefaultSaveOptions().put(XMLResource.OPTION_ANY_TYPE, SDOPackage.eINSTANCE.getAnyTypeDataObject()); + + resource.getDefaultLoadOptions().put(XMLResource.OPTION_ANY_SIMPLE_TYPE, SDOPackage.eINSTANCE.getSimpleAnyTypeDataObject()); + resource.getDefaultSaveOptions().put(XMLResource.OPTION_ANY_SIMPLE_TYPE, SDOPackage.eINSTANCE.getSimpleAnyTypeDataObject()); + + //resource.getDefaultLoadOptions().put(XMLResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, globalHashMap); + + //resource.getDefaultSaveOptions().put(XMLResource.OPTION_FORMATTED, Boolean.FALSE); + } + + protected XMLDocumentImpl(ExtendedMetaData extendedMetaData) + { + this(extendedMetaData, null); + } + + protected XMLDocumentImpl(ExtendedMetaData extendedMetaData, DataObject dataObject, String rootElementURI, String rootElementName) + { + this(extendedMetaData); + + rootObject = (EObject)dataObject; + + rootElement = extendedMetaData.getElement(rootElementURI, rootElementName); + if (rootElement == null) + { + rootElement = ExtendedMetaData.INSTANCE.demandFeature(rootElementURI, rootElementName, true); + } + + EClass documentRootClass = rootElement.getEContainingClass(); + documentRoot = EcoreUtil.create(documentRootClass); + resource.getContents().add(documentRoot); + } + + protected void save(OutputStream outputStream, Object options) throws IOException + { + EObject oldContainer = null; + EReference oldContainmentReference = null; + int oldContainmentIndex = -1; + + if (documentRoot != null) + { + //TODO also check if rootObject is directly contained in a resource + oldContainer = rootObject.eContainer(); + if (oldContainer != null) + { + oldContainmentReference = rootObject.eContainmentFeature(); + } + if (oldContainer != documentRoot || oldContainmentReference != rootElement) + { + if (oldContainmentReference != null && oldContainmentReference.isMany()) + { + oldContainmentIndex = ((List)oldContainer.eGet(oldContainmentReference)).indexOf(rootObject); + } + + Object rootValue = + rootElement instanceof EAttribute && rootObject instanceof SimpleAnyTypeDataObject ? + ((SimpleAnyTypeDataObject)rootObject).getValue() : rootObject; + + documentRoot.eSet(rootElement, rootValue); + } + } + + resource.save(outputStream, (Map)options); + + if (oldContainer != null) + { + if (oldContainer != documentRoot || oldContainmentReference != rootElement) + { + if (oldContainmentReference.isMany()) + { + ((List)oldContainer.eGet(oldContainmentReference)).add(oldContainmentIndex, rootObject); + } + else + { + oldContainer.eSet(oldContainmentReference, rootObject); + } + } + } + else if (documentRoot != null) + { + documentRoot.eSet(rootElement, null); + } + } + + protected void save(Writer outputWriter, Object options) throws IOException + { + // TODO temporary brute-force implementation ... to be replaced + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + save(outputStream, options); + outputWriter.write(new String(outputStream.toByteArray())); + } + + protected void load(InputStream inputStream, String locationURI, Object options) throws IOException + { + InputSource inputSource = new InputSource(inputStream); + load(inputSource, locationURI, options); + } + + protected void load(Reader inputReader, String locationURI, Object options) throws IOException + { + InputSource inputSource = new InputSource(inputReader); + load(inputSource, locationURI, options); + } + + protected void load(InputSource inputSource, String locationURI, Object options) throws IOException + { + rootObject = null; + rootElement = null; + documentRoot = null; + + if (locationURI != null) + { + inputSource.setSystemId(locationURI); + resource.setURI(URI.createURI(locationURI)); + } + + resource.load(inputSource, (Map)options); + + if (!resource.getContents().isEmpty()) + { + documentRoot = (EObject)resource.getContents().get(0); + EClass documentRootClass = documentRoot.eClass(); + if ("".equals(extendedMetaData.getName(documentRootClass))) //TODO efficient way to check this? Maybe DataObject.getContainer should also check this? + { + FeatureMap featureMap = (FeatureMap)documentRoot.eGet(documentRootClass.getEStructuralFeature(0)); // get mixed feature + int size = featureMap.size(); + for (int index = 0; index < size; index++) + { + EStructuralFeature feature = featureMap.getEStructuralFeature(index); + boolean isText = + feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT || + feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA || + feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT; + if (!isText) + { + if (feature instanceof EReference) + { + rootObject = (EObject)featureMap.getValue(index); + documentRoot.eUnset(feature); + } + else //EAttribute + { + rootObject = (EObject)SDOUtil.createDataTypeWrapper((Type)feature.getEType(), featureMap.getValue(index)); + } + rootElement = feature; + break; + } + } //for + } + else + { + rootObject = documentRoot; + documentRoot = null; + } + } + } + + public DataObject getRootObject() + { + return (DataObject)rootObject; + } + + public String getRootElementURI() + { + if (rootElement != null) + { + return extendedMetaData.getNamespace(rootElement); + } + else if (rootObject != null) + { + return extendedMetaData.getNamespace(rootObject.eClass()); + } + return null; + } + + public String getRootElementName() + { + if (rootElement != null) + { + return extendedMetaData.getName(rootElement); + } + else if (rootObject != null) + { + return extendedMetaData.getName(rootObject.eClass()); + } + return null; + } + + public String getEncoding() + { + return resource.getEncoding(); + } + + public void setEncoding(String encoding) + { + resource.setEncoding(encoding); + } + + public boolean isXMLDeclaration() + { + return Boolean.FALSE.equals(resource.getDefaultSaveOptions().get(XMLResource.OPTION_DECLARE_XML)); + } + + public void setXMLDeclaration(boolean xmlDeclaration) + { + resource.getDefaultSaveOptions().put(XMLResource.OPTION_DECLARE_XML, xmlDeclaration ? Boolean.TRUE : Boolean.FALSE); + } + + public String getXMLVersion() + { + return resource.getXMLVersion(); + } + + public void setXMLVersion(String xmlVersion) + { + resource.setXMLVersion(xmlVersion); + } + + /** + * @return an EMap containing the schema locations or null when no map + */ + protected EMap getSchemaLocationMap() + { + EMap result = null; + if ((documentRoot != null) && (extendedMetaData != null)) + { + EReference xsiSchemaLocationMapFeature = extendedMetaData + .getXSISchemaLocationMapFeature(documentRoot.eClass()); + if (xsiSchemaLocationMapFeature != null) + { + result = (EMap) documentRoot.eGet(xsiSchemaLocationMapFeature); + } + } + return result; + } + + /** + * @param value + * from schema location map. + * @return string form of URI from provided value, deresolved if appropriate. + */ + protected String deresolve(String value) + { + URI location = URI.createURI(value); + URI resourceURI = resource.getURI(); + boolean shouldDeresolve = resourceURI != null && !resourceURI.isRelative() + && resourceURI.isHierarchical(); + if (shouldDeresolve && !location.isRelative()) + { + URI deresolvedURI = location.deresolve(resourceURI, true, true, false); + if (deresolvedURI.hasRelativePath()) + { + location = deresolvedURI; + } + } + return location.toString(); + } + + /** + * @param value + * for schema location from input parameter. + * @return string form of URI from provided value, resolved if appropriate. + */ + protected String resolve(String value) + { + URI location = URI.createURI(value); + URI resourceURI = resource.getURI(); + boolean shouldResolve = resourceURI != null && resourceURI.isHierarchical() + && !resourceURI.isRelative(); + if (shouldResolve && location.isRelative() && location.hasRelativePath()) + { + location = location.resolve(resourceURI, false); + } + return location.toString(); + } + + public String getSchemaLocation() + { + EMap xsiSchemaLocationMap = getSchemaLocationMap(); + if (xsiSchemaLocationMap != null) + { + if (!xsiSchemaLocationMap.isEmpty()) + { + StringBuffer xsiSchemaLocation = new StringBuffer(); + for (Iterator i = xsiSchemaLocationMap.entrySet().iterator(); i + .hasNext();) + { + Map.Entry entry = (Map.Entry) i.next(); + String namespace = (String) entry.getKey(); + if (namespace != null) + { + if (xsiSchemaLocation.length() > 0) + { + xsiSchemaLocation.append(' '); + } + xsiSchemaLocation.append(namespace); + xsiSchemaLocation.append(' '); + String value = entry.getValue().toString(); + xsiSchemaLocation.append(deresolve(value)); + } + } + return xsiSchemaLocation.toString().equals("") ? null + : xsiSchemaLocation.toString(); + } + } + return null; + } + + public void setSchemaLocation(String schemaLocation) + { + EMap xsiSchemaLocationMap = getSchemaLocationMap(); + if (xsiSchemaLocationMap != null) + { + // only remove the entries from xsiSchemaLocationMap that contain a + // non-null key + for (Iterator i = xsiSchemaLocationMap.entrySet().iterator(); i.hasNext();) + { + Map.Entry entry = (Map.Entry) i.next(); + if (entry.getKey() != null) + { + i.remove(); + } + } + if (xsiSchemaLocationMap.size() == 0) + { + resource.getDefaultSaveOptions().put( + XMLResource.OPTION_SCHEMA_LOCATION, Boolean.FALSE); + } + if (schemaLocation != null) + { + String[] values = schemaLocation.split(WHITESPACE_REGEX); + for (int i = 0; i < values.length; i++) // note: also incremented in + // loop + { + String key = values[i++]; + if (i < values.length) + { + xsiSchemaLocationMap.put(key, resolve(values[i])); + } + } + if (xsiSchemaLocationMap.size() != 0) + { + resource.getDefaultSaveOptions().put( + XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); + } + } + } + } + + public String getNoNamespaceSchemaLocation() + { + EMap xsiSchemaLocationMap = getSchemaLocationMap(); + if (xsiSchemaLocationMap != null) + { + StringBuffer xsiSchemaLocation = new StringBuffer(); + if (!xsiSchemaLocationMap.isEmpty()) + { + Object valueObject = xsiSchemaLocationMap.get(null); + if (valueObject != null) + { + String valueString = (String) valueObject; + String[] values = valueString.split(WHITESPACE_REGEX); + for (int i = 0; i < values.length; i++) + { + if (xsiSchemaLocation.length() > 0) + { + xsiSchemaLocation.append(' '); + } + xsiSchemaLocation.append(deresolve(values[i])); + } + } + String result = xsiSchemaLocation.toString(); + return result.equals("") ? null : result; + } + } + return null; + } + + public void setNoNamespaceSchemaLocation(String schemaLocation) + { + EMap xsiSchemaLocationMap = getSchemaLocationMap(); + if (xsiSchemaLocationMap != null) + { + // only remove the entries from xsiSchemaLocationMap that contain a null + // key + xsiSchemaLocationMap.removeKey(null); + if (xsiSchemaLocationMap.size() == 0) + { + resource.getDefaultSaveOptions().put( + XMLResource.OPTION_SCHEMA_LOCATION, Boolean.FALSE); + } + if (schemaLocation != null) + { + String[] values = schemaLocation.split(WHITESPACE_REGEX); + for (int i = 0; i < values.length; i++) + { + xsiSchemaLocationMap.put(null, resolve(values[i])); + } + if (xsiSchemaLocationMap.size() != 0) + { + resource.getDefaultSaveOptions().put( + XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); + } + } + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLHelperImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLHelperImpl.java new file mode 100644 index 0000000000..653665e1b8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLHelperImpl.java @@ -0,0 +1,116 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.helper; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; +import java.io.Writer; + +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLDocument; +import commonj.sdo.helper.XMLHelper; + +/** + * A helper to convert XML documents into DataObects and + * DataObjects into XML documnets. + */ +public class XMLHelperImpl implements XMLHelper +{ + ExtendedMetaData extendedMetaData; + + public XMLHelperImpl(ExtendedMetaData extendedMetaData) + { + this.extendedMetaData = extendedMetaData; + } + + public XMLHelperImpl(TypeHelper typeHelper) + { + this.extendedMetaData = ((TypeHelperImpl)typeHelper).extendedMetaData; + } + + public XMLDocument load(String inputString) + { + try + { + return load(new StringReader(inputString), null, null); + } + catch (IOException e) + { + throw new RuntimeException(e); // should never happen + } + } + + public XMLDocument load(InputStream inputStream) throws IOException + { + return load(inputStream, null, null); + } + + public XMLDocument load(InputStream inputStream, String locationURI, Object options) throws IOException + { + XMLDocumentImpl document = new XMLDocumentImpl(extendedMetaData, options); + document.load(inputStream, locationURI, options); + return document; + } + + public XMLDocument load(Reader inputReader, String locationURI, Object options) throws IOException + { + XMLDocumentImpl document = new XMLDocumentImpl(extendedMetaData, options); + document.load(inputReader, locationURI, options); + return document; + } + + public String save(DataObject dataObject, String rootElementURI, String rootElementName) + { + StringWriter stringWriter = new StringWriter(); + try + { + save(createDocument(dataObject, rootElementURI, rootElementName), stringWriter, null); + return stringWriter.toString(); + } + catch (IOException e) + { + throw new RuntimeException(e); // should never happen + } + } + + public void save(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream) throws IOException + { + save(createDocument(dataObject, rootElementURI, rootElementName), outputStream, null); + } + + public void save(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException + { + ((XMLDocumentImpl)xmlDocument).save(outputStream, options); + } + + public void save(XMLDocument xmlDocument, Writer outputWriter, Object options) throws IOException + { + ((XMLDocumentImpl)xmlDocument).save(outputWriter, options); + } + + public XMLDocument createDocument(DataObject dataObject, String rootElementURI, String rootElementName) + { + return new XMLDocumentImpl(extendedMetaData, dataObject, rootElementURI, rootElementName); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java new file mode 100644 index 0000000000..ace561e28f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java @@ -0,0 +1,55 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.helper; + +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; + +import commonj.sdo.helper.XMLDocument; +import commonj.sdo.DataObject; + +import org.apache.tuscany.sdo.XMLStreamHelper; + +/** + * @version $Rev$ $Date$ + */ +public class XMLStreamHelperImpl implements XMLStreamHelper { + public XMLDocument load(XMLStreamReader reader) throws XMLStreamException, IllegalStateException { + throw new UnsupportedOperationException(); + } + + public void save(XMLDocument document, XMLStreamWriter writer) throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public XMLStreamReader createXMLStreamReader(XMLDocument document) throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public DataObject loadObject(XMLStreamReader reader) throws XMLStreamException, IllegalStateException { + throw new UnsupportedOperationException(); + } + + public void saveObject(DataObject sdo, XMLStreamWriter writer) throws XMLStreamException { + throw new UnsupportedOperationException(); + } + + public XMLStreamReader createXMLStreamReader(DataObject sdo) { + throw new UnsupportedOperationException(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XSDHelperImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XSDHelperImpl.java new file mode 100644 index 0000000000..2194b0c6ce --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XSDHelperImpl.java @@ -0,0 +1,218 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.helper; + + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sdo.impl.DynamicDataObjectImpl; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.ExtendedMetaData; +import org.eclipse.xsd.XSDSchema; +import org.eclipse.xsd.ecore.XSDEcoreBuilder; +import org.eclipse.xsd.util.XSDResourceImpl; +import org.xml.sax.InputSource; + +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XSDHelper; + + +/** + * Provides access to additional information when the + * Type or Property is defined by an XML Schema (XSD). + * Methods return null/false otherwise or if the information is unavailable. + * Defines Types from an XSD. + */ +public class XSDHelperImpl implements XSDHelper +{ + private XSDEcoreBuilder ecoreBuilder; + + private ExtendedMetaData extendedMetaData; + + public XSDHelperImpl(ExtendedMetaData extendedMetaData) + { + this.extendedMetaData = extendedMetaData; + ecoreBuilder = new SDOXSDEcoreBuilder(extendedMetaData); + } + + public XSDHelperImpl(TypeHelper typeHelper) + { + this(((TypeHelperImpl)typeHelper).extendedMetaData); + } + + public String getLocalName(Type type) + { + return extendedMetaData.getName((EClassifier)type); + } + + public String getLocalName(Property property) + { + return extendedMetaData.getName((EStructuralFeature)property); + } + + public String getNamespaceURI(Property property) + { + return extendedMetaData.getNamespace((EStructuralFeature)property); + } + + public boolean isAttribute(Property property) + { + return extendedMetaData.getFeatureKind((EStructuralFeature)property) == ExtendedMetaData.ATTRIBUTE_FEATURE; + } + + public boolean isElement(Property property) + { + return extendedMetaData.getFeatureKind((EStructuralFeature)property) == ExtendedMetaData.ELEMENT_FEATURE; + } + + public boolean isMixed(Type type) + { + if (type instanceof EClass) + { + return extendedMetaData.getContentKind((EClass)type) == ExtendedMetaData.MIXED_CONTENT; + } + else + { + return false; + } + } + + public boolean isXSD(Type type) + { + return ((EModelElement)type).getEAnnotation(ExtendedMetaData.ANNOTATION_URI) != null; + } + + public Property getGlobalProperty(String uri, String propertyName, boolean isElement) + { + if (isElement) + { + return (Property)extendedMetaData.getElement(uri, propertyName); + } + else + { + return (Property)extendedMetaData.getAttribute(uri, propertyName); + } + } + + public String getAppinfo(Type type, String source) + { + return getAppinfo((EModelElement)type, source); + } + + public String getAppinfo(Property property, String source) + { + return getAppinfo((EModelElement)property, source); + } + + protected String getAppinfo(EModelElement eModelElement, String source) + { + return (String)eModelElement.getEAnnotation(source).getDetails().get("appinfo"); + } + + public List /*Type*/define(String xsd) + { + InputStream inputStream = new ByteArrayInputStream(xsd.getBytes()); + return define(inputStream, "*.xsd"); + + } + + public List /*Type*/define(Reader xsdReader, String schemaLocation) + { + + InputSource inputSource = new InputSource(xsdReader); + return define(inputSource, schemaLocation); + + } + + public List /*Type*/define(InputStream xsdInputStream, String schemaLocation) + { + InputSource inputSource = new InputSource(xsdInputStream); + return define(inputSource, schemaLocation); + } + + protected List /*Type*/define(InputSource inputSource, String schemaLocation) + { + try + { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + Resource model = resourceSet.createResource(URI.createURI(schemaLocation != null ? schemaLocation : "null.xsd")); + ((XSDResourceImpl)model).load(inputSource, null); + + List newTypes = new ArrayList(); + for (Iterator schemaIter = model.getContents().iterator(); schemaIter.hasNext(); ) + { + XSDSchema schema = (XSDSchema)schemaIter.next(); + + EPackage ePackage = extendedMetaData.getPackage(schema.getTargetNamespace()); + if (ePackage == null) + { + Collection originalEPackages = new HashSet(ecoreBuilder.getTargetNamespaceToEPackageMap().values()); + ecoreBuilder.generate(schema); + Collection newEPackages = ecoreBuilder.getTargetNamespaceToEPackageMap().values(); + + for (Iterator iter = newEPackages.iterator(); iter.hasNext();) + { + EPackage currentPackage = (EPackage)iter.next(); + if (!originalEPackages.contains(currentPackage)) + { + currentPackage.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl()); + EcoreUtil.freeze(currentPackage); + newTypes.addAll(currentPackage.getEClassifiers()); + } + } + } + } + + return newTypes; + } + catch (Exception e) + { + //e.printStackTrace(); + throw new IllegalArgumentException(e.getMessage()); + } + } + + public String generate(List /*Type*/types) + { + throw new UnsupportedOperationException(); //TODO + } + + public String generate(List /*Type*/types, Map /*String, String*/namespaceToSchemaLocation) + { + throw new UnsupportedOperationException(); //TODO + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AnyTypeDataObjectImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AnyTypeDataObjectImpl.java new file mode 100644 index 0000000000..a1bb922d69 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AnyTypeDataObjectImpl.java @@ -0,0 +1,296 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import org.apache.tuscany.sdo.AnyTypeDataObject; +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.util.BasicSequence; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.util.BasicFeatureMap; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.emf.ecore.xml.type.AnyType; +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; + +/** + * + * An implementation of the model object 'EData Object Any Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.impl.AnyTypeDataObjectImpl#getMixed Mixed}
  • + *
  • {@link org.apache.tuscany.sdo.impl.AnyTypeDataObjectImpl#getAny Any}
  • + *
  • {@link org.apache.tuscany.sdo.impl.AnyTypeDataObjectImpl#getAnyAttribute Any Attribute}
  • + *
+ *

+ * + * @generated + */ +public class AnyTypeDataObjectImpl extends DataObjectImpl implements AnyTypeDataObject +{ + /** + * The cached value of the '{@link #getMixed() Mixed}' attribute list. + * + * + * @see #getMixed() + * @generated + * @ordered + */ + protected FeatureMap mixed = null; + + /** + * The cached value of the '{@link #getAnyAttribute() Any Attribute}' attribute list. + * + * + * @see #getAnyAttribute() + * @generated + * @ordered + */ + protected FeatureMap anyAttribute = null; + + /** + * + * + * @generated + */ + protected AnyTypeDataObjectImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getAnyTypeDataObject(); + } + + /** + * + * + * @generated NOT + */ + public FeatureMap getMixed() + { + if (mixed == null) + { + //mixed = new BasicFeatureMap(this, SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED); + mixed = new BasicSequence(new BasicFeatureMap(this, SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED)).featureMap(); + } + return mixed; + } + + /** + * + * + * @generated NOT + */ + public FeatureMap getAny() + { + //return (FeatureMap)((FeatureMap)getMixed()).list(XMLTypePackage.eINSTANCE.getAnyType_Any()); + return new BasicSequence((FeatureMap.Internal)((FeatureMap)getMixed()).list(XMLTypePackage.eINSTANCE.getAnyType_Any())).featureMap(); + } + + /** + * + * + * @generated NOT + */ + public FeatureMap getAnyAttribute() + { + if (anyAttribute == null) + { + //anyAttribute = new BasicFeatureMap(this, SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE); + anyAttribute = new BasicSequence(new BasicFeatureMap(this, SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE)).featureMap(); + } + return anyAttribute; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) + { + if (featureID >= 0) + { + switch (eDerivedStructuralFeatureID(featureID, baseClass)) + { + case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED: + return ((InternalEList)getMixed()).basicRemove(otherEnd, msgs); + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY: + return ((InternalEList)getAny()).basicRemove(otherEnd, msgs); + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: + return ((InternalEList)getAnyAttribute()).basicRemove(otherEnd, msgs); + default: + return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); + } + } + return eBasicSetContainer(null, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED: + if (coreType) return getMixed(); + return ((FeatureMap.Internal)getMixed()).getWrapper(); + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY: + if (coreType) return getAny(); + return ((FeatureMap.Internal)getAny()).getWrapper(); + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: + if (coreType) return getAnyAttribute(); + return ((FeatureMap.Internal)getAnyAttribute()).getWrapper(); + } + return eDynamicGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED: + ((FeatureMap.Internal)getMixed()).set(newValue); + return; + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY: + ((FeatureMap.Internal)getAny()).set(newValue); + return; + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: + ((FeatureMap.Internal)getAnyAttribute()).set(newValue); + return; + } + eDynamicSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED: + getMixed().clear(); + return; + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY: + getAny().clear(); + return; + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: + getAnyAttribute().clear(); + return; + } + eDynamicUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED: + return mixed != null && !mixed.isEmpty(); + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY: + return !getAny().isEmpty(); + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: + return anyAttribute != null && !anyAttribute.isEmpty(); + } + return eDynamicIsSet(featureID); + } + + /** + * + * + * @generated + */ + public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) + { + if (baseClass == AnyType.class) + { + switch (derivedFeatureID) + { + case SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED: return XMLTypePackage.ANY_TYPE__MIXED; + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY: return XMLTypePackage.ANY_TYPE__ANY; + case SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: return XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * + * + * @generated + */ + public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) + { + if (baseClass == AnyType.class) + { + switch (baseFeatureID) + { + case XMLTypePackage.ANY_TYPE__MIXED: return SDOPackage.ANY_TYPE_DATA_OBJECT__MIXED; + case XMLTypePackage.ANY_TYPE__ANY: return SDOPackage.ANY_TYPE_DATA_OBJECT__ANY; + case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE: return SDOPackage.ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mixed: "); + result.append(mixed); + result.append(", anyAttribute: "); + result.append(anyAttribute); + result.append(')'); + return result.toString(); + } + +} //EDataObjectAnyTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AttributeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AttributeImpl.java new file mode 100644 index 0000000000..b516cea449 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/AttributeImpl.java @@ -0,0 +1,732 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import java.util.List; + +import org.apache.tuscany.sdo.util.BasicSequence; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.EAttributeImpl; +import org.eclipse.emf.ecore.util.FeatureMap; + +import commonj.sdo.Property; +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +/** + * + * An implementation of the model object 'Attribute'. + * + *

+ *

+ * + * @generated + */ +public class AttributeImpl extends EAttributeImpl implements Property, org.apache.tuscany.sdo.model.Property/*, DataObject*/ +{ + /** + * + * + * @generated + */ + protected AttributeImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + protected EClass eStaticClass() + { + return EcorePackage.eINSTANCE.getEAttribute(); + } + + /** + * + * + * @generated NOT + */ + public Object getDefault() + { + return getDefaultValue(); + } + + /** + * + * + * @generated NOT + */ + public boolean isReadOnly() + { + //return "true".equals(EcoreUtil.getAnnotation(this, "commonj.sdo", "readOnly")); + return !isChangeable(); //TODO semantics don't exactly match? + } + + protected List aliasNames = null; + + /** + * + * + * @generated NOT + */ + public List getAliasNames() + { + if (aliasNames == null) + { + aliasNames = DataObjectUtil.getAliasNames(this); + } + return aliasNames; + } + + /** + * + * + * @generated NOT + */ + public Type getType() + { + return (Type)getEType(); + } + + /** + * + * + * @generated NOT + */ + public Type getContainingType() + { + return (Type)getEContainingClass(); + } + + /** + * + * + * @generated NOT + */ + public Property getOpposite() + { + return null; + } + + /** + * + * + * @generated NOT + */ + public boolean isContainment() + { + return false; + } + + protected EStructuralFeature.Internal.SettingDelegate createFeatureMapSettingDelegate() + { + return new InternalSettingDelegateSequence(this); + } + + public static class InternalSettingDelegateSequence extends InternalSettingDelegateMany + { + InternalSettingDelegateSequence(EStructuralFeature feature) + { + super(InternalSettingDelegateMany.FEATURE_MAP, feature); + } + + protected EStructuralFeature.Setting createDynamicSetting(InternalEObject owner) + { + FeatureMap.Internal featureMap = (FeatureMap.Internal)super.createDynamicSetting(owner); + new BasicSequence(featureMap); + return featureMap; + } + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + // org.apache.tuscany.sdo.model.Property methods + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + + public List getAliasName() { + return this.getAliasNames(); + } + + public Sequence getAny() { + throw new UnsupportedOperationException(); + } + + public void unsetContainment() { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSetContainment() { + return false; + } + + public void setMany(boolean value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public void unsetMany() { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSetMany() { + return isMany(); + } + + public void setReadOnly(boolean value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public void unsetReadOnly() { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSetReadOnly() { + return isReadOnly(); + } + + public org.apache.tuscany.sdo.model.Type getType_() { + return (org.apache.tuscany.sdo.model.Type)getType(); + } + + public void setType(org.apache.tuscany.sdo.model.Type value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public Sequence getAnyAttribute() { + throw new UnsupportedOperationException(); + } + + public String getDefault_() { + return (String) this.getDefault(); + } + + public void setDefault_(String value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public org.apache.tuscany.sdo.model.Property getOpposite_() { + return (org.apache.tuscany.sdo.model.Property) getOpposite(); + } + + public void setOpposite_(org.apache.tuscany.sdo.model.Property value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public void setContainment(boolean value) { + throw new UnsupportedOperationException(); + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + // DataObject method implementations + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + /* + public Object get(int propertyIndex) { + return DataObjectUtil.get(this, propertyIndex); + } + + public void set(int propertyIndex, Object value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSet(int propertyIndex) { + return DataObjectUtil.isSet(this, propertyIndex); + } + + public void unset(int propertyIndex) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public Object get(Property property) { + return DataObjectUtil.get(this, ((EStructuralFeature)property).getFeatureID()); + } + + public void set(Property property, Object value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSet(Property property) { + return DataObjectUtil.isSet(this, ((EStructuralFeature)property).getFeatureID()); + } + + public void unset(Property property) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject getContainer() { + return (DataObject)eContainer(); + } + + public Property getContainmentProperty() { + return (Property)eContainmentFeature(); + } + + // Remaining DataObject methods are (will be) implemented as straight delegation to DataObjectUtil + + public Object get(String path) { + return DataObjectUtil.get(this, path); + } + + public void set(String path, Object value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSet(String path) { + return DataObjectUtil.isSet(this, path); + } + + public void unset(String path) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean getBoolean(String path) { + return DataObjectUtil.getBoolean(get(path)); + } + + public byte getByte(String path) { + return DataObjectUtil.getByte(get(path)); + } + + public char getChar(String path) { + return DataObjectUtil.getChar(get(path)); + } + + public double getDouble(String path) { + return DataObjectUtil.getDouble(get(path)); + } + + public float getFloat(String path) { + return DataObjectUtil.getFloat(get(path)); + } + + public int getInt(String path) { + return DataObjectUtil.getInt(get(path)); + } + + public long getLong(String path) { + return DataObjectUtil.getLong(get(path)); + } + + public short getShort(String path) { + return DataObjectUtil.getShort(get(path)); + } + + public byte[] getBytes(String path) { + return DataObjectUtil.getBytes(get(path)); + } + + public BigDecimal getBigDecimal(String path) { + return DataObjectUtil.getBigDecimal(get(path)); + } + + public BigInteger getBigInteger(String path) { + return DataObjectUtil.getBigInteger(get(path)); + } + + public DataObject getDataObject(String path) { + return (DataObject)get(path); + } + + public Date getDate(String path) { + return DataObjectUtil.getDate(get(path)); + } + + public String getString(String path) { + return DataObjectUtil.getString(get(path)); + } + + public List getList(String path) { + return (List)get(path); + } + + public Sequence getSequence(String path) { + return (Sequence)get(path); + } + + public void setBoolean(String path, boolean value) { + set(path, new Boolean(value)); + } + + public void setByte(String path, byte value) { + set(path, new Byte(value)); + } + + public void setChar(String path, char value) { + set(path, new Character(value)); + } + + public void setDouble(String path, double value) { + set(path, new Double(value)); + } + + public void setFloat(String path, float value) { + set(path, new Float(value)); + } + + public void setInt(String path, int value) { + set(path, new Integer(value)); + } + + public void setLong(String path, long value) { + set(path, new Long(value)); + } + + public void setShort(String path, short value) { + set(path, new Short(value)); + } + + public void setBytes(String path, byte[] value) { + set(path, value); + } + + public void setBigDecimal(String path, BigDecimal value) { + set(path, value); + } + + public void setBigInteger(String path, BigInteger value) { + set(path, value); + } + + public void setDataObject(String path, DataObject value) { + set(path, value); + } + + public void setDate(String path, Date value) { + set(path, value); + } + + public void setString(String path, String value) { + set(path, value); + } + + public void setList(String path, List value) { + set(path, value); + } + + public boolean getBoolean(int propertyIndex) { + return DataObjectUtil.getBoolean(this, propertyIndex); + } + + public byte getByte(int propertyIndex) { + return DataObjectUtil.getByte(this, propertyIndex); + } + + public char getChar(int propertyIndex) { + return DataObjectUtil.getChar(this, propertyIndex); + } + + public double getDouble(int propertyIndex) { + return DataObjectUtil.getDouble(this, propertyIndex); + } + + public float getFloat(int propertyIndex) { + return DataObjectUtil.getFloat(this, propertyIndex); + } + + public int getInt(int propertyIndex) { + return DataObjectUtil.getInt(this, propertyIndex); + } + + public long getLong(int propertyIndex) { + return DataObjectUtil.getLong(this, propertyIndex); + } + + public short getShort(int propertyIndex) { + return DataObjectUtil.getShort(this, propertyIndex); + } + + public byte[] getBytes(int propertyIndex) { + return DataObjectUtil.getBytes(this, propertyIndex); + } + + public BigDecimal getBigDecimal(int propertyIndex) { + return DataObjectUtil.getBigDecimal(this, propertyIndex); + } + + public BigInteger getBigInteger(int propertyIndex) { + return DataObjectUtil.getBigInteger(this, propertyIndex); + } + + public DataObject getDataObject(int propertyIndex) { + return DataObjectUtil.getDataObject(this, propertyIndex); + } + + public Date getDate(int propertyIndex) { + return DataObjectUtil.getDate(this, propertyIndex); + } + + public String getString(int propertyIndex) { + return DataObjectUtil.getString(this, propertyIndex); + } + + public List getList(int propertyIndex) { + return DataObjectUtil.getList(this, propertyIndex); + } + + public Sequence getSequence(int propertyIndex) { + return DataObjectUtil.getSequence(this, propertyIndex); + } + + public void setBoolean(int propertyIndex, boolean value) { + set(propertyIndex, new Boolean(value)); + } + + public void setByte(int propertyIndex, byte value) { + set(propertyIndex, new Byte(value)); + } + + public void setChar(int propertyIndex, char value) { + set(propertyIndex, new Character(value)); + } + + public void setDouble(int propertyIndex, double value) { + set(propertyIndex, new Double(value)); + } + + public void setFloat(int propertyIndex, float value) { + set(propertyIndex, new Float(value)); + } + + public void setInt(int propertyIndex, int value) { + set(propertyIndex, new Integer(value)); + } + + public void setLong(int propertyIndex, long value) { + set(propertyIndex, new Long(value)); + } + + public void setShort(int propertyIndex, short value) { + set(propertyIndex, new Short(value)); + } + + public void setBytes(int propertyIndex, byte[] value) { + set(propertyIndex, value); + } + + public void setBigDecimal(int propertyIndex, BigDecimal value) { + set(propertyIndex, value); + } + + public void setBigInteger(int propertyIndex, BigInteger value) { + set(propertyIndex, value); + } + + public void setDataObject(int propertyIndex, DataObject value) { + set(propertyIndex, value); + } + + public void setDate(int propertyIndex, Date value) { + set(propertyIndex, value); + } + + public void setString(int propertyIndex, String value) { + set(propertyIndex, value); + } + + public void setList(int propertyIndex, List value) { + set(propertyIndex, value); + } + + public boolean getBoolean(Property property) { + return DataObjectUtil.getBoolean(this, property); + } + + public byte getByte(Property property) { + return DataObjectUtil.getByte(this, property); + } + + public char getChar(Property property) { + return DataObjectUtil.getChar(this, property); + } + + public double getDouble(Property property) { + return DataObjectUtil.getDouble(this, property); + } + + public float getFloat(Property property) { + return DataObjectUtil.getFloat(this, property); + } + + public int getInt(Property property) { + return DataObjectUtil.getInt(this, property); + } + + public long getLong(Property property) { + return DataObjectUtil.getLong(this, property); + } + + public short getShort(Property property) { + return DataObjectUtil.getShort(this, property); + } + + public byte[] getBytes(Property property) { + return DataObjectUtil.getBytes(this, property); + } + + public BigDecimal getBigDecimal(Property property) { + return DataObjectUtil.getBigDecimal(this, property); + } + + public BigInteger getBigInteger(Property property) { + return DataObjectUtil.getBigInteger(this, property); + } + + public DataObject getDataObject(Property property) { + return DataObjectUtil.getDataObject(this, property); + } + + public Date getDate(Property property) { + return DataObjectUtil.getDate(this, property); + } + + public String getString(Property property) { + return DataObjectUtil.getString(this, property); + } + + public List getList(Property property) { + return DataObjectUtil.getList(this, property); + } + + public Sequence getSequence(Property property) { + return DataObjectUtil.getSequence(this, property); + } + + public void setBoolean(Property property, boolean value) { + set(property, new Boolean(value)); + } + + public void setByte(Property property, byte value) { + set(property, new Byte(value)); + } + + public void setChar(Property property, char value) { + set(property, new Character(value)); + } + + public void setDouble(Property property, double value) { + set(property, new Double(value)); + } + + public void setFloat(Property property, float value) { + set(property, new Float(value)); + } + + public void setInt(Property property, int value) { + set(property, new Integer(value)); + } + + public void setLong(Property property, long value) { + set(property, new Long(value)); + } + + public void setShort(Property property, short value) { + set(property, new Short(value)); + } + + public void setBytes(Property property, byte[] value) { + set(property, value); + } + + public void setBigDecimal(Property property, BigDecimal value) { + set(property, value); + } + + public void setBigInteger(Property property, BigInteger value) { + set(property, value); + } + + public void setDataObject(Property property, DataObject value) { + set(property, value); + } + + public void setDate(Property property, Date value) { + set(property, value); + } + + public void setString(Property property, String value) { + set(property, value); + } + + public void setList(Property property, List value) { + set(property, value); + } + + public DataObject createDataObject(String propertyName) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject createDataObject(int propertyIndex) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject createDataObject(Property property) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject createDataObject(String propertyName, String namespaceURI, String typeName) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject createDataObject(Property property, Type type) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public void delete() { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataGraph getDataGraph() { + return DataObjectUtil.getDataGraph(this); + } + + public Sequence getSequence() { + EAttribute mixedFeature = BasicExtendedMetaData.INSTANCE.getMixedFeature(eClass()); + return mixedFeature != null ? (Sequence)eGet(mixedFeature, true, false) : null; + } + + public List getInstanceProperties() { + return DataObjectUtil.getInstanceProperties(this); + } + + public DataObject getRootObject() { + return DataObjectUtil.getRootObject(this); + } + + public ChangeSummary getChangeSummary() { + // TODO: implement this method + throw new UnsupportedOperationException(); + } + + public void detach() { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + //DataObjectUtil.detach(this); + } + + public Property getProperty(String propertyName) { + return DataObjectUtil.getProperty(this, propertyName); + } + */ + +} //AttributeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java new file mode 100644 index 0000000000..5460257079 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummaryImpl.java @@ -0,0 +1,679 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + + +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.sdo.SDOFactory; +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.util.BasicSequence; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.UniqueEList; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.change.ChangeDescription; +import org.eclipse.emf.ecore.change.FeatureChange; +import org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl; +import org.eclipse.emf.ecore.change.util.ChangeRecorder; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.DelegatingFeatureMap; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.FeatureMapUtil; +import org.eclipse.emf.ecore.util.InternalEList; + +import commonj.sdo.ChangeSummary; +//import commonj.sdo.ChangeSummary.Setting; + +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Sequence; + + +/** + * + * An implementation of the model object 'EChange Summary'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.impl.ChangeSummaryImpl#getEDataGraph EData Graph}
  • + *
+ *

+ * + * @generated + */ +public class ChangeSummaryImpl extends ChangeDescriptionImpl implements ChangeSummary +{ + /** + * The cached value of the '{@link #getEDataGraph() EData Graph}' reference. + * + * + * @see #getEDataGraph() + * @generated + * @ordered + */ + protected DataGraph eDataGraph = null; + + protected ChangeRecorder changeRecorder = null; + protected EList cachedObjectsToDetach = null; + protected HashMap cachedSDOObjectChanges = new HashMap(); + + /** + * + * + * @generated + */ + protected ChangeSummaryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getChangeSummary(); + } + + /** + * + * + * @generated NOT + */ + public boolean isLogging() + { + return changeRecorder != null; + } + + /** + * + * + * @generated + */ + public DataGraph getEDataGraph() + { + return eDataGraph; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetEDataGraph(DataGraph newEDataGraph, NotificationChain msgs) + { + DataGraph oldEDataGraph = eDataGraph; + eDataGraph = newEDataGraph; + if (eNotificationRequired()) + { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, oldEDataGraph, newEDataGraph); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setEDataGraph(DataGraph newEDataGraph) + { + if (newEDataGraph != eDataGraph) + { + NotificationChain msgs = null; + if (eDataGraph != null) + msgs = ((InternalEObject)eDataGraph).eInverseRemove(this, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, DataGraph.class, msgs); + if (newEDataGraph != null) + msgs = ((InternalEObject)newEDataGraph).eInverseAdd(this, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, DataGraph.class, msgs); + msgs = basicSetEDataGraph(newEDataGraph, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, newEDataGraph, newEDataGraph)); + } + + /** + * + * + * @generated NOT + */ + public void beginLogging() + { + if (isLogging()) + { + throw new IllegalStateException("Already logging"); + } + + getObjectsToAttach().clear(); + getObjectChanges().clear(); + getResourceChanges().clear(); + + oldContainmentInformation = null; + changeRecorder = new SDOChangeRecorder(); + changeRecorder.beginRecording(Collections.singleton(((DataGraphImpl)getEDataGraph()).getRootResource())); +// if (eNotificationRequired()) +// eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, false, true)); + } + + /** + * + * + * @generated NOT + */ + public void resumeLogging() + { + if (isLogging()) + { + throw new IllegalStateException("Already logging"); + } + + oldContainmentInformation = null; + + changeRecorder = new SDOChangeRecorder(); + changeRecorder.beginRecording(this, Collections.singleton(((DataGraphImpl)getEDataGraph()).getRootResource())); + +// if (eNotificationRequired()) +// eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, false, true)); + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) + { + if (featureID >= 0) + { + switch (eDerivedStructuralFeatureID(featureID, baseClass)) + { + case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH: + if (eDataGraph != null) + msgs = ((InternalEObject)eDataGraph).eInverseRemove(this, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, DataGraph.class, msgs); + return basicSetEDataGraph((DataGraph)otherEnd, msgs); + default: + return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); + } + } + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return eBasicSetContainer(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) + { + if (featureID >= 0) + { + switch (eDerivedStructuralFeatureID(featureID, baseClass)) + { + case SDOPackage.CHANGE_SUMMARY__OBJECT_CHANGES: + return ((InternalEList)getObjectChanges()).basicRemove(otherEnd, msgs); + case SDOPackage.CHANGE_SUMMARY__OBJECTS_TO_ATTACH: + return ((InternalEList)getObjectsToAttach()).basicRemove(otherEnd, msgs); + case SDOPackage.CHANGE_SUMMARY__RESOURCE_CHANGES: + return ((InternalEList)getResourceChanges()).basicRemove(otherEnd, msgs); + case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH: + return basicSetEDataGraph(null, msgs); + default: + return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); + } + } + return eBasicSetContainer(null, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case SDOPackage.CHANGE_SUMMARY__OBJECT_CHANGES: + if (coreType) return getObjectChanges(); + else return getObjectChanges().map(); + case SDOPackage.CHANGE_SUMMARY__OBJECTS_TO_DETACH: + return getObjectsToDetach(); + case SDOPackage.CHANGE_SUMMARY__OBJECTS_TO_ATTACH: + return getObjectsToAttach(); + case SDOPackage.CHANGE_SUMMARY__RESOURCE_CHANGES: + return getResourceChanges(); + case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH: + return getEDataGraph(); + } + return eDynamicGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case SDOPackage.CHANGE_SUMMARY__OBJECT_CHANGES: + ((EStructuralFeature.Setting)getObjectChanges()).set(newValue); + return; + case SDOPackage.CHANGE_SUMMARY__OBJECTS_TO_DETACH: + getObjectsToDetach().clear(); + getObjectsToDetach().addAll((Collection)newValue); + return; + case SDOPackage.CHANGE_SUMMARY__OBJECTS_TO_ATTACH: + getObjectsToAttach().clear(); + getObjectsToAttach().addAll((Collection)newValue); + return; + case SDOPackage.CHANGE_SUMMARY__RESOURCE_CHANGES: + getResourceChanges().clear(); + getResourceChanges().addAll((Collection)newValue); + return; + case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH: + setEDataGraph((DataGraph)newValue); + return; + } + eDynamicSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case SDOPackage.CHANGE_SUMMARY__OBJECT_CHANGES: + getObjectChanges().clear(); + return; + case SDOPackage.CHANGE_SUMMARY__OBJECTS_TO_DETACH: + getObjectsToDetach().clear(); + return; + case SDOPackage.CHANGE_SUMMARY__OBJECTS_TO_ATTACH: + getObjectsToAttach().clear(); + return; + case SDOPackage.CHANGE_SUMMARY__RESOURCE_CHANGES: + getResourceChanges().clear(); + return; + case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH: + setEDataGraph((DataGraph)null); + return; + } + eDynamicUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case SDOPackage.CHANGE_SUMMARY__OBJECT_CHANGES: + return objectChanges != null && !objectChanges.isEmpty(); + case SDOPackage.CHANGE_SUMMARY__OBJECTS_TO_DETACH: + return objectsToDetach != null && !objectsToDetach.isEmpty(); + case SDOPackage.CHANGE_SUMMARY__OBJECTS_TO_ATTACH: + return objectsToAttach != null && !objectsToAttach.isEmpty(); + case SDOPackage.CHANGE_SUMMARY__RESOURCE_CHANGES: + return resourceChanges != null && !resourceChanges.isEmpty(); + case SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH: + return eDataGraph != null; + } + return eDynamicIsSet(featureID); + } + + protected class SDOChangeRecorder extends ChangeRecorder + { + public SDOChangeRecorder() + { + super(); + } + + public void beginRecording(ChangeDescription changeDescription, Collection rootObjects) + { + deletedObjects = null; + cachedObjectsToDetach = null; + cachedSDOObjectChanges.clear(); + super.beginRecording(changeDescription, rootObjects); + } + + protected ChangeDescription createChangeDescription() + { + return ChangeSummaryImpl.this; + } + + protected FeatureChange createFeatureChange(EObject eObject, EStructuralFeature eStructuralFeature, Object value, boolean isSet) + { + Property property = (Property)eStructuralFeature; + if (property.isReadOnly()) + { + if (((DataObject)eObject).getDataGraph() != null) + { + throw + new IllegalStateException + ("The property '" + property.getName() + "' of type '" + + property.getContainingType().getName() + "' is read only"); + } + } + return (FeatureChange)SDOFactory.eINSTANCE.createChangeSummarySetting(eStructuralFeature, value, isSet); + } + + protected void consolidateChanges() + { + deletedObjects = null; + cachedObjectsToDetach = null; + cachedSDOObjectChanges.clear(); + super.consolidateChanges(); + } + + protected void addAdapter(Notifier notifier) + { + if (notifier instanceof DataObjectImpl) + ((DataObjectImpl)notifier).setChangeRecorder(this); + else + super.addAdapter(notifier); + } + + protected void removeAdapter(Notifier notifier) + { + if (notifier instanceof DataObjectImpl) + ((DataObjectImpl)notifier).setChangeRecorder(null); + else + super.removeAdapter(notifier); + } + + } + + /** + * + * + * @generated NOT + */ + public void endLogging() + { + if (!isLogging()) + { + throw new IllegalStateException("Not currently logging"); + } + + changeRecorder.endRecording(); + changeRecorder.dispose(); + changeRecorder = null; +// if (eNotificationRequired()) +// eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.ECHANGE_SUMMARY__LOGGING, true, false)); + } + + /** + * + * + * @generated NOT + */ + public boolean isCreated(DataObject dataObject) + { + return getObjectsToDetach().contains(dataObject); + } + + /** + * + * + * @generated NOT + */ + public boolean isDeleted(DataObject dataObject) + { + return getDeletedObjects().contains(dataObject); + } + + /** + * + * + * @generated NOT + */ + public List getOldValues(DataObject dataObject) + { + List sdoSettings = (List)cachedSDOObjectChanges.get(dataObject); + if (sdoSettings != null) + { + return sdoSettings; + } + + List settings = (List)getObjectChanges().get(dataObject); + if (settings == null) + { + settings = Collections.EMPTY_LIST; + } + else + { + for (int i = 0; i < settings.size(); i++) + { + FeatureChange change = (FeatureChange)settings.get(i); + EStructuralFeature feature = change.getFeature(); + if (FeatureMapUtil.isFeatureMap(feature)) + { + final List values = (List)change.getValue(); + if (sdoSettings == null) + { + sdoSettings = new BasicEList(settings); + } + DelegatingFeatureMap featureMap = new DelegatingFeatureMap(((InternalEObject)dataObject), feature) + { + protected final List theList = values; + + protected List delegateList() + { + return theList; + } + }; + + // create new settings and replace the setting for mixed feature + sdoSettings.set(i, SDOFactory.eINSTANCE.createChangeSummarySetting(feature, new BasicSequence(featureMap), change.isSet())); + // add all derived features + for (int k = 0; k < featureMap.size(); k++) + { + EStructuralFeature f = featureMap.getEStructuralFeature(k); + sdoSettings.add(SDOFactory.eINSTANCE.createChangeSummarySetting(f, featureMap.get(f, false), true)); + } + } + } + } + sdoSettings = (sdoSettings != null) ? sdoSettings : settings; + cachedSDOObjectChanges.put(dataObject, sdoSettings); + return sdoSettings; + } + + /** + * + * + * @generated NOT + */ + public boolean isModified(DataObject dataObject) + { + return getObjectChanges().containsKey(dataObject) && !isDeleted(dataObject) && !isCreated(dataObject); + } + + /** + * + * + * @generated NOT + */ + public void summarize() + { + if (!isLogging()) + { + throw new IllegalStateException("Not currently logging"); + } + + changeRecorder.summarize(); + } + + public Setting getOldValue(DataObject dataObject, Property property) + { + for (Iterator i = getOldValues(dataObject).iterator(); i.hasNext(); ) + { + Setting setting = (Setting)i.next(); + if (setting.getProperty() == property) + { + return setting; + } + } + + return null; + } + + public DataObject getOldContainer(DataObject dataObject) + { + return (DataObject)getOldContainer((EObject)dataObject); + } + + public Property getOldContainmentProperty(DataObject dataObject) + { + return (Property)getOldContainmentFeature((EObject)dataObject); + } + + /** + * + * + * @generated NOT + */ + public Sequence getOldSequence(DataObject dataObject) + { + EAttribute mixedFeature = BasicExtendedMetaData.INSTANCE.getMixedFeature((EClass)dataObject.getType()); + if (mixedFeature != null) + { + return (Sequence)getOldValue(dataObject, (Property)mixedFeature).getValue(); + } + return null; + } + + /** + * + * + * @generated NOT + */ + public void undoChanges() + { + if (isLogging()) + { + changeRecorder.summarize(); + } + apply(); + } + + public EList getObjectsToDetach() + { + if (cachedObjectsToDetach == null) + { + cachedObjectsToDetach = super.getObjectsToDetach(); + } + return cachedObjectsToDetach; + } + + /** + * + * + * @generated NOT + */ + public DataGraph getDataGraph() + { + return getEDataGraph(); + } + + protected Set deletedObjects; + + protected void preApply(boolean reverse) + { + super.preApply(reverse); + deletedObjects = null; + } + + protected Set getDeletedObjects() + { + if (deletedObjects == null) + { + deletedObjects = new HashSet(); + for (Iterator i = EcoreUtil.getAllContents(getObjectsToAttach()); i.hasNext(); ) + { + deletedObjects.add(i.next()); + } + } + return deletedObjects; + } + + /** + * + * + * @generated NOT + */ + public List getChangedDataObjects() + { + EList result = new UniqueEList.FastCompare(getDeletedObjects()); + result.addAll(getObjectsToDetach()); + for (Iterator i = getObjectChanges().iterator(); i.hasNext(); ) + { + Map.Entry entry = (Map.Entry)i.next(); + result.add(entry.getKey()); + } + return result; + } + + /** + * + * + * @generated NOT + */ + public DataObject getRootObject() + { + DataGraph dataGraph = getDataGraph(); + if (dataGraph != null) + { + return dataGraph.getRootObject(); + } + // TODO: handle ChangeSummary-type property + return null; + } + +} //EChangeSummaryImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummarySettingImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummarySettingImpl.java new file mode 100644 index 0000000000..9f714b9cfa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ChangeSummarySettingImpl.java @@ -0,0 +1,110 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + + +import java.util.Map; + +import org.apache.tuscany.sdo.SDOPackage; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.change.impl.FeatureChangeImpl; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.Property; +/** + * + * An implementation of the model object 'EChange Summary Setting'. + * + *

+ *

+ * + * @generated + */ +public class ChangeSummarySettingImpl extends FeatureChangeImpl implements ChangeSummary.Setting +{ + /** + * + * + * @generated + */ + protected ChangeSummarySettingImpl() + { + super(); + } + + protected ChangeSummarySettingImpl(EStructuralFeature feature, Object value, boolean isSet) + { + super(feature, value, isSet); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getChangeSummarySetting(); + } + + /** + * + * + * @generated NOT + */ + public Object getValue() + { + EStructuralFeature feature = getFeature(); + if (feature.isMany()) + { + if (value == null) + { + EObject eObject = (EObject)((Map.Entry)eContainer()).getKey(); + value = getListValue((EList)eObject.eGet(feature)); + } + return value; + } + else + { + return super.getValue(); + } + } + + /** + * + * + * @generated NOT + */ + public Property getProperty() + { + return (Property)getFeature(); + } + + /** + * + * + * @generated NOT + */ + public boolean isSet() + { + return super.isSet(); + } + +} //EChangeSummarySettingImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java new file mode 100644 index 0000000000..eca552a78d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ClassImpl.java @@ -0,0 +1,773 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EClassImpl; +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +import commonj.sdo.Property; +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +/** + * + * An implementation of the model object 'Class'. + * + *

+ *

+ * + * @generated + */ +public class ClassImpl extends EClassImpl implements Type, org.apache.tuscany.sdo.model.Type/*, DataObject*/ +{ + /** + * + * + * @generated + */ + protected ClassImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + protected EClass eStaticClass() + { + return EcorePackage.eINSTANCE.getEClass(); + } + + /** + * + * + * @generated NOT + */ + public String getURI() + { + return getEPackage().getNsURI(); + } + + /** + * + * + * @generated NOT + */ + public boolean isDataType() + { + return false; + } + + /** + * + * + * @generated NOT + */ + public boolean isOpen() + { + for (int i = 0, count = getFeatureCount(); i < count; ++i) + { + EStructuralFeature eStructuralFeature = getEStructuralFeature(i); + switch (ExtendedMetaData.INSTANCE.getFeatureKind(eStructuralFeature)) + { + case ExtendedMetaData.ELEMENT_WILDCARD_FEATURE: + if (eStructuralFeature == ExtendedMetaData.INSTANCE.getMixedFeature(this)) break; + case ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE: + case ExtendedMetaData.GROUP_FEATURE: + return true; + } + } + return false; + } + + /** + * + * + * @generated NOT + */ + public boolean isSequenced() + { + // isSequenced == isMixed + return ExtendedMetaData.INSTANCE.getMixedFeature(this) != null; + } + + protected List aliasNames = null; + + /** + * + * + * @generated NOT + */ + public List getAliasNames() + { + if (aliasNames == null) + { + aliasNames = DataObjectUtil.getAliasNames(this); + } + return aliasNames; + } + + /** + * + * + * @generated NOT + */ + public List getDeclaredProperties() + { + return getEStructuralFeatures(); + } + + /** + * + * + * @generated NOT + */ + public List getProperties() + { + return getEAllStructuralFeatures(); + } + + /** + * + * + * @generated NOT + */ + public List getBaseTypes() + { + return getESuperTypes(); + } + + private void initAliasNames() { + if (propertyNameToPropertyMap == null) //FB use eNameToFeatureMap for this? + { + Map result = new HashMap(); + for (Iterator i = getProperties().iterator(); i.hasNext(); ) + { + Property property = (Property)i.next(); + result.put(property.getName(), property); + + List aliasNames = property.getAliasNames(); + for (int count = aliasNames.size(); count > 0; ) + { + result.put(aliasNames.get(--count), property); + } + } + propertyNameToPropertyMap = result; + } + } + + /** + * + * + * @generated NOT + */ + public Property getProperty(String propertyName) + { + initAliasNames(); + Property property = (Property)propertyNameToPropertyMap.get(propertyName); + if (property == null && !isOpen()) { + propertyNameToPropertyMap = null; + initAliasNames(); + property = (Property)propertyNameToPropertyMap.get(propertyName); + } + return property; + } + + protected Map propertyNameToPropertyMap; + + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + // org.apache.tuscany.sdo.model.Type method implementations + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + + public List getBaseType() { + return this.getBaseTypes(); + } + + public List getProperty() { + return this.getProperties(); + } + + public List getAliasName() { + return this.getAliasNames(); + } + + public void unsetAbstract() { + eUnset(EcorePackage.eINSTANCE.getEClass_Abstract()); + } + + public boolean isSetAbstract() { + return eIsSet(EcorePackage.eINSTANCE.getEClass_Abstract()); + } + + public Sequence getAny() { + throw new UnsupportedOperationException(); + } + + public Sequence getAnyAttribute() { + throw new UnsupportedOperationException(); + } + + public void setDataType(boolean value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public void unsetDataType() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSetDataType() { + return false; + } + + public void setOpen(boolean value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public void unsetOpen() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSetOpen() { + return isOpen(); + } + + public void setSequenced(boolean value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public void unsetSequenced() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSetSequenced() { + return isSequenced(); + } + + public void setUri(String value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public String getUri() { + return getURI(); + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + // DataObject method implementations + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + /* + public Object get(int propertyIndex) { + return DataObjectUtil.get(this, propertyIndex); + } + + public void set(int propertyIndex, Object value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSet(int propertyIndex) { + return DataObjectUtil.isSet(this, propertyIndex); + } + + public void unset(int propertyIndex) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public Object get(Property property) { + return DataObjectUtil.get(this, ((EStructuralFeature)property).getFeatureID()); + } + + public void set(Property property, Object value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSet(Property property) { + return DataObjectUtil.isSet(this, ((EStructuralFeature)property).getFeatureID()); + } + + public void unset(Property property) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject getContainer() { + return (DataObject)eContainer(); + } + + public Property getContainmentProperty() { + return (Property)eContainmentFeature(); + } + + public Type getType() { + return (Type)ModelPackageImpl.eINSTANCE.getType(); + } + + // Remaining DataObject methods are (will be) implemented as straight delegation to DataObjectUtil + + public Object get(String path) { + return DataObjectUtil.get(this, path); + } + + public void set(String path, Object value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSet(String path) { + return DataObjectUtil.isSet(this, path); + } + + public void unset(String path) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean getBoolean(String path) { + return DataObjectUtil.getBoolean(get(path)); + } + + public byte getByte(String path) { + return DataObjectUtil.getByte(get(path)); + } + + public char getChar(String path) { + return DataObjectUtil.getChar(get(path)); + } + + public double getDouble(String path) { + return DataObjectUtil.getDouble(get(path)); + } + + public float getFloat(String path) { + return DataObjectUtil.getFloat(get(path)); + } + + public int getInt(String path) { + return DataObjectUtil.getInt(get(path)); + } + + public long getLong(String path) { + return DataObjectUtil.getLong(get(path)); + } + + public short getShort(String path) { + return DataObjectUtil.getShort(get(path)); + } + + public byte[] getBytes(String path) { + return DataObjectUtil.getBytes(get(path)); + } + + public BigDecimal getBigDecimal(String path) { + return DataObjectUtil.getBigDecimal(get(path)); + } + + public BigInteger getBigInteger(String path) { + return DataObjectUtil.getBigInteger(get(path)); + } + + public DataObject getDataObject(String path) { + return (DataObject)get(path); + } + + public Date getDate(String path) { + return DataObjectUtil.getDate(get(path)); + } + + public String getString(String path) { + return DataObjectUtil.getString(get(path)); + } + + public List getList(String path) { + return (List)get(path); + } + + public Sequence getSequence(String path) { + return (Sequence)get(path); + } + + public void setBoolean(String path, boolean value) { + set(path, new Boolean(value)); + } + + public void setByte(String path, byte value) { + set(path, new Byte(value)); + } + + public void setChar(String path, char value) { + set(path, new Character(value)); + } + + public void setDouble(String path, double value) { + set(path, new Double(value)); + } + + public void setFloat(String path, float value) { + set(path, new Float(value)); + } + + public void setInt(String path, int value) { + set(path, new Integer(value)); + } + + public void setLong(String path, long value) { + set(path, new Long(value)); + } + + public void setShort(String path, short value) { + set(path, new Short(value)); + } + + public void setBytes(String path, byte[] value) { + set(path, value); + } + + public void setBigDecimal(String path, BigDecimal value) { + set(path, value); + } + + public void setBigInteger(String path, BigInteger value) { + set(path, value); + } + + public void setDataObject(String path, DataObject value) { + set(path, value); + } + + public void setDate(String path, Date value) { + set(path, value); + } + + public void setString(String path, String value) { + set(path, value); + } + + public void setList(String path, List value) { + set(path, value); + } + + public boolean getBoolean(int propertyIndex) { + return DataObjectUtil.getBoolean(this, propertyIndex); + } + + public byte getByte(int propertyIndex) { + return DataObjectUtil.getByte(this, propertyIndex); + } + + public char getChar(int propertyIndex) { + return DataObjectUtil.getChar(this, propertyIndex); + } + + public double getDouble(int propertyIndex) { + return DataObjectUtil.getDouble(this, propertyIndex); + } + + public float getFloat(int propertyIndex) { + return DataObjectUtil.getFloat(this, propertyIndex); + } + + public int getInt(int propertyIndex) { + return DataObjectUtil.getInt(this, propertyIndex); + } + + public long getLong(int propertyIndex) { + return DataObjectUtil.getLong(this, propertyIndex); + } + + public short getShort(int propertyIndex) { + return DataObjectUtil.getShort(this, propertyIndex); + } + + public byte[] getBytes(int propertyIndex) { + return DataObjectUtil.getBytes(this, propertyIndex); + } + + public BigDecimal getBigDecimal(int propertyIndex) { + return DataObjectUtil.getBigDecimal(this, propertyIndex); + } + + public BigInteger getBigInteger(int propertyIndex) { + return DataObjectUtil.getBigInteger(this, propertyIndex); + } + + public DataObject getDataObject(int propertyIndex) { + return DataObjectUtil.getDataObject(this, propertyIndex); + } + + public Date getDate(int propertyIndex) { + return DataObjectUtil.getDate(this, propertyIndex); + } + + public String getString(int propertyIndex) { + return DataObjectUtil.getString(this, propertyIndex); + } + + public List getList(int propertyIndex) { + return DataObjectUtil.getList(this, propertyIndex); + } + + public Sequence getSequence(int propertyIndex) { + return DataObjectUtil.getSequence(this, propertyIndex); + } + + public void setBoolean(int propertyIndex, boolean value) { + set(propertyIndex, new Boolean(value)); + } + + public void setByte(int propertyIndex, byte value) { + set(propertyIndex, new Byte(value)); + } + + public void setChar(int propertyIndex, char value) { + set(propertyIndex, new Character(value)); + } + + public void setDouble(int propertyIndex, double value) { + set(propertyIndex, new Double(value)); + } + + public void setFloat(int propertyIndex, float value) { + set(propertyIndex, new Float(value)); + } + + public void setInt(int propertyIndex, int value) { + set(propertyIndex, new Integer(value)); + } + + public void setLong(int propertyIndex, long value) { + set(propertyIndex, new Long(value)); + } + + public void setShort(int propertyIndex, short value) { + set(propertyIndex, new Short(value)); + } + + public void setBytes(int propertyIndex, byte[] value) { + set(propertyIndex, value); + } + + public void setBigDecimal(int propertyIndex, BigDecimal value) { + set(propertyIndex, value); + } + + public void setBigInteger(int propertyIndex, BigInteger value) { + set(propertyIndex, value); + } + + public void setDataObject(int propertyIndex, DataObject value) { + set(propertyIndex, value); + } + + public void setDate(int propertyIndex, Date value) { + set(propertyIndex, value); + } + + public void setString(int propertyIndex, String value) { + set(propertyIndex, value); + } + + public void setList(int propertyIndex, List value) { + set(propertyIndex, value); + } + + public boolean getBoolean(Property property) { + return DataObjectUtil.getBoolean(this, property); + } + + public byte getByte(Property property) { + return DataObjectUtil.getByte(this, property); + } + + public char getChar(Property property) { + return DataObjectUtil.getChar(this, property); + } + + public double getDouble(Property property) { + return DataObjectUtil.getDouble(this, property); + } + + public float getFloat(Property property) { + return DataObjectUtil.getFloat(this, property); + } + + public int getInt(Property property) { + return DataObjectUtil.getInt(this, property); + } + + public long getLong(Property property) { + return DataObjectUtil.getLong(this, property); + } + + public short getShort(Property property) { + return DataObjectUtil.getShort(this, property); + } + + public byte[] getBytes(Property property) { + return DataObjectUtil.getBytes(this, property); + } + + public BigDecimal getBigDecimal(Property property) { + return DataObjectUtil.getBigDecimal(this, property); + } + + public BigInteger getBigInteger(Property property) { + return DataObjectUtil.getBigInteger(this, property); + } + + public DataObject getDataObject(Property property) { + return DataObjectUtil.getDataObject(this, property); + } + + public Date getDate(Property property) { + return DataObjectUtil.getDate(this, property); + } + + public String getString(Property property) { + return DataObjectUtil.getString(this, property); + } + + public List getList(Property property) { + return DataObjectUtil.getList(this, property); + } + + public Sequence getSequence(Property property) { + return DataObjectUtil.getSequence(this, property); + } + + public void setBoolean(Property property, boolean value) { + set(property, new Boolean(value)); + } + + public void setByte(Property property, byte value) { + set(property, new Byte(value)); + } + + public void setChar(Property property, char value) { + set(property, new Character(value)); + } + + public void setDouble(Property property, double value) { + set(property, new Double(value)); + } + + public void setFloat(Property property, float value) { + set(property, new Float(value)); + } + + public void setInt(Property property, int value) { + set(property, new Integer(value)); + } + + public void setLong(Property property, long value) { + set(property, new Long(value)); + } + + public void setShort(Property property, short value) { + set(property, new Short(value)); + } + + public void setBytes(Property property, byte[] value) { + set(property, value); + } + + public void setBigDecimal(Property property, BigDecimal value) { + set(property, value); + } + + public void setBigInteger(Property property, BigInteger value) { + set(property, value); + } + + public void setDataObject(Property property, DataObject value) { + set(property, value); + } + + public void setDate(Property property, Date value) { + set(property, value); + } + + public void setString(Property property, String value) { + set(property, value); + } + + public void setList(Property property, List value) { + set(property, value); + } + + public DataObject createDataObject(String propertyName) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject createDataObject(int propertyIndex) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject createDataObject(Property property) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject createDataObject(String propertyName, String namespaceURI, String typeName) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject createDataObject(Property property, Type type) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public void delete() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataGraph getDataGraph() { + return DataObjectUtil.getDataGraph(this); + } + + public Sequence getSequence() { + EAttribute mixedFeature = BasicExtendedMetaData.INSTANCE.getMixedFeature(eClass()); + return mixedFeature != null ? (Sequence)eGet(mixedFeature, true, false) : null; + } + + public List getInstanceProperties() { + return DataObjectUtil.getInstanceProperties(this); + } + + public DataObject getRootObject() { + return DataObjectUtil.getRootObject(this); + } + + public ChangeSummary getChangeSummary() { + // TODO: implement this method + throw new UnsupportedOperationException(); + } + + public void detach() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + //DataObjectUtil.detach(this); + } + */ + +} //ClassTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataGraphImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataGraphImpl.java new file mode 100644 index 0000000000..725c0211dc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataGraphImpl.java @@ -0,0 +1,816 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sdo.SDOFactory; +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterImpl; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; + + +/** + * + * An implementation of the model object 'EData Graph'. + * @extends DataGraph, Adapter, Serializable + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.impl.DataGraphImpl#getResourceSet Resource Set}
  • + *
  • {@link org.apache.tuscany.sdo.impl.DataGraphImpl#getRootResource Root Resource}
  • + *
  • {@link org.apache.tuscany.sdo.impl.DataGraphImpl#getEChangeSummary EChange Summary}
  • + *
  • {@link org.apache.tuscany.sdo.impl.DataGraphImpl#getERootObject ERoot Object}
  • + *
+ *

+ * + * @generated + */ +public class DataGraphImpl extends EObjectImpl implements DataGraph, Adapter, Serializable +{ + /** + * The default value of the '{@link #getResourceSet() Resource Set}' attribute. + * + * + * @see #getResourceSet() + * @generated + * @ordered + */ + protected static final ResourceSet RESOURCE_SET_EDEFAULT = null; + + /** + * The cached value of the '{@link #getResourceSet() Resource Set}' attribute. + * + * + * @see #getResourceSet() + * @generated + * @ordered + */ + protected ResourceSet resourceSet = RESOURCE_SET_EDEFAULT; + + /** + * The default value of the '{@link #getRootResource() Root Resource}' attribute. + * + * + * @see #getRootResource() + * @generated + * @ordered + */ + protected static final Resource ROOT_RESOURCE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getEChangeSummary() EChange Summary}' reference. + * + * + * @see #getEChangeSummary() + * @generated + * @ordered + */ + protected ChangeSummary eChangeSummary = null; + + /** + * The cached value of the '{@link #getERootObject() ERoot Object}' reference. + * + * + * @see #getERootObject() + * @generated + * @ordered + */ + protected EObject eRootObject = null; + + /** + * The cached extended metadata to wrap the resource set's package registry. + */ + protected ExtendedMetaData extendedMetaData; + + /** + * + * + * @generated + */ + protected DataGraphImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getDataGraph(); + } + + public boolean isAdapterForType(Object type) + { + return type == DataGraph.class; + } + + public void notifyChanged(Notification msg) + { + } + + public Notifier getTarget() + { + return getResourceSet(); + } + + public void setTarget(Notifier newTarget) + { + } + + protected ExtendedMetaData getExtendedMetaData() + { + if (extendedMetaData == null) + { + getResourceSet(); + } + return extendedMetaData; + } + + /** + * + * + * @generated NOT + */ + public ResourceSet getResourceSet() + { + if (resourceSet == null) + { + if (eResource() != null) + { + resourceSet = eResource().getResourceSet(); + } + if (resourceSet == null) + { + resourceSet = createResourceSet(); + } + initializeResourceSet(resourceSet); + } + return resourceSet; + } + + protected ResourceSet createResourceSet() + { + return DataObjectUtil.createResourceSet(); + } + + protected Resource createRootResource() + { + Resource result = resourceSet.createResource(URI.createURI("root.xml")); + result.getContents().clear(); + return result; + } + + protected Resource createChangeSummaryResource() + { + Resource result = resourceSet.createResource(URI.createURI("change-summary.xml")); + result.getContents().clear(); + return result; + } + + protected void initializeResourceSet(ResourceSet resourceSet) + { + if (resourceSet == null) + { + extendedMetaData = null; + } + else + { + extendedMetaData = new BasicExtendedMetaData(resourceSet.getPackageRegistry()); + resourceSet.eAdapters().add(this); + } + } + + /** + * + * + * @generated + */ + public void setResourceSetGen(ResourceSet newResourceSet) + { + ResourceSet oldResourceSet = resourceSet; + resourceSet = newResourceSet; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.DATA_GRAPH__RESOURCE_SET, oldResourceSet, resourceSet)); + } + + public void setResourceSet(ResourceSet newResourceSet) + { + if (resourceSet != null) + { + resourceSet.eAdapters().remove(this); + } + setResourceSetGen(newResourceSet); + initializeResourceSet(newResourceSet); + } + + /** + * + * + * @generated NOT + */ + public Resource getRootResource() + { + if (eRootObject == null) + { + Resource result = getResourceSet().getResource(URI.createURI("root.xml"), false); + if (result == null) + { + result = createRootResource(); + } + + return result; + } + else + { + return eRootObject.eResource(); + } + } + + public Resource getDataGraphResource() + { + Resource result = eResource(); + if (result == null) + { + result = getResourceSet().createResource(URI.createURI("all.datagraph")); + result.getContents().add(this); + } + return result; + } + + /** + * + * + * @generated + */ + public ChangeSummary getEChangeSummary() + { + return eChangeSummary; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetEChangeSummary(ChangeSummary newEChangeSummary, NotificationChain msgs) + { + ChangeSummary oldEChangeSummary = eChangeSummary; + eChangeSummary = newEChangeSummary; + if (eNotificationRequired()) + { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, oldEChangeSummary, newEChangeSummary); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setEChangeSummary(ChangeSummary newEChangeSummary) + { + if (newEChangeSummary != eChangeSummary) + { + NotificationChain msgs = null; + if (eChangeSummary != null) + msgs = ((InternalEObject)eChangeSummary).eInverseRemove(this, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, ChangeSummary.class, msgs); + if (newEChangeSummary != null) + msgs = ((InternalEObject)newEChangeSummary).eInverseAdd(this, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, ChangeSummary.class, msgs); + msgs = basicSetEChangeSummary(newEChangeSummary, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY, newEChangeSummary, newEChangeSummary)); + } + + /** + * + * + * @generated + */ + public EObject getERootObject() + { + return eRootObject; + } + + /** + * + * + * @generated + */ + public void setERootObjectGen(EObject newERootObject) + { + EObject oldERootObject = eRootObject; + eRootObject = newERootObject; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.DATA_GRAPH__EROOT_OBJECT, oldERootObject, eRootObject)); + } + + public void setERootObject(EObject newERootObject) + { + // If there is a resource set already... + // + if (resourceSet != null) + { + // Get the root resource and if there's a root object in it already, clear it. + // Then set the root object and add it to the root resource. + // + List contents = getRootResource().getContents(); + if (eRootObject != null) + { + contents.clear(); + } + setERootObjectGen(newERootObject); + if (newERootObject != null) + { + contents.add(newERootObject); + } + } + else + { + // Set the root object and see if it has a resource we can reuse. + // + setERootObjectGen(newERootObject); + Resource rootResource = newERootObject.eResource(); + if (rootResource != null) + { + // If there is no resource set + // + if (rootResource.getResourceSet() == null) + { + // Demand create one and add this resource to it. + // + getResourceSet().getResources().add(rootResource); + } + else + { + // Reuse the existing resource set. + // + setResourceSet(rootResource.getResourceSet()); + } + } + else + { + // Demand create the resource set and the root resource, and add to it's contents. + // + getResourceSet(); + createRootResource().getContents().add(newERootObject); + } + } + } + + /** + * + * + * @generated NOT + */ + public EClassifier getEClassifier(String namespaceURI, String typeName) + { + ExtendedMetaData extendedMetaData = getExtendedMetaData(); + EPackage ePackage = extendedMetaData.getPackage(namespaceURI); + if (ePackage != null) + { + EClassifier eClassifier = ePackage.getEClassifier(typeName); + if (eClassifier == null) + { + eClassifier = extendedMetaData.getType(ePackage, typeName); + } + return eClassifier; + } + else + { + return null; + } + } + + /** + * + * + * @generated NOT + */ + public Type getType(String namespaceURI, String typeName) + { + return TypeHelper.INSTANCE.getType(namespaceURI, typeName); + //EClassifier eClassifier = getEClassifier(namespaceURI, typeName); + //return eClassifier == null ? null : SDOUtil.getType(eClassifier); + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) + { + if (featureID >= 0) + { + switch (eDerivedStructuralFeatureID(featureID, baseClass)) + { + case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY: + if (eChangeSummary != null) + msgs = ((InternalEObject)eChangeSummary).eInverseRemove(this, SDOPackage.CHANGE_SUMMARY__EDATA_GRAPH, ChangeSummary.class, msgs); + return basicSetEChangeSummary((ChangeSummary)otherEnd, msgs); + default: + return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); + } + } + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return eBasicSetContainer(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) + { + if (featureID >= 0) + { + switch (eDerivedStructuralFeatureID(featureID, baseClass)) + { + case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY: + return basicSetEChangeSummary(null, msgs); + default: + return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); + } + } + return eBasicSetContainer(null, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case SDOPackage.DATA_GRAPH__RESOURCE_SET: + return getResourceSet(); + case SDOPackage.DATA_GRAPH__ROOT_RESOURCE: + return getRootResource(); + case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY: + return getEChangeSummary(); + case SDOPackage.DATA_GRAPH__EROOT_OBJECT: + return getERootObject(); + } + return eDynamicGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case SDOPackage.DATA_GRAPH__RESOURCE_SET: + setResourceSet((ResourceSet)newValue); + return; + case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY: + setEChangeSummary((ChangeSummary)newValue); + return; + case SDOPackage.DATA_GRAPH__EROOT_OBJECT: + setERootObject((EObject)newValue); + return; + } + eDynamicSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case SDOPackage.DATA_GRAPH__RESOURCE_SET: + setResourceSet(RESOURCE_SET_EDEFAULT); + return; + case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY: + setEChangeSummary((ChangeSummary)null); + return; + case SDOPackage.DATA_GRAPH__EROOT_OBJECT: + setERootObject((EObject)null); + return; + } + eDynamicUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case SDOPackage.DATA_GRAPH__RESOURCE_SET: + return RESOURCE_SET_EDEFAULT == null ? resourceSet != null : !RESOURCE_SET_EDEFAULT.equals(resourceSet); + case SDOPackage.DATA_GRAPH__ROOT_RESOURCE: + return ROOT_RESOURCE_EDEFAULT == null ? getRootResource() != null : !ROOT_RESOURCE_EDEFAULT.equals(getRootResource()); + case SDOPackage.DATA_GRAPH__ECHANGE_SUMMARY: + return eChangeSummary != null; + case SDOPackage.DATA_GRAPH__EROOT_OBJECT: + return eRootObject != null; + } + return eDynamicIsSet(featureID); + } + + public DataObject createEDataObject(Type type) + { + return DataObjectUtil.create(type); + } + + public DataObject getRootObject() + { + return (DataObject)getERootObject(); + } + + public DataObject createRootObject(String namespaceURI, String typeName) + { + DataObject dataObject = DataObjectUtil.create(getType(namespaceURI, typeName)); + setERootObject((EObject)dataObject); + return dataObject; + } + + public DataObject createRootObject(Type type) + { + DataObject dataObject = DataObjectUtil.create(type); + setERootObject((EObject)dataObject); + return dataObject; + } + + public ChangeSummary getChangeSummary() + { + //FB is this the right place to create the resources? + ChangeSummary changeSummary = getEChangeSummary(); + if (changeSummary == null) + { + getRootResource(); + changeSummary = createEChangeSummary(); + setEChangeSummary(changeSummary); + } + + if (((ChangeSummaryImpl)changeSummary).eResource() == null) + { + Resource changeSummaryResource = createChangeSummaryResource(); + changeSummaryResource.getContents().add(changeSummary); + } + + return changeSummary; + } + + protected ChangeSummaryImpl createEChangeSummary() + { + return (ChangeSummaryImpl)SDOFactory.eINSTANCE.createChangeSummary(); + } + + public static class EDataGraphExternalizable implements Externalizable + { + protected DataGraphImpl eDataGraph; + protected Map writeReplacements = new HashMap(); + + public EDataGraphExternalizable() + { + } + + public EDataGraphExternalizable(DataGraphImpl eDataGraph) + { + this.eDataGraph = eDataGraph; + } + + public void writeExternal(ObjectOutput objectOutput) throws IOException + { + ByteArrayOutputStream byteArrayOutputStream = + new ByteArrayOutputStream() + { + public byte [] toByteArray() + { + return super.toByteArray(); + } + }; + + eDataGraph.getDataGraphResource().save(byteArrayOutputStream, null); + objectOutput.writeInt(byteArrayOutputStream.toByteArray().length); + objectOutput.write(byteArrayOutputStream.toByteArray()); + } + + public void readExternal(ObjectInput objectInput) throws IOException + { + int length = objectInput.readInt(); + byte [] bytes = new byte [length]; + objectInput.readFully(bytes); + + ResourceSet resourceSet = createResourceSet(); + Resource resource = resourceSet.createResource(URI.createURI("all.datagraph")); + resource.load(new ByteArrayInputStream(bytes), null); + eDataGraph = (DataGraphImpl)resource.getContents().get(0); + } + + protected ResourceSet createResourceSet() + { + return DataObjectUtil.createResourceSet(); + } + + public Object getWriteReplacement(EObject eObject) + { + Object result = writeReplacements.get(eObject); + if (result == null) + { + result = new EDataObjectExternalizable(eDataGraph, eObject); + writeReplacements.put(eObject, result); + } + return result; + } + + protected Object readResolve() + { + return eDataGraph; + } + } + + public static class EDataObjectExternalizable implements Externalizable + { + protected EObject eObject; + protected DataGraphImpl eDataGraph; + + public EDataObjectExternalizable() + { + } + + public EDataObjectExternalizable(DataGraphImpl eDataGraph, EObject eObject) + { + this.eDataGraph = eDataGraph; + this.eObject = eObject; + } + + public void writeExternal(ObjectOutput objectOutput) throws IOException + { + // Write the data object reference too. + String uri = eObject.eResource().getURIFragment(eObject); + objectOutput.writeUTF(uri); + objectOutput.writeObject(eDataGraph.getWriteReplacement()); + } + + public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException + { + String uri = objectInput.readUTF(); + eDataGraph = (DataGraphImpl)objectInput.readObject(); + eObject = eDataGraph.getRootResource().getEObject(uri); + } + + protected Object readResolve() + { + return eObject; + } + } + + + protected EDataGraphExternalizable eDataGraphExternalizable; + protected Adapter modificationTracker; + + public Object getWriteReplacement() + { + if (eDataGraphExternalizable == null) + { + eDataGraphExternalizable = createEDataGraphExternalizable(); + getRootResource().setTrackingModification(true); + modificationTracker = + new AdapterImpl() + { + public void notifyChanged(Notification notification) + { + if (notification.getFeatureID(Resource.class) == Resource.RESOURCE__IS_MODIFIED && notification.getNewBooleanValue()) + { + eDataGraphExternalizable = null; + modificationTracker = null; + ((Resource)target).eAdapters().remove(this); + } + } + }; + getRootResource().eAdapters().add(modificationTracker); + } + return eDataGraphExternalizable; + } + + protected EDataGraphExternalizable createEDataGraphExternalizable() + { + return new EDataGraphExternalizable(this); + } + + public Object getWriteReplacement(EObject eObject) + { + return ((EDataGraphExternalizable)getWriteReplacement()).getWriteReplacement(eObject); + } + + public Object writeReplace() + { + return getWriteReplacement(); + } + + public EObject eObjectForURIFragmentSegment(String uriFragmentSegment) + { + if (uriFragmentSegment.startsWith("@models.")) + { + if (resourceSet != null) + { + int count = Integer.parseInt(uriFragmentSegment.substring(8)); + for (Iterator i = resourceSet.getResources().iterator(); i.hasNext(); ) + { + Resource ePackageResource = (Resource)i.next(); + List resourceContents = ePackageResource.getContents(); + if (resourceContents.size() == 1 && resourceContents.get(0) instanceof EPackage && count-- == 0) + { + return (EObject)resourceContents.get(0); + } + } + } + + return null; + } + else + { + return super.eObjectForURIFragmentSegment(uriFragmentSegment); + } + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (resourceSet: "); + result.append(resourceSet); + result.append(')'); + return result.toString(); + } + +} //EDataGraphImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java new file mode 100644 index 0000000000..4617656fff --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectBase.java @@ -0,0 +1,238 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + + +import java.util.List; + +import org.apache.tuscany.sdo.util.BasicSequence; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.BasicFeatureMap; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.InternalEList; + + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + + +/** + * Base implementation of the SDO DataObject interface. Used as base class for prototype of EMF-less generated subclasses + */ +public abstract class DataObjectBase extends DataObjectImpl +{ + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Following methods should be proposed SPI for generated subclasses to use + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + protected boolean isNotifying() + { + return changeRecorder != null; + } + + protected interface ChangeKind + { + int SET = Notification.SET; + int UNSET = Notification.UNSET; + int RESOLVE = Notification.RESOLVE; + } + + protected void notify(int changeKind, int property, Object oldValue, Object newValue) + { + eNotify(new ENotificationImpl(this, Notification.SET, property, oldValue, newValue)); + } + + protected void notify(int changeKind, int property, double oldDoubleValue, double newDoubleValue, boolean isSetChange) + { + eNotify(new ENotificationImpl(this, Notification.SET, property, oldDoubleValue, newDoubleValue, isSetChange)); + } + + protected interface ListKind + { + int CONTAINMENT = 0; + } + + protected List createPropertyList(int listKind, Class dataClass, int property) + { + switch (listKind) + { + case ListKind.CONTAINMENT: + return new EObjectContainmentEList(dataClass, this, property); + } + return null; + } + + protected BasicSequence createSequence(int property) { + return new BasicSequence(new BasicFeatureMap(this, property)); + } + + protected Sequence createSequence(Sequence sequence, Type type, int propertyIndex) { + return new BasicSequence((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)sequence).featureMap().list(((EClass)type).getEStructuralFeature(propertyIndex))); + } + + /* + * get the value of the type's property at propertyIndex via the sequence + * @param seq + * @param type + * @param propertyIndex + * @return + */ + protected Object get(Sequence seq, Type type, int propertyIndex) { + return ((FeatureMap.Internal.Wrapper)seq).featureMap().get(((EClass)type).getEStructuralFeature(propertyIndex), true); + } + + protected List getList(Sequence seq, Type type, int propertyIndex) { + return ((FeatureMap.Internal.Wrapper)seq).featureMap().list(((EClass)type).getEStructuralFeature(propertyIndex)); + } + + protected void set(Sequence seq, Type type, int propertyIndex, Object newValue) { + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).set(((EClass)type).getEStructuralFeature(propertyIndex), newValue); + } + + protected void unset(Sequence seq, Type type, int propertyIndex) { + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).clear(((EClass)type).getEStructuralFeature(propertyIndex)); + + } + protected boolean isSet(Sequence seq, Type type, int propertyIndex) { + return !((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).isEmpty(((EClass)type).getEStructuralFeature(propertyIndex)); + } + + protected boolean isSequenceEmpty(Sequence sequence) { + return ((FeatureMap.Internal.Wrapper)sequence).featureMap().isEmpty(); + } + + protected void setSequence(Sequence seq, Object newValue) { + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)seq).featureMap()).set(newValue); + } + + protected void unsetSequence(Sequence seq) { + ((FeatureMap.Internal.Wrapper)seq).featureMap().clear(); + } + + protected Object get(int featureID, boolean resolve) + { + return null; + } + + protected interface ChangeContext {} + + protected ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + ChangeContextImpl changeContextImpl = (ChangeContextImpl)changeContext; + changeContextImpl.notificationChain = super.eInverseRemove((InternalEObject)otherEnd, propertyIndex, changeContextImpl.notificationChain); + return changeContextImpl; + } + + protected ChangeContext removeFromList(List propertyList, Object objectToRemove, ChangeContext changeContext) + { + ChangeContextImpl changeContextImpl = (ChangeContextImpl)changeContext; + changeContextImpl.notificationChain = ((InternalEList)propertyList).basicRemove(objectToRemove, changeContextImpl.notificationChain); + return changeContextImpl; + } + + protected ChangeContext removeFromSequence(Sequence sequence, Object otherEnd, ChangeContext changeContext) { + ChangeContextImpl changeContextImpl = (ChangeContextImpl)changeContext; + changeContextImpl.notificationChain = ((InternalEList)((FeatureMap.Internal.Wrapper)sequence).featureMap()).basicRemove(otherEnd, changeContextImpl.notificationChain); + return changeContextImpl; + } + + protected boolean isProxy() + { + return eIsProxy(); + } + + protected Object resolveProxy(Object proxy) + { + return EcoreUtil.resolve((EObject)proxy, this); + } + + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Following methods override EMF methods to work with pure SDO generated subclasses + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + public EClass eStaticClass() + { + return (EClass)getType(); + } + + public Type getType() // must be overridem in subclasses + { + throw new UnsupportedOperationException(); + } + + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + Object result = get(featureID, resolve); + if (coreType) + { + if (result instanceof FeatureMap.Internal.Wrapper) result = ((FeatureMap.Internal.Wrapper)result).featureMap(); + } + return result; + } + + public void eSet(int featureID, Object newValue) + { + set(featureID, newValue); + } + + public void eUnset(int featureID) + { + unset(featureID); + } + + public boolean eIsSet(int featureID) + { + return isSet(featureID); + } + + private class ChangeContextImpl implements ChangeContext + { + protected NotificationChain notificationChain; + public ChangeContextImpl(NotificationChain notificationChain) { + this.notificationChain = notificationChain; + } + } + + public NotificationChain eInverseRemove(InternalEObject otherEnd, int propertyIndex, NotificationChain msgs) + { + return ((ChangeContextImpl)inverseRemove(otherEnd, propertyIndex, new ChangeContextImpl(msgs))).notificationChain; + } + + public String toString() + { + StringBuffer result = new StringBuffer(getClass().getName()); + result.append('@'); + result.append(Integer.toHexString(hashCode())); + if (eIsProxy()) + { + result.append(" (proxyURI: "); + result.append(eProxyURI()); + result.append(')'); + } + return result.toString(); + } + +} //DataObjectBase + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java new file mode 100644 index 0000000000..82d808e4f3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataObjectImpl.java @@ -0,0 +1,1507 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + + +import java.io.ObjectStreamException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Date; +import java.util.List; + +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.impl.ChangeSummaryImpl.SDOChangeRecorder; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.EStructuralFeature.Internal.DynamicValueHolder; +import org.eclipse.emf.ecore.impl.BasicEObjectImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.EContentsEList; +import org.eclipse.emf.ecore.util.ECrossReferenceEList; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Sequence; +import commonj.sdo.Type; + + +/** + * + * Base implementation of the SDO DataObject interface. This implementation allocates the minimum storage + * overhead needed for SDO. It provides a complete implementation of the API, but does not, however, allocate + * any storage for the actual properties of the data object. It instead requires subclasses for this purpose. + * The subclass, DynamicDataObjectImpl serves as a concrete implementation class for dynamic data objects. + * Static data object storage is provided by generated classes, which also directly or indirectly derive from + * this class. + * + *

+ *

+ * + * @generated + */ +public abstract class DataObjectImpl extends BasicEObjectImpl implements DataObject +{ + protected InternalEObject eContainer; + protected int eContainerFeatureID; + protected SDOChangeRecorder changeRecorder; + protected Object location; // Resource.Internal (if object is directly contained in a resource) or URI (if it is a proxy) + + /** + * + * + * @generated + */ + protected DataObjectImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + public Object get(int propertyIndex) + { + return eGet(propertyIndex, true, false); + } + + /** + * + * + * @generated NOT + */ + public void set(int propertyIndex, Object value) + { + eSet(propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public boolean isSet(int propertyIndex) + { + return eIsSet(propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public void unset(int propertyIndex) + { + eUnset(propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public Object get(Property property) + { + return eGet((EStructuralFeature)property, true, false); + } + + /** + * + * + * @generated NOT + */ + public void set(Property property, Object value) + { + eSet((EStructuralFeature)property, value); + } + + /** + * + * + * @generated NOT + */ + public boolean isSet(Property property) + { + return eIsSet((EStructuralFeature)property); + } + + /** + * + * + * @generated NOT + */ + public void unset(Property property) + { + eUnset((EStructuralFeature)property); + } + + /** + * + * + * @generated NOT + */ + public DataObject getContainer() + { + return (DataObject)eContainer(); + } + + /** + * + * + * @generated NOT + */ + public Property getContainmentProperty() + { + return (Property)eContainmentFeature(); + } + + /** + * + * + * @generated NOT + */ + public Type getType() + { + return (Type)eClass(); + } + + + // Remaining DataObject methods are (will be) implemented as straight delegation to DataObjectUtil + + /** + * + * + * @generated NOT + */ + public Object writeReplace() throws ObjectStreamException + { + return DataObjectUtil.writeReplace(this); + } + + /** + * + * + * @generated NOT + */ + public Object get(String path) + { + return DataObjectUtil.get(this, path); + } + + /** + * + * + * @generated NOT + */ + public void set(String path, Object value) + { + DataObjectUtil.set(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public boolean isSet(String path) + { + return DataObjectUtil.isSet(this, path); + } + + /** + * + * + * @generated NOT + */ + public void unset(String path) + { + DataObjectUtil.unset(this, path); + } + + /** + * + * + * @generated NOT + */ + public DataGraph getDataGraph() + { + return DataObjectUtil.getDataGraph(this); + } + + /** + * + * + * @generated NOT + */ + public BigDecimal getBigDecimal(String path) + { + return DataObjectUtil.getBigDecimal(get(path)); + } + + /** + * + * + * @generated NOT + */ + public BigInteger getBigInteger(String path) + { + return DataObjectUtil.getBigInteger(get(path)); + } + + /** + * + * + * @generated NOT + */ + public boolean getBoolean(String path) + { + return DataObjectUtil.getBoolean(get(path)); + } + + /** + * + * + * @generated NOT + */ + public byte getByte(String path) + { + return DataObjectUtil.getByte(get(path)); + } + + /** + * + * + * @generated NOT + */ + public byte[] getBytes(String path) + { + return DataObjectUtil.getBytes(get(path)); + } + + /** + * + * + * @generated NOT + */ + public char getChar(String path) + { + return DataObjectUtil.getChar(get(path)); + } + + /** + * + * + * @generated NOT + */ + public DataObject getDataObject(String path) + { + return (DataObject)get(path); + } + + /** + * + * + * @generated NOT + */ + public Date getDate(String path) + { + return DataObjectUtil.getDate(get(path)); + } + + /** + * + * + * @generated NOT + */ + public double getDouble(String path) + { + return DataObjectUtil.getDouble(get(path)); + } + + /** + * + * + * @generated NOT + */ + public float getFloat(String path) + { + return DataObjectUtil.getFloat(get(path)); + } + + /** + * + * + * @generated NOT + */ + public int getInt(String path) + { + return DataObjectUtil.getInt(get(path)); + } + + /** + * + * + * @generated NOT + */ + public List getList(String path) + { + return (List)get(path); + } + + /** + * + * + * @generated NOT + */ + public long getLong(String path) + { + return DataObjectUtil.getLong(get(path)); + } + + /** + * + * + * @generated NOT + */ + public Sequence getSequence(String path) + { + return (Sequence)get(path); + } + + /** + * + * + * @generated NOT + */ + public short getShort(String path) + { + return DataObjectUtil.getShort(get(path)); + } + + /** + * + * + * @generated NOT + */ + public String getString(String path) + { + return DataObjectUtil.getString(get(path)); + } + + /** + * + * + * @generated NOT + */ + public void setBigDecimal(String path, BigDecimal value) + { + DataObjectUtil.setBigDecimal(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setBigInteger(String path, BigInteger value) + { + DataObjectUtil.setBigInteger(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setBoolean(String path, boolean value) + { + DataObjectUtil.setBoolean(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setByte(String path, byte value) + { + DataObjectUtil.setByte(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setBytes(String path, byte[] value) + { + DataObjectUtil.setBytes(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setChar(String path, char value) + { + DataObjectUtil.setChar(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setDataObject(String path, DataObject value) + { + DataObjectUtil.set(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setDate(String path, Date value) + { + DataObjectUtil.setDate(this,path,value); + } + + /** + * + * + * @generated NOT + */ + public void setDouble(String path, double value) + { + DataObjectUtil.setDouble(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setFloat(String path, float value) + { + DataObjectUtil.setFloat(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setInt(String path, int value) + { + DataObjectUtil.setInt(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setList(String path, List value) + { + DataObjectUtil.set(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setLong(String path, long value) + { + DataObjectUtil.setLong(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setShort(String path, short value) + { + DataObjectUtil.setShort(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public void setString(String path, String value) + { + DataObjectUtil.setString(this, path, value); + } + + /** + * + * + * @generated NOT + */ + public BigDecimal getBigDecimal(int propertyIndex) + { + return DataObjectUtil.getBigDecimal(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public BigInteger getBigInteger(int propertyIndex) + { + return DataObjectUtil.getBigInteger(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public boolean getBoolean(int propertyIndex) + { + return DataObjectUtil.getBoolean(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public byte getByte(int propertyIndex) + { + return DataObjectUtil.getByte(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public byte[] getBytes(int propertyIndex) + { + return DataObjectUtil.getBytes(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public char getChar(int propertyIndex) + { + return DataObjectUtil.getChar(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public DataObject getDataObject(int propertyIndex) + { + return DataObjectUtil.getDataObject(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public Date getDate(int propertyIndex) + { + return DataObjectUtil.getDate(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public double getDouble(int propertyIndex) + { + return DataObjectUtil.getDouble(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public float getFloat(int propertyIndex) + { + return DataObjectUtil.getFloat(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public int getInt(int propertyIndex) + { + return DataObjectUtil.getInt(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public List getList(int propertyIndex) + { + return DataObjectUtil.getList(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public long getLong(int propertyIndex) + { + return DataObjectUtil.getLong(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public Sequence getSequence(int propertyIndex) + { + return DataObjectUtil.getSequence(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public short getShort(int propertyIndex) + { + return DataObjectUtil.getShort(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public String getString(int propertyIndex) + { + return DataObjectUtil.getString(this,propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public void setBigDecimal(int propertyIndex, BigDecimal value) + { + DataObjectUtil.setBigDecimal(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setBigInteger(int propertyIndex, BigInteger value) + { + DataObjectUtil.setBigInteger(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setBoolean(int propertyIndex, boolean value) + { + DataObjectUtil.setBoolean(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setByte(int propertyIndex, byte value) + { + DataObjectUtil.setByte(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setBytes(int propertyIndex, byte[] value) + { + DataObjectUtil.setBytes(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setChar(int propertyIndex, char value) + { + DataObjectUtil.setChar(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setDataObject(int propertyIndex, DataObject value) + { + DataObjectUtil.setDataObject(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setDate(int propertyIndex, Date value) + { + DataObjectUtil.setDate(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setDouble(int propertyIndex, double value) + { + DataObjectUtil.setDouble(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setFloat(int propertyIndex, float value) + { + DataObjectUtil.setFloat(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setInt(int propertyIndex, int value) + { + DataObjectUtil.setInt(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setList(int propertyIndex, List value) + { + DataObjectUtil.setList(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setLong(int propertyIndex, long value) + { + DataObjectUtil.setLong(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setShort(int propertyIndex, short value) + { + DataObjectUtil.setShort(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public void setString(int propertyIndex, String value) + { + DataObjectUtil.setString(this, propertyIndex, value); + } + + /** + * + * + * @generated NOT + */ + public BigDecimal getBigDecimal(Property property) + { + return DataObjectUtil.getBigDecimal(this, property); + } + + /** + * + * + * @generated NOT + */ + public BigInteger getBigInteger(Property property) + { + return DataObjectUtil.getBigInteger(this, property); + } + + /** + * + * + * @generated NOT + */ + public boolean getBoolean(Property property) + { + return DataObjectUtil.getBoolean(this, property); + } + + /** + * + * + * @generated NOT + */ + public byte getByte(Property property) + { + return DataObjectUtil.getByte(this, property); + } + + /** + * + * + * @generated NOT + */ + public byte[] getBytes(Property property) + { + return DataObjectUtil.getBytes(this, property); + } + + /** + * + * + * @generated NOT + */ + public char getChar(Property property) + { + return DataObjectUtil.getChar(this, property); + } + + /** + * + * + * @generated NOT + */ + public DataObject getDataObject(Property property) + { + return (DataObject)DataObjectUtil.getDataObject(this,property); + } + + /** + * + * + * @generated NOT + */ + public Date getDate(Property property) + { + return DataObjectUtil.getDate(this, property); + } + + /** + * + * + * @generated NOT + */ + public double getDouble(Property property) + { + return DataObjectUtil.getDouble(this, property); + } + + /** + * + * + * @generated NOT + */ + public float getFloat(Property property) + { + return DataObjectUtil.getFloat(this, property); + } + + /** + * + * + * @generated NOT + */ + public int getInt(Property property) + { + return DataObjectUtil.getInt(this, property); + } + + /** + * + * + * @generated NOT + */ + public List getList(Property property) + { + return (List)DataObjectUtil.getList(this, property); + } + + /** + * + * + * @generated NOT + */ + public long getLong(Property property) + { + return DataObjectUtil.getLong(this, property); + } + + /** + * + * + * @generated NOT + */ + public Sequence getSequence(Property property) + { + return (Sequence)DataObjectUtil.getSequence(this, property); + } + + /** + * + * + * @generated NOT + */ + public short getShort(Property property) + { + return DataObjectUtil.getShort(this, property); + } + + /** + * + * + * @generated NOT + */ + public String getString(Property property) + { + return DataObjectUtil.getString(this, property); + } + + /** + * + * + * @generated NOT + */ + public void setBigDecimal(Property property, BigDecimal value) + { + DataObjectUtil.setBigDecimal(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setBigInteger(Property property, BigInteger value) + { + DataObjectUtil.setBigInteger(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setBoolean(Property property, boolean value) + { + DataObjectUtil.setBoolean(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setByte(Property property, byte value) + { + DataObjectUtil.setByte(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setBytes(Property property, byte[] value) + { + DataObjectUtil.setBytes(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setChar(Property property, char value) + { + DataObjectUtil.setChar(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setDataObject(Property property, DataObject value) + { + DataObjectUtil.setDataObject(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setDate(Property property, Date value) + { + DataObjectUtil.setDate(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setDouble(Property property, double value) + { + DataObjectUtil.setDouble(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setFloat(Property property, float value) + { + DataObjectUtil.setFloat(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setInt(Property property, int value) + { + DataObjectUtil.setInt(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setList(Property property, List value) + { + DataObjectUtil.setList(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setLong(Property property, long value) + { + DataObjectUtil.setLong(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setShort(Property property, short value) + { + DataObjectUtil.setShort(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public void setString(Property property, String value) + { + DataObjectUtil.setString(this,property, value); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(String propertyName) + { + return DataObjectUtil.createDataObject(this, propertyName); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(int propertyIndex) + { + return DataObjectUtil.createDataObject(this, propertyIndex); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(Property property) + { + return DataObjectUtil.createDataObject(this,property); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(String propertyName, String namespaceURI, String typeName) + { + return DataObjectUtil.createDataObject(this, propertyName, namespaceURI, typeName); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) + { + return DataObjectUtil.createDataObject(this, propertyIndex, namespaceURI, typeName); + } + + /** + * + * + * @generated NOT + */ + public DataObject createDataObject(Property property, Type type) + { + return DataObjectUtil.createDataObject(this, property, type); + } + + /** + * + * + * @generated NOT + */ + public void delete() + { + DataObjectUtil.delete(this); + } + + /** + * + * + * @generated NOT + */ + public Sequence getSequence() + { + EAttribute mixedFeature = BasicExtendedMetaData.INSTANCE.getMixedFeature(eClass()); + return mixedFeature != null ? (Sequence)eGet(mixedFeature, true, false) : null; + } + + /** + * + * + * @generated NOT + */ + public List getInstanceProperties() + { + return DataObjectUtil.getInstanceProperties(this); + } + + /** + * + * + * @generated NOT + */ + public Property getProperty(String propertyName) + { + return DataObjectUtil.getProperty(this, propertyName); + } + + /** + * + * + * @generated NOT + */ + public DataObject getRootObject() + { + return DataObjectUtil.getRootObject(this); + } + + /** + * + * + * @generated NOT + */ + public ChangeSummary getChangeSummary() + { + return DataObjectUtil.getChangeSummary(this); + } + + /** + * + * + * @generated NOT + */ + public void detach() + { + DataObjectUtil.detach(this); + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Following methods customize BasicEObjectImpl, optimized for SDO + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getDataObject(); + } + + public boolean eNotificationRequired() + { + return changeRecorder != null; + } + + public void eNotify(Notification notification) + { + changeRecorder.notifyChanged(notification); + } + + public void setChangeRecorder(SDOChangeRecorder changeRecorder) + { + if (this.changeRecorder != null) + { + this.changeRecorder.unsetTarget(this); + } + + if (changeRecorder != null) + { + changeRecorder.setTarget(this); + } + + this.changeRecorder = changeRecorder; + } + + public InternalEObject eInternalContainer() + { + return eContainer; + } + + public int eContainerFeatureID() + { + return eContainerFeatureID; + } + + protected void eBasicSetContainer(InternalEObject newContainer, int newContainerFeatureID) + { + eContainer = newContainer; + eContainerFeatureID = newContainerFeatureID; + } + + public EClass eClass() + { + return eStaticClass(); + } + + public EList eContents() + { + return new EContentsEList(this); + } + + public EList eCrossReferences() + { + return new ECrossReferenceEList(this); + } + + public Resource.Internal eDirectResource() + { + return location instanceof Resource.Internal ? (Resource.Internal)location : null; + } + + protected EClass eDynamicClass() + { + return null; + } + + protected boolean eHasSettings() + { + return false; + } + + public boolean eIsProxy() + { + return location instanceof URI; + } + + public URI eProxyURI() + { + return location instanceof URI ? (URI)location : null; + } + + public void eSetClass(EClass eClass) + { + throw new UnsupportedOperationException(); + } + + protected void eSetDirectResource(Resource.Internal resource) + { + location = resource; + } + + public void eSetProxyURI(URI uri) + { + location = uri; + } + + protected DynamicValueHolder eSettings() + { + return null; + } + + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + return eDynamicGet(featureID, resolve, coreType); + } + + public void eSet(int featureID, Object newValue) + { + eDynamicSet(featureID, newValue); + } + + public void eUnset(int featureID) + { + eDynamicUnset(featureID); + } + + public boolean eIsSet(int featureID) + { + return eDynamicIsSet(featureID); + } + + public Object eDynamicGet(int featureID, boolean resolve, boolean coreType) + { + return eOpenGet(DataObjectUtil.getOpenFeature(this, featureID), resolve); + } + + public void eDynamicSet(int featureID, Object newValue) + { + eOpenSet(DataObjectUtil.getOpenFeature(this, featureID), newValue); + } + + public void eDynamicUnset(int featureID) + { + eOpenUnset(DataObjectUtil.getOpenFeature(this, featureID)); + } + + public boolean eDynamicIsSet(int featureID) + { + return eOpenIsSet(DataObjectUtil.getOpenFeature(this, featureID)); + } + + /* + public int eDerivedStructuralFeatureID(EStructuralFeature eStructuralFeature) + { + Class containerClass = eStructuralFeature.getContainerClass(); + return + containerClass == null ? + eClass().getFeatureID(eStructuralFeature) : + containerClass.isInstance(this) ? + eDerivedStructuralFeatureID(eStructuralFeature.getFeatureID(), containerClass) : + -1; + } + + public void eOpenSet(EStructuralFeature eFeature, Object newValue) + { + EStructuralFeature openFeature = ExtendedMetaData.INSTANCE.getAffiliation(eClass(), eFeature); + if (openFeature == null) + { + openFeature = (EStructuralFeature)eClass().getEStructuralFeature("any"); + } + if (openFeature != null) + { + if (!FeatureMapUtil.isFeatureMap(openFeature)) + { + openFeature = ExtendedMetaData.INSTANCE.getGroup(openFeature); + } + FeatureMap featureMap = (FeatureMap)eGet(openFeature); + ((FeatureMap.Internal)featureMap).set(eFeature, newValue); + } + else + { + throw new IllegalArgumentException("The feature '" + eFeature.getName() + "' is not a valid changeable feature"); + } + } + */ + +} //DataObjectImpl + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataTypeImpl.java new file mode 100644 index 0000000000..18e1c3a19b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DataTypeImpl.java @@ -0,0 +1,750 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import java.util.Collections; +import java.util.List; + +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EDataTypeImpl; +import org.eclipse.emf.ecore.util.ExtendedMetaData; + +import commonj.sdo.Property; +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +/** + * + * An implementation of the model object 'Data Type'. + * + *

+ *

+ * + * @generated + */ +public class DataTypeImpl extends EDataTypeImpl implements Type, org.apache.tuscany.sdo.model.Type/*, DataObject*/ +{ + /** + * + * + * @generated + */ + protected DataTypeImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + protected EClass eStaticClass() + { + return EcorePackage.eINSTANCE.getEDataType(); + } + + /** + * + * + * @generated NOT + */ + public String getURI() + { + return getEPackage().getNsURI(); + } + + /** + * + * + * @generated NOT + */ + public boolean isDataType() + { + return true; + } + + /** + * + * + * @generated NOT + */ + public boolean isOpen() + { + return false; + } + + /** + * + * + * @generated NOT + */ + public boolean isSequenced() + { + return false; + } + + protected List aliasNames = null; + + /** + * + * + * @generated NOT + */ + public List getAliasNames() + { + if (aliasNames == null) + { + aliasNames = DataObjectUtil.getAliasNames(this); + } + return aliasNames; + } + + /** + * + * + * @generated NOT + */ + public List getDeclaredProperties() + { + return Collections.EMPTY_LIST; + } + + /** + * + * + * @generated NOT + */ + public List getProperties() + { + return Collections.EMPTY_LIST; + } + + /** + * + * + * @generated NOT + */ + public List getBaseTypes() + { + EDataType dataType = ExtendedMetaData.INSTANCE.getBaseType(this); + if (dataType == null) + { + return Collections.EMPTY_LIST; + } + else + { + return Collections.singletonList(dataType); + } + } + + /** + * + * + * @generated NOT + */ + public Property getProperty(String propertyName) + { + return null; + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + // org.apache.tuscany.sdo.model.Type method implementations + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + + public List getBaseType() { + return this.getBaseTypes(); + } + + public List getProperty() { + return this.getProperties(); + } + + public List getAliasName() { + return this.getAliasNames(); + } + + public Sequence getAny() { + throw new UnsupportedOperationException(); + } + + public Sequence getAnyAttribute() { + throw new UnsupportedOperationException(); + } + + public boolean isAbstract() + { + return false; + } + + public void setAbstract(boolean value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSetAbstract() { + return false; + } + + public void unsetAbstract() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public void setDataType(boolean value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public void unsetDataType() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSetDataType() { + return true; + } + + public void setOpen(boolean value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public void unsetOpen() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSetOpen() { + return false; + } + + public void setSequenced(boolean value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public void unsetSequenced() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSetSequenced() { + return false; + } + + public void setUri(String value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public String getUri() { + return getURI(); + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + // DataObject method implementations + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + /* + public Object get(int propertyIndex) { + Object ret = DataObjectUtil.get(this, propertyIndex); + return (ret != null) ? + ret : eGet(propertyIndex, true, false); + } + + public void set(int propertyIndex, Object value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSet(int propertyIndex) { + return eIsSet(propertyIndex); + } + + public void unset(int propertyIndex) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public Object get(Property property) { + Object ret = DataObjectUtil.get(this, ((EStructuralFeature)property).getFeatureID()); + return (ret != null) ? + ret : eGet((EStructuralFeature)property, true, false); + } + + public void set(Property property, Object value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSet(Property property) { + return eIsSet((EStructuralFeature)property); + } + + public void unset(Property property) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject getContainer() { + return (DataObject)eContainer(); + } + + public Property getContainmentProperty() { + return (Property)eContainmentFeature(); + } + + public Type getType() { + return (Type)ModelPackageImpl.eINSTANCE.getType(); + } + + // Remaining DataObject methods are (will be) implemented as straight delegation to DataObjectUtil + + public Object get(String path) { + return DataObjectUtil.get(this, path); + } + + public void set(String path, Object value) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean isSet(String path) { + return DataObjectUtil.isSet(this, path); + } + + public void unset(String path) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public boolean getBoolean(String path) { + return DataObjectUtil.getBoolean(get(path)); + } + + public byte getByte(String path) { + return DataObjectUtil.getByte(get(path)); + } + + public char getChar(String path) { + return DataObjectUtil.getChar(get(path)); + } + + public double getDouble(String path) { + return DataObjectUtil.getDouble(get(path)); + } + + public float getFloat(String path) { + return DataObjectUtil.getFloat(get(path)); + } + + public int getInt(String path) { + return DataObjectUtil.getInt(get(path)); + } + + public long getLong(String path) { + return DataObjectUtil.getLong(get(path)); + } + + public short getShort(String path) { + return DataObjectUtil.getShort(get(path)); + } + + public byte[] getBytes(String path) { + return DataObjectUtil.getBytes(get(path)); + } + + public BigDecimal getBigDecimal(String path) { + return DataObjectUtil.getBigDecimal(get(path)); + } + + public BigInteger getBigInteger(String path) { + return DataObjectUtil.getBigInteger(get(path)); + } + + public DataObject getDataObject(String path) { + return (DataObject)get(path); + } + + public Date getDate(String path) { + return DataObjectUtil.getDate(get(path)); + } + + public String getString(String path) { + return DataObjectUtil.getString(get(path)); + } + + public List getList(String path) { + return (List)get(path); + } + + public Sequence getSequence(String path) { + return (Sequence)get(path); + } + + public void setBoolean(String path, boolean value) { + set(path, new Boolean(value)); + } + + public void setByte(String path, byte value) { + set(path, new Byte(value)); + } + + public void setChar(String path, char value) { + set(path, new Character(value)); + } + + public void setDouble(String path, double value) { + set(path, new Double(value)); + } + + public void setFloat(String path, float value) { + set(path, new Float(value)); + } + + public void setInt(String path, int value) { + set(path, new Integer(value)); + } + + public void setLong(String path, long value) { + set(path, new Long(value)); + } + + public void setShort(String path, short value) { + set(path, new Short(value)); + } + + public void setBytes(String path, byte[] value) { + set(path, value); + } + + public void setBigDecimal(String path, BigDecimal value) { + set(path, value); + } + + public void setBigInteger(String path, BigInteger value) { + set(path, value); + } + + public void setDataObject(String path, DataObject value) { + set(path, value); + } + + public void setDate(String path, Date value) { + set(path, value); + } + + public void setString(String path, String value) { + set(path, value); + } + + public void setList(String path, List value) { + set(path, value); + } + + public boolean getBoolean(int propertyIndex) { + return DataObjectUtil.getBoolean(this, propertyIndex); + } + + public byte getByte(int propertyIndex) { + return DataObjectUtil.getByte(this, propertyIndex); + } + + public char getChar(int propertyIndex) { + return DataObjectUtil.getChar(this, propertyIndex); + } + + public double getDouble(int propertyIndex) { + return DataObjectUtil.getDouble(this, propertyIndex); + } + + public float getFloat(int propertyIndex) { + return DataObjectUtil.getFloat(this, propertyIndex); + } + + public int getInt(int propertyIndex) { + return DataObjectUtil.getInt(this, propertyIndex); + } + + public long getLong(int propertyIndex) { + return DataObjectUtil.getLong(this, propertyIndex); + } + + public short getShort(int propertyIndex) { + return DataObjectUtil.getShort(this, propertyIndex); + } + + public byte[] getBytes(int propertyIndex) { + return DataObjectUtil.getBytes(this, propertyIndex); + } + + public BigDecimal getBigDecimal(int propertyIndex) { + return DataObjectUtil.getBigDecimal(this, propertyIndex); + } + + public BigInteger getBigInteger(int propertyIndex) { + return DataObjectUtil.getBigInteger(this, propertyIndex); + } + + public DataObject getDataObject(int propertyIndex) { + return DataObjectUtil.getDataObject(this, propertyIndex); + } + + public Date getDate(int propertyIndex) { + return DataObjectUtil.getDate(this, propertyIndex); + } + + public String getString(int propertyIndex) { + return DataObjectUtil.getString(this, propertyIndex); + } + + public List getList(int propertyIndex) { + return DataObjectUtil.getList(this, propertyIndex); + } + + public Sequence getSequence(int propertyIndex) { + return DataObjectUtil.getSequence(this, propertyIndex); + } + + public void setBoolean(int propertyIndex, boolean value) { + set(propertyIndex, new Boolean(value)); + } + + public void setByte(int propertyIndex, byte value) { + set(propertyIndex, new Byte(value)); + } + + public void setChar(int propertyIndex, char value) { + set(propertyIndex, new Character(value)); + } + + public void setDouble(int propertyIndex, double value) { + set(propertyIndex, new Double(value)); + } + + public void setFloat(int propertyIndex, float value) { + set(propertyIndex, new Float(value)); + } + + public void setInt(int propertyIndex, int value) { + set(propertyIndex, new Integer(value)); + } + + public void setLong(int propertyIndex, long value) { + set(propertyIndex, new Long(value)); + } + + public void setShort(int propertyIndex, short value) { + set(propertyIndex, new Short(value)); + } + + public void setBytes(int propertyIndex, byte[] value) { + set(propertyIndex, value); + } + + public void setBigDecimal(int propertyIndex, BigDecimal value) { + set(propertyIndex, value); + } + + public void setBigInteger(int propertyIndex, BigInteger value) { + set(propertyIndex, value); + } + + public void setDataObject(int propertyIndex, DataObject value) { + set(propertyIndex, value); + } + + public void setDate(int propertyIndex, Date value) { + set(propertyIndex, value); + } + + public void setString(int propertyIndex, String value) { + set(propertyIndex, value); + } + + public void setList(int propertyIndex, List value) { + set(propertyIndex, value); + } + + public boolean getBoolean(Property property) { + return DataObjectUtil.getBoolean(this, property); + } + + public byte getByte(Property property) { + return DataObjectUtil.getByte(this, property); + } + + public char getChar(Property property) { + return DataObjectUtil.getChar(this, property); + } + + public double getDouble(Property property) { + return DataObjectUtil.getDouble(this, property); + } + + public float getFloat(Property property) { + return DataObjectUtil.getFloat(this, property); + } + + public int getInt(Property property) { + return DataObjectUtil.getInt(this, property); + } + + public long getLong(Property property) { + return DataObjectUtil.getLong(this, property); + } + + public short getShort(Property property) { + return DataObjectUtil.getShort(this, property); + } + + public byte[] getBytes(Property property) { + return DataObjectUtil.getBytes(this, property); + } + + public BigDecimal getBigDecimal(Property property) { + return DataObjectUtil.getBigDecimal(this, property); + } + + public BigInteger getBigInteger(Property property) { + return DataObjectUtil.getBigInteger(this, property); + } + + public DataObject getDataObject(Property property) { + return DataObjectUtil.getDataObject(this, property); + } + + public Date getDate(Property property) { + return DataObjectUtil.getDate(this, property); + } + + public String getString(Property property) { + return DataObjectUtil.getString(this, property); + } + + public List getList(Property property) { + return DataObjectUtil.getList(this, property); + } + + public Sequence getSequence(Property property) { + return DataObjectUtil.getSequence(this, property); + } + + public void setBoolean(Property property, boolean value) { + set(property, new Boolean(value)); + } + + public void setByte(Property property, byte value) { + set(property, new Byte(value)); + } + + public void setChar(Property property, char value) { + set(property, new Character(value)); + } + + public void setDouble(Property property, double value) { + set(property, new Double(value)); + } + + public void setFloat(Property property, float value) { + set(property, new Float(value)); + } + + public void setInt(Property property, int value) { + set(property, new Integer(value)); + } + + public void setLong(Property property, long value) { + set(property, new Long(value)); + } + + public void setShort(Property property, short value) { + set(property, new Short(value)); + } + + public void setBytes(Property property, byte[] value) { + set(property, value); + } + + public void setBigDecimal(Property property, BigDecimal value) { + set(property, value); + } + + public void setBigInteger(Property property, BigInteger value) { + set(property, value); + } + + public void setDataObject(Property property, DataObject value) { + set(property, value); + } + + public void setDate(Property property, Date value) { + set(property, value); + } + + public void setString(Property property, String value) { + set(property, value); + } + + public void setList(Property property, List value) { + set(property, value); + } + + public DataObject createDataObject(String propertyName) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject createDataObject(int propertyIndex) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject createDataObject(Property property) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject createDataObject(String propertyName, String namespaceURI, String typeName) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataObject createDataObject(Property property, Type type) { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public void delete() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + + public DataGraph getDataGraph() { + return DataObjectUtil.getDataGraph(this); + } + + public Sequence getSequence() { + EAttribute mixedFeature = BasicExtendedMetaData.INSTANCE.getMixedFeature(eClass()); + return mixedFeature != null ? (Sequence)eGet(mixedFeature, true, false) : null; + } + + public List getInstanceProperties() { + return DataObjectUtil.getInstanceProperties(this); + } + + public DataObject getRootObject() { + return DataObjectUtil.getRootObject(this); + } + + public ChangeSummary getChangeSummary() { + // TODO: implement this method + throw new UnsupportedOperationException(); + } + + public void detach() { + throw new UnsupportedOperationException("Type is frozen and cannot be modified"); + } + */ + +} //DataTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java new file mode 100644 index 0000000000..dd9cdfa779 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicDataObjectImpl.java @@ -0,0 +1,196 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import org.apache.tuscany.sdo.SDOPackage; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import commonj.sdo.DataObject; + +/** + * + * An implementation of the model object 'Dynamic Data Object'. + * @extends EStructuralFeature.Internal.DynamicValueHolder + * + *

+ *

+ * + * @generated + */ +public class DynamicDataObjectImpl extends DataObjectImpl implements DataObject, EStructuralFeature.Internal.DynamicValueHolder +{ + protected EClass eClass; + protected Object [] eSettings; + + protected static final Object [] ENO_SETTINGS = new Object [0]; + + /** + * + * + * @generated + */ + protected DynamicDataObjectImpl() + { + super(); + } + + /** + * Creates a dynamic DataObject. + */ + public DynamicDataObjectImpl(EClass eClass) + { + super(); + eSetClass(eClass); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getDynamicDataObject(); + } + + protected int eStaticFeatureCount() + { + return 0; + } + + public int eDerivedStructuralFeatureID(EStructuralFeature eStructuralFeature) + { + return eClass().getFeatureID(eStructuralFeature); + } + + protected boolean eHasSettings() + { + return eSettings != null; + } + + protected EStructuralFeature.Internal.DynamicValueHolder eSettings() + { + if (eSettings == null) + { + int size = eClass().getFeatureCount() - eStaticFeatureCount(); + eSettings = size == 0 ? ENO_SETTINGS : new Object [size]; + } + + return this; + } + + protected EClass eDynamicClass() + { + return eClass; + } + + public EClass eClass() + { + return eClass; + } + + public void eSetClass(EClass eClass) + { + this.eClass = eClass; + } + + public Object dynamicGet(int dynamicFeatureID) + { + return eSettings[dynamicFeatureID]; + } + + public void dynamicSet(int dynamicFeatureID, Object value) + { + eSettings[dynamicFeatureID] = value; + } + + public void dynamicUnset(int dynamicFeatureID) + { + eSettings[dynamicFeatureID] = null; + } + + public Object eDynamicGet(int featureID, boolean resolve, boolean coreType) + { + if (featureID < eClass().getFeatureCount()) + { + EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID); + return eSettingDelegate(eFeature).dynamicGet(this, eSettings(), featureID, resolve, coreType); + } + else + { + return super.eDynamicGet(featureID, resolve, coreType); + } + } + + public void eDynamicSet(int featureID, Object newValue) + { + if (featureID < eClass().getFeatureCount()) + { + EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID); + eDynamicSet(featureID, eFeature, newValue); + } + else + { + super.eDynamicSet(featureID, newValue); + } + } + + public void eDynamicUnset(int featureID) + { + if (featureID < eClass().getFeatureCount()) + { + EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID); + eDynamicUnset(featureID, eFeature); + } + else + { + super.eDynamicUnset(featureID); + } + } + + public boolean eDynamicIsSet(int featureID) + { + if (featureID < eClass().getFeatureCount()) + { + EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID); + return eSettingDelegate(eFeature).dynamicIsSet(this, eSettings(), featureID); + } + else + { + return super.eDynamicIsSet(featureID); + } + } + + /** + * An EFactoryImpl that creates DynamicEDataObjectImpl instances. + */ + public static class FactoryImpl extends EFactoryImpl + { + public FactoryImpl() + { + } + + public EObject basicCreate(EClass eClass) + { + return new DynamicDataObjectImpl(eClass); + } + } + +} //DynamicDataObjectImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicStoreDataObjectImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicStoreDataObjectImpl.java new file mode 100644 index 0000000000..d3b709c070 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/DynamicStoreDataObjectImpl.java @@ -0,0 +1,88 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import org.apache.tuscany.sdo.SDOPackage; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import commonj.sdo.DataObject; + +/** + * + * An implementation of the model object 'Dynamic Store Data Object'. + * + *

+ *

+ * + * @generated + */ +public class DynamicStoreDataObjectImpl extends StoreDataObjectImpl implements DataObject +{ + protected EClass eClass; + + /** + * + * + * @generated + */ + protected DynamicStoreDataObjectImpl() + { + super(); + } + + public DynamicStoreDataObjectImpl(InternalEObject.EStore eStore) + { + super(eStore); + } + + public DynamicStoreDataObjectImpl(EClass eClass) + { + super(eClass); + } + + public DynamicStoreDataObjectImpl(EClass eClass, InternalEObject.EStore eStore) + { + super(eClass, eStore); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getDynamicStoreDataObject(); + } + + protected EClass eDynamicClass() + { + return eClass; + } + + public EClass eClass() + { + return eClass; + } + + public void eSetClass(EClass eClass) + { + this.eClass = eClass; + } + +} //DynamicStoreDataObjectImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EnumImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EnumImpl.java new file mode 100644 index 0000000000..56e7eadcea --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/EnumImpl.java @@ -0,0 +1,170 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import java.util.Collections; +import java.util.List; + +//import org.apache.tuscany.sdo.SDOPackage; + +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EEnumImpl; + +import commonj.sdo.Property; +import commonj.sdo.Type; + +/** + * + * An implementation of the model object 'Enum'. + * + *

+ *

+ * + * @generated + * @deprecated SDO doesn't support Enum types + */ +public class EnumImpl extends EEnumImpl implements Type +{ + /** + * + * + * @generated + */ + protected EnumImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + protected EClass eStaticClass() + { + return EcorePackage.eINSTANCE.getEEnum(); + } + + /** + * + * + * @generated NOT + */ + public String getURI() + { + return getEPackage().getNsURI(); + } + + /** + * + * + * @generated NOT + */ + public boolean isDataType() + { + return true; + } + + /** + * + * + * @generated NOT + */ + public boolean isOpen() + { + return false; + } + + /** + * + * + * @generated NOT + */ + public boolean isSequenced() + { + return false; + } + + protected List aliasNames = null; + + /** + * + * + * @generated NOT + */ + public List getAliasNames() + { + if (aliasNames == null) + { + aliasNames = DataObjectUtil.getAliasNames(this); + } + return aliasNames; + } + + /** + * + * + * @generated NOT + */ + public List getDeclaredProperties() + { + return Collections.EMPTY_LIST; + } + + /** + * + * + * @generated NOT + */ + public List getProperties() + { + return Collections.EMPTY_LIST; + } + + /** + * + * + * @generated NOT + */ + public List getBaseTypes() + { + return Collections.EMPTY_LIST; + } + + /** + * + * + * @generated NOT + */ + public Property getProperty(String propertyName) + { + return null; + } + + /** + * + * + * @generated NOT + */ + public boolean isAbstract() + { + return false; + } + +} //EnumTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java new file mode 100644 index 0000000000..e57fb54544 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java @@ -0,0 +1,214 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.ENamedElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.impl.EClassImpl; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +/** + */ +public class FactoryBase extends EPackageImpl +{ + protected FactoryBase(String namespaceURI, String namespacePrefix) + { + super(new SDOEFactoryImpl()); + + int index = namespacePrefix.lastIndexOf("."); + setName(index != -1 ? namespacePrefix.substring(index + 1) : namespacePrefix); + setNsPrefix(namespacePrefix); + + createResource(namespaceURI); + setNsURI(namespaceURI); + //FIXME ... figure out proper (scoped) way to register static packages + EPackage.Registry.INSTANCE.put(namespaceURI, this); + + ((SDOEFactoryImpl)getEFactoryInstance()).sdoFactory = this; + } + + public DataObject create(int typeNumber) + { + return null; + } + + protected Type createType(boolean isDataType, int typeNumber) + { + if (isDataType) + return (Type)createEDataType(typeNumber); + else + return (Type)createEClass(typeNumber); + } + + protected void createProperty(boolean isDataType, Type containingType, int propertyNumber) + { + if (isDataType) + createEAttribute((EClass)containingType, propertyNumber); + else + createEReference((EClass)containingType, propertyNumber); + } + + protected void initializeType(Type type, Class instanceClass, String name) + { + initEClass((EClass)type, instanceClass, name, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + } + + protected void initializeProperty(Property property, Type type, String name, String defaultValue, int lower, int upper, Class containerClass, boolean isReadonly, boolean isUnsettable, boolean isDerived) + { + initEAttribute((EAttribute)property, (EClassifier)type, name, defaultValue, lower, upper, containerClass, isDerived, isDerived, !isReadonly, isUnsettable, !IS_ID, !IS_UNIQUE, isDerived, IS_ORDERED); + } + + protected void initializeProperty(Property property, Type type, String name, String defaultValue, int lower, int upper, Class containerClass, boolean isReadonly, boolean isUnsettable, boolean isDerived, boolean isComposite, Property oppositeProperty) + { + initEReference((EReference)property, (EClassifier)type, (EReference)oppositeProperty, name, defaultValue, lower, upper, containerClass, isDerived, isDerived, !isReadonly, isComposite, !isComposite /*resolve*/, isUnsettable, IS_UNIQUE, isDerived, IS_ORDERED); + } + + + + protected void createXSDMetaData() + { + createDocumentRoot(); + } + + protected void addXSDMapping(Type type, String[] xsdMappings) + { + addAnnotation((ENamedElement)type, ANNOTATION_SOURCE, xsdMappings); + } + + protected void addXSDMapping(Property property, String[] xsdMappings) + { + addAnnotation((ENamedElement)property, ANNOTATION_SOURCE, xsdMappings); + } + + protected void createGlobalProperty(String name, Type type, String[] xsdMappings) + { + int propertyNumber = documentRootEClass.getEStructuralFeatures().size(); + createEReference(documentRootEClass, propertyNumber); + EReference globalProperty = (EReference)documentRootEClass.getEStructuralFeatures().get(propertyNumber); + initEReference(globalProperty, (EClass)type, null, name, null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + addAnnotation((ENamedElement)globalProperty, ANNOTATION_SOURCE, xsdMappings); + } + + protected Type getSequence() { + return (Type)ecorePackage.getEFeatureMapEntry(); + } + + //public static FactoryBase getStaticFactory(String namespaceURI) + // temporarily return Object - until everything is gen'd with new codegen pattern + public static Object getStaticFactory(String namespaceURI) + { + EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(namespaceURI); + //return (FactoryBase)ePackage; + return ePackage instanceof FactoryBase ? (Object)ePackage : (Object)ePackage.getEFactoryInstance(); + } + + // private EMF-specific methods + + private static class SDOEFactoryImpl extends EFactoryImpl + { + protected FactoryBase sdoFactory; + + public SDOEFactoryImpl() + { + super(); + } + + public EObject create(EClass eClass) + { + DataObject result = sdoFactory.create(eClass.getClassifierID()); + if (result == null) { + return super.create(eClass); + } + return (EObject)result; + } + } + + private static final int DOCUMENT_ROOT = 0; + private static final int DOCUMENT_ROOT__MIXED = 0; + private static final int DOCUMENT_ROOT__XMLNS_PREFIX_MAP = 1; + private static final int DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = 2; + private static final String ANNOTATION_SOURCE = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; + private EClass documentRootEClass = null; + + private void createDocumentRoot() + { + documentRootEClass = ecoreFactory.createEClass(); + ((EClassImpl)documentRootEClass).setClassifierID(DOCUMENT_ROOT); + getEClassifiers().add(DOCUMENT_ROOT, documentRootEClass); + + createEAttribute(documentRootEClass, DOCUMENT_ROOT__MIXED); + createEReference(documentRootEClass, DOCUMENT_ROOT__XMLNS_PREFIX_MAP); + createEReference(documentRootEClass, DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); + + initEClass(documentRootEClass, null, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + initEAttribute((EAttribute)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__MIXED), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference((EReference)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__XMLNS_PREFIX_MAP), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference((EReference)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__XSI_SCHEMA_LOCATION), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + addAnnotation + (documentRootEClass, + ANNOTATION_SOURCE, + new String[] + { + "name", "", + "kind", "mixed" + }); + addAnnotation + ((EAttribute)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__MIXED), + ANNOTATION_SOURCE, + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + addAnnotation + ((EReference)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__XMLNS_PREFIX_MAP), + ANNOTATION_SOURCE, + new String[] + { + "kind", "attribute", + "name", "xmlns:prefix" + }); + addAnnotation + ((EReference)documentRootEClass.getEStructuralFeatures().get(DOCUMENT_ROOT__XSI_SCHEMA_LOCATION), + ANNOTATION_SOURCE, + new String[] + { + "kind", "attribute", + "name", "xsi:schemaLocation" + }); + } + + /** + * Initialize SDO runtime. + */ + static + { + DataObjectUtil.initRuntime(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java new file mode 100644 index 0000000000..a3536f4230 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/ReferenceImpl.java @@ -0,0 +1,698 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import java.util.List; + +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EReferenceImpl; + +import commonj.sdo.Property; +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +/** + * + * An implementation of the model object 'Reference'. + * + *

+ *

+ * + * @generated + */ +public class ReferenceImpl extends EReferenceImpl implements Property,/* DataObject,*/ org.apache.tuscany.sdo.model.Property +{ + /** + * + * + * @generated + */ + protected ReferenceImpl() + { + super(); + } + + /** + * + * + * @generated NOT + */ + protected EClass eStaticClass() + { + return EcorePackage.eINSTANCE.getEReference(); + } + + /** + * + * + * @generated NOT + */ + public Object getDefault() + { + return getDefaultValue(); + } + + /** + * + * + * @generated NOT + */ + public boolean isReadOnly() + { + //return "true".equals(EcoreUtil.getAnnotation(this, "commonj.sdo", "readOnly")); + return !isChangeable(); //TODO semantics don't exactly match? + } + + protected List aliasNames = null; + + /** + * + * + * @generated NOT + */ + public List getAliasNames() + { + if (aliasNames == null) + { + aliasNames = DataObjectUtil.getAliasNames(this); + } + return aliasNames; + } + + /** + * + * + * @generated NOT + */ + public Type getType() + { + // Note that Property.getType() conflicts with DataObject.getType(), so we can only implement + // it one way or the other here. We're implementing it to return the property type so it will + // return the wrong type when the caller is using the DataObject interface. Not much we can + // do about it tho. -- James Snell + return (Type)getEType(); + } + + /** + * + * + * @generated NOT + */ + public Type getContainingType() + { + return (Type)getEContainingClass(); + } + + /** + * + * + * @generated NOT + */ + public Property getOpposite() + { + return (Property)getEOpposite(); + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + // org.apache.tuscany.sdo.model.Property methods + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + + public List getAliasName() { + return this.getAliasNames(); + } + + public Sequence getAny() { + throw new UnsupportedOperationException(); + } + + public void setMany(boolean value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public void unsetMany() { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSetMany() { + return isMany(); + } + + public void setReadOnly(boolean value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public void unsetReadOnly() { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSetReadOnly() { + return isReadOnly(); + } + + public org.apache.tuscany.sdo.model.Type getType_() { + return (org.apache.tuscany.sdo.model.Type)getType(); + } + + public void setType(org.apache.tuscany.sdo.model.Type value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public Sequence getAnyAttribute() { + throw new UnsupportedOperationException(); + } + + public String getDefault_() { + return (String) this.getDefault(); + } + + public void setDefault_(String value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public org.apache.tuscany.sdo.model.Property getOpposite_() { + return (org.apache.tuscany.sdo.model.Property) getOpposite(); + } + + public void setOpposite_(org.apache.tuscany.sdo.model.Property value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public void unsetContainment() { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSetContainment() { + return isContainment(); + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + // DataObject method implementations + ///////////////////////////////////////////////////////////////////////////////////////////////////////// + /* + public Object get(int propertyIndex) { + return DataObjectUtil.get(this, propertyIndex); + } + + public void set(int propertyIndex, Object value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSet(int propertyIndex) { + return DataObjectUtil.isSet(this, propertyIndex); + } + + public void unset(int propertyIndex) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public Object get(Property property) { + return DataObjectUtil.get(this, ((EStructuralFeature)property).getFeatureID()); + } + + public void set(Property property, Object value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSet(Property property) { + return DataObjectUtil.isSet(this, ((EStructuralFeature)property).getFeatureID()); + } + + public void unset(Property property) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject getContainer() { + return (DataObject)eContainer(); + } + + public Property getContainmentProperty() { + return (Property)eContainmentFeature(); + } + + // Remaining DataObject methods are (will be) implemented as straight delegation to DataObjectUtil + + public Object get(String path) { + return DataObjectUtil.get(this, path); + } + + public void set(String path, Object value) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean isSet(String path) { + return DataObjectUtil.isSet(this, path); + } + + public void unset(String path) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public boolean getBoolean(String path) { + return DataObjectUtil.getBoolean(get(path)); + } + + public byte getByte(String path) { + return DataObjectUtil.getByte(get(path)); + } + + public char getChar(String path) { + return DataObjectUtil.getChar(get(path)); + } + + public double getDouble(String path) { + return DataObjectUtil.getDouble(get(path)); + } + + public float getFloat(String path) { + return DataObjectUtil.getFloat(get(path)); + } + + public int getInt(String path) { + return DataObjectUtil.getInt(get(path)); + } + + public long getLong(String path) { + return DataObjectUtil.getLong(get(path)); + } + + public short getShort(String path) { + return DataObjectUtil.getShort(get(path)); + } + + public byte[] getBytes(String path) { + return DataObjectUtil.getBytes(get(path)); + } + + public BigDecimal getBigDecimal(String path) { + return DataObjectUtil.getBigDecimal(get(path)); + } + + public BigInteger getBigInteger(String path) { + return DataObjectUtil.getBigInteger(get(path)); + } + + public DataObject getDataObject(String path) { + return (DataObject)get(path); + } + + public Date getDate(String path) { + return DataObjectUtil.getDate(get(path)); + } + + public String getString(String path) { + return DataObjectUtil.getString(get(path)); + } + + public List getList(String path) { + return (List)get(path); + } + + public Sequence getSequence(String path) { + return (Sequence)get(path); + } + + public void setBoolean(String path, boolean value) { + set(path, new Boolean(value)); + } + + public void setByte(String path, byte value) { + set(path, new Byte(value)); + } + + public void setChar(String path, char value) { + set(path, new Character(value)); + } + + public void setDouble(String path, double value) { + set(path, new Double(value)); + } + + public void setFloat(String path, float value) { + set(path, new Float(value)); + } + + public void setInt(String path, int value) { + set(path, new Integer(value)); + } + + public void setLong(String path, long value) { + set(path, new Long(value)); + } + + public void setShort(String path, short value) { + set(path, new Short(value)); + } + + public void setBytes(String path, byte[] value) { + set(path, value); + } + + public void setBigDecimal(String path, BigDecimal value) { + set(path, value); + } + + public void setBigInteger(String path, BigInteger value) { + set(path, value); + } + + public void setDataObject(String path, DataObject value) { + set(path, value); + } + + public void setDate(String path, Date value) { + set(path, value); + } + + public void setString(String path, String value) { + set(path, value); + } + + public void setList(String path, List value) { + set(path, value); + } + + public boolean getBoolean(int propertyIndex) { + return DataObjectUtil.getBoolean(this, propertyIndex); + } + + public byte getByte(int propertyIndex) { + return DataObjectUtil.getByte(this, propertyIndex); + } + + public char getChar(int propertyIndex) { + return DataObjectUtil.getChar(this, propertyIndex); + } + + public double getDouble(int propertyIndex) { + return DataObjectUtil.getDouble(this, propertyIndex); + } + + public float getFloat(int propertyIndex) { + return DataObjectUtil.getFloat(this, propertyIndex); + } + + public int getInt(int propertyIndex) { + return DataObjectUtil.getInt(this, propertyIndex); + } + + public long getLong(int propertyIndex) { + return DataObjectUtil.getLong(this, propertyIndex); + } + + public short getShort(int propertyIndex) { + return DataObjectUtil.getShort(this, propertyIndex); + } + + public byte[] getBytes(int propertyIndex) { + return DataObjectUtil.getBytes(this, propertyIndex); + } + + public BigDecimal getBigDecimal(int propertyIndex) { + return DataObjectUtil.getBigDecimal(this, propertyIndex); + } + + public BigInteger getBigInteger(int propertyIndex) { + return DataObjectUtil.getBigInteger(this, propertyIndex); + } + + public DataObject getDataObject(int propertyIndex) { + return DataObjectUtil.getDataObject(this, propertyIndex); + } + + public Date getDate(int propertyIndex) { + return DataObjectUtil.getDate(this, propertyIndex); + } + + public String getString(int propertyIndex) { + return DataObjectUtil.getString(this, propertyIndex); + } + + public List getList(int propertyIndex) { + return DataObjectUtil.getList(this, propertyIndex); + } + + public Sequence getSequence(int propertyIndex) { + return DataObjectUtil.getSequence(this, propertyIndex); + } + + public void setBoolean(int propertyIndex, boolean value) { + set(propertyIndex, new Boolean(value)); + } + + public void setByte(int propertyIndex, byte value) { + set(propertyIndex, new Byte(value)); + } + + public void setChar(int propertyIndex, char value) { + set(propertyIndex, new Character(value)); + } + + public void setDouble(int propertyIndex, double value) { + set(propertyIndex, new Double(value)); + } + + public void setFloat(int propertyIndex, float value) { + set(propertyIndex, new Float(value)); + } + + public void setInt(int propertyIndex, int value) { + set(propertyIndex, new Integer(value)); + } + + public void setLong(int propertyIndex, long value) { + set(propertyIndex, new Long(value)); + } + + public void setShort(int propertyIndex, short value) { + set(propertyIndex, new Short(value)); + } + + public void setBytes(int propertyIndex, byte[] value) { + set(propertyIndex, value); + } + + public void setBigDecimal(int propertyIndex, BigDecimal value) { + set(propertyIndex, value); + } + + public void setBigInteger(int propertyIndex, BigInteger value) { + set(propertyIndex, value); + } + + public void setDataObject(int propertyIndex, DataObject value) { + set(propertyIndex, value); + } + + public void setDate(int propertyIndex, Date value) { + set(propertyIndex, value); + } + + public void setString(int propertyIndex, String value) { + set(propertyIndex, value); + } + + public void setList(int propertyIndex, List value) { + set(propertyIndex, value); + } + + public boolean getBoolean(Property property) { + return DataObjectUtil.getBoolean(this, property); + } + + public byte getByte(Property property) { + return DataObjectUtil.getByte(this, property); + } + + public char getChar(Property property) { + return DataObjectUtil.getChar(this, property); + } + + public double getDouble(Property property) { + return DataObjectUtil.getDouble(this, property); + } + + public float getFloat(Property property) { + return DataObjectUtil.getFloat(this, property); + } + + public int getInt(Property property) { + return DataObjectUtil.getInt(this, property); + } + + public long getLong(Property property) { + return DataObjectUtil.getLong(this, property); + } + + public short getShort(Property property) { + return DataObjectUtil.getShort(this, property); + } + + public byte[] getBytes(Property property) { + return DataObjectUtil.getBytes(this, property); + } + + public BigDecimal getBigDecimal(Property property) { + return DataObjectUtil.getBigDecimal(this, property); + } + + public BigInteger getBigInteger(Property property) { + return DataObjectUtil.getBigInteger(this, property); + } + + public DataObject getDataObject(Property property) { + return DataObjectUtil.getDataObject(this, property); + } + + public Date getDate(Property property) { + return DataObjectUtil.getDate(this, property); + } + + public String getString(Property property) { + return DataObjectUtil.getString(this, property); + } + + public List getList(Property property) { + return DataObjectUtil.getList(this, property); + } + + public Sequence getSequence(Property property) { + return DataObjectUtil.getSequence(this, property); + } + + public void setBoolean(Property property, boolean value) { + set(property, new Boolean(value)); + } + + public void setByte(Property property, byte value) { + set(property, new Byte(value)); + } + + public void setChar(Property property, char value) { + set(property, new Character(value)); + } + + public void setDouble(Property property, double value) { + set(property, new Double(value)); + } + + public void setFloat(Property property, float value) { + set(property, new Float(value)); + } + + public void setInt(Property property, int value) { + set(property, new Integer(value)); + } + + public void setLong(Property property, long value) { + set(property, new Long(value)); + } + + public void setShort(Property property, short value) { + set(property, new Short(value)); + } + + public void setBytes(Property property, byte[] value) { + set(property, value); + } + + public void setBigDecimal(Property property, BigDecimal value) { + set(property, value); + } + + public void setBigInteger(Property property, BigInteger value) { + set(property, value); + } + + public void setDataObject(Property property, DataObject value) { + set(property, value); + } + + public void setDate(Property property, Date value) { + set(property, value); + } + + public void setString(Property property, String value) { + set(property, value); + } + + public void setList(Property property, List value) { + set(property, value); + } + + public DataObject createDataObject(String propertyName) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject createDataObject(int propertyIndex) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject createDataObject(Property property) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject createDataObject(String propertyName, String namespaceURI, String typeName) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataObject createDataObject(Property property, Type type) { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public void delete() { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + } + + public DataGraph getDataGraph() { + return DataObjectUtil.getDataGraph(this); + } + + public Sequence getSequence() { + EAttribute mixedFeature = BasicExtendedMetaData.INSTANCE.getMixedFeature(eClass()); + return mixedFeature != null ? (Sequence)eGet(mixedFeature, true, false) : null; + } + + public List getInstanceProperties() { + return DataObjectUtil.getInstanceProperties(this); + } + + public DataObject getRootObject() { + return DataObjectUtil.getRootObject(this); + } + + public ChangeSummary getChangeSummary() { + // TODO: implement this method + throw new UnsupportedOperationException(); + } + + public void detach() { + throw new UnsupportedOperationException("Property is frozen and cannot be modified"); + //DataObjectUtil.detach(this); + } + + public Property getProperty(String propertyName) { + return DataObjectUtil.getProperty(this, propertyName); + } + */ + +} //ReferenceImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOFactoryImpl.java new file mode 100644 index 0000000000..f8c3f05cae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOFactoryImpl.java @@ -0,0 +1,332 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + + +import org.apache.tuscany.sdo.AnyTypeDataObject; +import org.apache.tuscany.sdo.SDOFactory; +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.SimpleAnyTypeDataObject; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.eclipse.emf.ecore.impl.EcoreFactoryImpl; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class SDOFactoryImpl extends EFactoryImpl implements SDOFactory +{ + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static SDOFactory init() + { + try + { + SDOFactory theSDOFactory = (SDOFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/2003/SDO"); + if (theSDOFactory != null) + { + return theSDOFactory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new SDOFactoryImpl(); + } + + public static class SDOEcoreFactory extends EcoreFactoryImpl + { + public EClass createEClass() { return new ClassImpl(); } + public EDataType createEDataType() { return new DataTypeImpl(); } + public EEnum createEEnum() { return new EnumImpl(); } + public EAttribute createEAttribute() { return new AttributeImpl(); } + public EReference createEReference() { return new ReferenceImpl(); } + +// public EFactory createEFactory() +// { +// EFactoryImpl eFactory = new EFactoryImpl() { OVERRIDE basicCreate(); } // TODO think about doing this +// return eFactory; +// } + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public SDOFactoryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public EObject createGen(EClass eClass) + { + switch (eClass.getClassifierID()) + { + case SDOPackage.CHANGE_SUMMARY: return (EObject)createChangeSummary(); + case SDOPackage.CHANGE_SUMMARY_SETTING: return (EObject)createChangeSummarySetting(); + case SDOPackage.DATA_GRAPH: return (EObject)createDataGraph(); + case SDOPackage.ANY_TYPE_DATA_OBJECT: return createAnyTypeDataObject(); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT: return createSimpleAnyTypeDataObject(); + case SDOPackage.CLASS: return (EObject)createClass(); + case SDOPackage.DATA_TYPE: return (EObject)createDataType(); + case SDOPackage.ATTRIBUTE: return (EObject)createAttribute(); + case SDOPackage.REFERENCE: return (EObject)createReference(); + case SDOPackage.ENUM: return (EObject)createEnum(); + case SDOPackage.DYNAMIC_DATA_OBJECT: return (EObject)createDynamicDataObject(); + case SDOPackage.STORE_DATA_OBJECT: return (EObject)createStoreDataObject(); + case SDOPackage.DYNAMIC_STORE_DATA_OBJECT: return (EObject)createDynamicStoreDataObject(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + public EObject create(EClass eClass) + { + if (eClass.getClassifierID() == SDOPackage.DATA_OBJECT) return createAnyTypeDataObject(); + return createGen(eClass); + } + + + /** + * + * + * @generated + */ + public Object createFromString(EDataType eDataType, String initialValue) + { + switch (eDataType.getClassifierID()) + { + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public String convertToString(EDataType eDataType, Object instanceValue) + { + switch (eDataType.getClassifierID()) + { + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public ChangeSummary createChangeSummary() + { + ChangeSummaryImpl changeSummary = new ChangeSummaryImpl(); + return changeSummary; + } + + /** + * + * + * @generated + */ + public ChangeSummary.Setting createChangeSummarySetting() + { + ChangeSummarySettingImpl changeSummarySetting = new ChangeSummarySettingImpl(); + return changeSummarySetting; + } + + /** + * + * + * @generated + */ + public DataGraph createDataGraph() + { + DataGraphImpl dataGraph = new DataGraphImpl(); + return dataGraph; + } + + /** + * + * + * @generated + */ + public AnyTypeDataObject createAnyTypeDataObject() + { + AnyTypeDataObjectImpl anyTypeDataObject = new AnyTypeDataObjectImpl(); + return anyTypeDataObject; + } + + /** + * + * + * @generated + */ + public SimpleAnyTypeDataObject createSimpleAnyTypeDataObject() + { + SimpleAnyTypeDataObjectImpl simpleAnyTypeDataObject = new SimpleAnyTypeDataObjectImpl(); + return simpleAnyTypeDataObject; + } + + /** + * + * + * @generated + */ + public Type createClass() + { + ClassImpl class_ = new ClassImpl(); + return class_; + } + + /** + * + * + * @generated + */ + public Type createDataType() + { + DataTypeImpl dataType = new DataTypeImpl(); + return dataType; + } + + /** + * + * + * @generated + */ + public Property createAttribute() + { + AttributeImpl attribute = new AttributeImpl(); + return attribute; + } + + /** + * + * + * @generated + */ + public Property createReference() + { + ReferenceImpl reference = new ReferenceImpl(); + return reference; + } + + /** + * + * + * @generated + */ + public Type createEnum() + { + EnumImpl enum_ = new EnumImpl(); + return enum_; + } + + /** + * + * + * @generated + */ + public DataObject createDynamicDataObject() + { + DynamicDataObjectImpl dynamicDataObject = new DynamicDataObjectImpl(); + return dynamicDataObject; + } + + /** + * + * + * @generated + */ + public DataObject createStoreDataObject() + { + StoreDataObjectImpl storeDataObject = new StoreDataObjectImpl(); + return storeDataObject; + } + + /** + * + * + * @generated + */ + public DataObject createDynamicStoreDataObject() + { + DynamicStoreDataObjectImpl dynamicStoreDataObject = new DynamicStoreDataObjectImpl(); + return dynamicStoreDataObject; + } + + /** + * + * + * @generated + */ + public SDOPackage getSDOPackage() + { + return (SDOPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + public static SDOPackage getPackage() + { + return SDOPackage.eINSTANCE; + } + + public ChangeSummary.Setting createChangeSummarySetting(EStructuralFeature eStructuralFeature, Object value, boolean isSet) + { + ChangeSummarySettingImpl eChangeSummarySetting = new ChangeSummarySettingImpl(eStructuralFeature, value, isSet); + return eChangeSummarySetting; + } + +} //SDOFactoryImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java new file mode 100644 index 0000000000..15011fc37f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SDOPackageImpl.java @@ -0,0 +1,2133 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import java.io.ObjectStreamException; +import java.util.List; + +import org.apache.tuscany.sdo.AnyTypeDataObject; +import org.apache.tuscany.sdo.SDOFactory; +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.SimpleAnyTypeDataObject; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.change.ChangePackage; +import org.eclipse.emf.ecore.change.impl.ChangePackageImpl; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.emf.ecore.impl.EcorePackageImpl; +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; +import org.eclipse.emf.ecore.xml.type.impl.XMLTypePackageImpl; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class SDOPackageImpl extends EPackageImpl implements SDOPackage +{ + /** + * + * + * @generated + */ + private EClass changeSummaryEClass = null; + + /** + * + * + * @generated + */ + private EClass changeSummarySettingEClass = null; + + /** + * + * + * @generated + */ + private EClass dataGraphEClass = null; + + /** + * + * + * @generated + */ + private EClass dataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass propertyEClass = null; + + /** + * + * + * @generated + */ + private EClass sequenceEClass = null; + + /** + * + * + * @generated + */ + private EClass typeEClass = null; + + /** + * + * + * @generated + */ + private EClass anyTypeDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass simpleAnyTypeDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass classEClass = null; + + /** + * + * + * @generated + */ + private EClass dataTypeEClass = null; + + /** + * + * + * @generated + */ + private EClass attributeEClass = null; + + /** + * + * + * @generated + */ + private EClass referenceEClass = null; + + /** + * + * + * @generated + */ + private EClass enumEClass = null; + + /** + * + * + * @generated + */ + private EClass dynamicDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass storeDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass dynamicStoreDataObjectEClass = null; + + /** + * + * + * @generated + */ + private EDataType eJavaListEDataType = null; + + /** + * + * + * @generated + */ + private EDataType eObjectStreamExceptionEDataType = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.apache.tuscany.sdo.SDOPackage#eNS_URI + * @see #init() + * @generated + */ + private SDOPackageImpl() + { + super(eNS_URI, SDOFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + *

Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + *

Invocation of this method will not affect any packages that have + * already been initialized. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static SDOPackage init() + { + if (isInited) return (SDOPackage)EPackage.Registry.INSTANCE.getEPackage(SDOPackage.eNS_URI); + + // Obtain or create and register package + SDOPackageImpl theSDOPackage = (SDOPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof SDOPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new SDOPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + EcorePackageImpl.init(); + XMLTypePackageImpl.init(); + ChangePackageImpl.init(); + + // Create package meta-data objects + theSDOPackage.createPackageContents(); + + // Initialize created meta-data + theSDOPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theSDOPackage.freeze(); + + return theSDOPackage; + } + + /** + * + * + * @generated + */ + public EClass getChangeSummary() + { + return changeSummaryEClass; + } + + /** + * + * + * @generated + */ + public EReference getChangeSummary_EDataGraph() + { + return (EReference)changeSummaryEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getChangeSummarySetting() + { + return changeSummarySettingEClass; + } + + /** + * + * + * @generated + */ + public EClass getDataGraph() + { + return dataGraphEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getDataGraph_ResourceSet() + { + return (EAttribute)dataGraphEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getDataGraph_RootResource() + { + return (EAttribute)dataGraphEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getDataGraph_EChangeSummary() + { + return (EReference)dataGraphEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getDataGraph_ERootObject() + { + return (EReference)dataGraphEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EClass getDataObject() + { + return dataObjectEClass; + } + + /** + * + * + * @generated + */ + public EClass getProperty() + { + return propertyEClass; + } + + /** + * + * + * @generated + */ + public EClass getSequence() + { + return sequenceEClass; + } + + /** + * + * + * @generated + */ + public EClass getType() + { + return typeEClass; + } + + /** + * + * + * @generated + */ + public EClass getAnyTypeDataObject() + { + return anyTypeDataObjectEClass; + } + + /** + * + * + * @generated + */ + public EClass getSimpleAnyTypeDataObject() + { + return simpleAnyTypeDataObjectEClass; + } + + /** + * + * + * @generated + */ + public EClass getClass_() + { + return classEClass; + } + + /** + * + * + * @generated + */ + public EClass getDataType() + { + return dataTypeEClass; + } + + /** + * + * + * @generated + */ + public EClass getAttribute() + { + return attributeEClass; + } + + /** + * + * + * @generated + */ + public EClass getReference() + { + return referenceEClass; + } + + /** + * + * + * @generated + */ + public EClass getEnum() + { + return enumEClass; + } + + /** + * + * + * @generated + */ + public EClass getDynamicDataObject() + { + return dynamicDataObjectEClass; + } + + /** + * + * + * @generated + */ + public EClass getStoreDataObject() + { + return storeDataObjectEClass; + } + + /** + * + * + * @generated + */ + public EClass getDynamicStoreDataObject() + { + return dynamicStoreDataObjectEClass; + } + + /** + * + * + * @generated + */ + public EDataType getEJavaList() + { + return eJavaListEDataType; + } + + /** + * + * + * @generated + */ + public EDataType getEObjectStreamException() + { + return eObjectStreamExceptionEDataType; + } + + /** + * + * + * @generated + */ + public SDOFactory getSDOFactory() + { + return (SDOFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + changeSummaryEClass = createEClass(CHANGE_SUMMARY); + createEReference(changeSummaryEClass, CHANGE_SUMMARY__EDATA_GRAPH); + + changeSummarySettingEClass = createEClass(CHANGE_SUMMARY_SETTING); + + dataGraphEClass = createEClass(DATA_GRAPH); + createEAttribute(dataGraphEClass, DATA_GRAPH__RESOURCE_SET); + createEAttribute(dataGraphEClass, DATA_GRAPH__ROOT_RESOURCE); + createEReference(dataGraphEClass, DATA_GRAPH__ECHANGE_SUMMARY); + createEReference(dataGraphEClass, DATA_GRAPH__EROOT_OBJECT); + + dataObjectEClass = createEClass(DATA_OBJECT); + + propertyEClass = createEClass(PROPERTY); + + sequenceEClass = createEClass(SEQUENCE); + + typeEClass = createEClass(TYPE); + + anyTypeDataObjectEClass = createEClass(ANY_TYPE_DATA_OBJECT); + + simpleAnyTypeDataObjectEClass = createEClass(SIMPLE_ANY_TYPE_DATA_OBJECT); + + classEClass = createEClass(CLASS); + + dataTypeEClass = createEClass(DATA_TYPE); + + attributeEClass = createEClass(ATTRIBUTE); + + referenceEClass = createEClass(REFERENCE); + + enumEClass = createEClass(ENUM); + + dynamicDataObjectEClass = createEClass(DYNAMIC_DATA_OBJECT); + + storeDataObjectEClass = createEClass(STORE_DATA_OBJECT); + + dynamicStoreDataObjectEClass = createEClass(DYNAMIC_STORE_DATA_OBJECT); + + // Create data types + eJavaListEDataType = createEDataType(EJAVA_LIST); + eObjectStreamExceptionEDataType = createEDataType(EOBJECT_STREAM_EXCEPTION); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + ChangePackageImpl theChangePackage = (ChangePackageImpl)EPackage.Registry.INSTANCE.getEPackage(ChangePackage.eNS_URI); + EcorePackageImpl theEcorePackage = (EcorePackageImpl)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); + XMLTypePackageImpl theXMLTypePackage = (XMLTypePackageImpl)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); + + // Add supertypes to classes + changeSummaryEClass.getESuperTypes().add(theChangePackage.getChangeDescription()); + changeSummarySettingEClass.getESuperTypes().add(theChangePackage.getFeatureChange()); + dataGraphEClass.getESuperTypes().add(theEcorePackage.getEObject()); + anyTypeDataObjectEClass.getESuperTypes().add(this.getDataObject()); + anyTypeDataObjectEClass.getESuperTypes().add(theXMLTypePackage.getAnyType()); + simpleAnyTypeDataObjectEClass.getESuperTypes().add(this.getAnyTypeDataObject()); + simpleAnyTypeDataObjectEClass.getESuperTypes().add(theXMLTypePackage.getSimpleAnyType()); + classEClass.getESuperTypes().add(theEcorePackage.getEClass()); + classEClass.getESuperTypes().add(this.getType()); + dataTypeEClass.getESuperTypes().add(theEcorePackage.getEDataType()); + dataTypeEClass.getESuperTypes().add(this.getType()); + attributeEClass.getESuperTypes().add(theEcorePackage.getEAttribute()); + attributeEClass.getESuperTypes().add(this.getProperty()); + referenceEClass.getESuperTypes().add(theEcorePackage.getEReference()); + referenceEClass.getESuperTypes().add(this.getProperty()); + enumEClass.getESuperTypes().add(theEcorePackage.getEEnum()); + enumEClass.getESuperTypes().add(this.getType()); + dynamicDataObjectEClass.getESuperTypes().add(this.getDataObject()); + storeDataObjectEClass.getESuperTypes().add(this.getDataObject()); + dynamicStoreDataObjectEClass.getESuperTypes().add(this.getStoreDataObject()); + + // Initialize classes and features; add operations and parameters + initEClass(changeSummaryEClass, ChangeSummary.class, "ChangeSummary", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + initEReference(getChangeSummary_EDataGraph(), this.getDataGraph(), this.getDataGraph_EChangeSummary(), "eDataGraph", null, 1, 1, ChangeSummary.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + addEOperation(changeSummaryEClass, null, "beginLogging"); + + addEOperation(changeSummaryEClass, null, "endLogging"); + + EOperation op = addEOperation(changeSummaryEClass, ecorePackage.getEBoolean(), "isCreated"); + addEParameter(op, this.getDataObject(), "dataObject"); + + op = addEOperation(changeSummaryEClass, ecorePackage.getEBoolean(), "isDeleted"); + addEParameter(op, this.getDataObject(), "dataObject"); + + op = addEOperation(changeSummaryEClass, this.getEJavaList(), "getOldValues"); + addEParameter(op, this.getDataObject(), "dataObject"); + + op = addEOperation(changeSummaryEClass, ecorePackage.getEBoolean(), "isModified"); + addEParameter(op, this.getDataObject(), "dataObject"); + + op = addEOperation(changeSummaryEClass, this.getChangeSummarySetting(), "getOldValue"); + addEParameter(op, this.getDataObject(), "dataObject"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(changeSummaryEClass, this.getDataObject(), "getOldContainer"); + addEParameter(op, this.getDataObject(), "dataObject"); + + op = addEOperation(changeSummaryEClass, this.getProperty(), "getOldContainmentProperty"); + addEParameter(op, this.getDataObject(), "dataObject"); + + op = addEOperation(changeSummaryEClass, this.getSequence(), "getOldSequence"); + addEParameter(op, this.getDataObject(), "dataObject"); + + addEOperation(changeSummaryEClass, null, "undoChanges"); + + addEOperation(changeSummaryEClass, ecorePackage.getEBoolean(), "isLogging"); + + addEOperation(changeSummaryEClass, this.getDataGraph(), "getDataGraph"); + + addEOperation(changeSummaryEClass, this.getEJavaList(), "getChangedObjects"); + + addEOperation(changeSummaryEClass, this.getDataObject(), "getRootObject"); + + initEClass(changeSummarySettingEClass, ChangeSummary.Setting.class, "ChangeSummarySetting", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + addEOperation(changeSummarySettingEClass, ecorePackage.getEBoolean(), "isSet"); + + addEOperation(changeSummarySettingEClass, theEcorePackage.getEJavaObject(), "getValue"); + + addEOperation(changeSummarySettingEClass, this.getProperty(), "getProperty"); + + initEClass(dataGraphEClass, DataGraph.class, "DataGraph", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDataGraph_ResourceSet(), theEcorePackage.getEResourceSet(), "resourceSet", null, 0, 1, DataGraph.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDataGraph_RootResource(), theEcorePackage.getEResource(), "rootResource", null, 0, 1, DataGraph.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + initEReference(getDataGraph_EChangeSummary(), this.getChangeSummary(), this.getChangeSummary_EDataGraph(), "eChangeSummary", null, 1, 1, DataGraph.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDataGraph_ERootObject(), theEcorePackage.getEObject(), null, "eRootObject", null, 1, 1, DataGraph.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + op = addEOperation(dataGraphEClass, this.getDataObject(), "createRootObject"); + addEParameter(op, ecorePackage.getEString(), "namespaceURI"); + addEParameter(op, ecorePackage.getEString(), "typeName"); + + op = addEOperation(dataGraphEClass, this.getDataObject(), "createRootObject"); + addEParameter(op, this.getType(), "type"); + + op = addEOperation(dataGraphEClass, this.getType(), "getType"); + addEParameter(op, ecorePackage.getEString(), "namespaceURI"); + addEParameter(op, ecorePackage.getEString(), "typeName"); + + addEOperation(dataGraphEClass, this.getDataObject(), "getRootObject"); + + addEOperation(dataGraphEClass, this.getChangeSummary(), "getChangeSummary"); + + initEClass(dataObjectEClass, DataObject.class, "DataObject", IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEJavaObject(), "get"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, null, "set"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, theEcorePackage.getEJavaObject(), "value"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEBoolean(), "isSet"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, null, "unset"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEJavaObject(), "get"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, null, "set"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, theEcorePackage.getEJavaObject(), "value"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEBoolean(), "isSet"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, null, "unset"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEJavaObject(), "get"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, null, "set"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, theEcorePackage.getEJavaObject(), "value"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEBoolean(), "isSet"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, null, "unset"); + addEParameter(op, this.getProperty(), "property"); + + addEOperation(dataObjectEClass, this.getDataObject(), "getContainer"); + + addEOperation(dataObjectEClass, this.getProperty(), "getContainmentProperty"); + + addEOperation(dataObjectEClass, this.getDataGraph(), "getDataGraph"); + + addEOperation(dataObjectEClass, this.getType(), "getType"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEBigDecimal(), "getBigDecimal"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEBigInteger(), "getBigInteger"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEBoolean(), "getBoolean"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEByte(), "getByte"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEByteArray(), "getBytes"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEChar(), "getChar"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, this.getDataObject(), "getDataObject"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEDate(), "getDate"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEDouble(), "getDouble"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEFloat(), "getFloat"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEInt(), "getInt"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, this.getEJavaList(), "getList"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, ecorePackage.getELong(), "getLong"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, this.getSequence(), "getSequence"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEShort(), "getShort"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEString(), "getString"); + addEParameter(op, ecorePackage.getEString(), "path"); + + op = addEOperation(dataObjectEClass, null, "setBigDecimal"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, theEcorePackage.getEBigDecimal(), "value"); + + op = addEOperation(dataObjectEClass, null, "setBigInteger"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, theEcorePackage.getEBigInteger(), "value"); + + op = addEOperation(dataObjectEClass, null, "setBoolean"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, ecorePackage.getEBoolean(), "value"); + + op = addEOperation(dataObjectEClass, null, "setByte"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, ecorePackage.getEByte(), "value"); + + op = addEOperation(dataObjectEClass, null, "setBytes"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, theEcorePackage.getEByteArray(), "value"); + + op = addEOperation(dataObjectEClass, null, "setChar"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, ecorePackage.getEChar(), "value"); + + op = addEOperation(dataObjectEClass, null, "setDataObject"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, this.getDataObject(), "value"); + + op = addEOperation(dataObjectEClass, null, "setDate"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, theEcorePackage.getEDate(), "value"); + + op = addEOperation(dataObjectEClass, null, "setDouble"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, ecorePackage.getEDouble(), "value"); + + op = addEOperation(dataObjectEClass, null, "setFloat"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, ecorePackage.getEFloat(), "value"); + + op = addEOperation(dataObjectEClass, null, "setInt"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, ecorePackage.getEInt(), "value"); + + op = addEOperation(dataObjectEClass, null, "setList"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, this.getEJavaList(), "value"); + + op = addEOperation(dataObjectEClass, null, "setLong"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, ecorePackage.getELong(), "value"); + + op = addEOperation(dataObjectEClass, null, "setShort"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, ecorePackage.getEShort(), "value"); + + op = addEOperation(dataObjectEClass, null, "setString"); + addEParameter(op, ecorePackage.getEString(), "path"); + addEParameter(op, ecorePackage.getEString(), "value"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEBigDecimal(), "getBigDecimal"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEBigInteger(), "getBigInteger"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEBoolean(), "getBoolean"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEByte(), "getByte"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEByteArray(), "getBytes"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEChar(), "getChar"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, this.getDataObject(), "getDataObject"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEDate(), "getDate"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEDouble(), "getDouble"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEFloat(), "getFloat"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEInt(), "getInt"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, this.getEJavaList(), "getList"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, ecorePackage.getELong(), "getLong"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, this.getSequence(), "getSequence"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEShort(), "getShort"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEString(), "getString"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, null, "setBigDecimal"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, theEcorePackage.getEBigDecimal(), "value"); + + op = addEOperation(dataObjectEClass, null, "setBigInteger"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, theEcorePackage.getEBigInteger(), "value"); + + op = addEOperation(dataObjectEClass, null, "setBoolean"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, ecorePackage.getEBoolean(), "value"); + + op = addEOperation(dataObjectEClass, null, "setByte"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, ecorePackage.getEByte(), "value"); + + op = addEOperation(dataObjectEClass, null, "setBytes"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, theEcorePackage.getEByteArray(), "value"); + + op = addEOperation(dataObjectEClass, null, "setChar"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, ecorePackage.getEChar(), "value"); + + op = addEOperation(dataObjectEClass, null, "setDataObject"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, this.getDataObject(), "value"); + + op = addEOperation(dataObjectEClass, null, "setDate"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, theEcorePackage.getEDate(), "value"); + + op = addEOperation(dataObjectEClass, null, "setDouble"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, ecorePackage.getEDouble(), "value"); + + op = addEOperation(dataObjectEClass, null, "setFloat"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, ecorePackage.getEFloat(), "value"); + + op = addEOperation(dataObjectEClass, null, "setInt"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, ecorePackage.getEInt(), "value"); + + op = addEOperation(dataObjectEClass, null, "setList"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, this.getEJavaList(), "value"); + + op = addEOperation(dataObjectEClass, null, "setLong"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, ecorePackage.getELong(), "value"); + + op = addEOperation(dataObjectEClass, null, "setShort"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, ecorePackage.getEShort(), "value"); + + op = addEOperation(dataObjectEClass, null, "setString"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, ecorePackage.getEString(), "value"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEBigDecimal(), "getBigDecimal"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEBigInteger(), "getBigInteger"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEBoolean(), "getBoolean"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEByte(), "getByte"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEByteArray(), "getBytes"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEChar(), "getChar"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, this.getDataObject(), "getDataObject"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, theEcorePackage.getEDate(), "getDate"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEDouble(), "getDouble"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEFloat(), "getFloat"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEInt(), "getInt"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, this.getEJavaList(), "getList"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, ecorePackage.getELong(), "getLong"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, this.getSequence(), "getSequence"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEShort(), "getShort"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, ecorePackage.getEString(), "getString"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, null, "setBigDecimal"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, theEcorePackage.getEBigDecimal(), "value"); + + op = addEOperation(dataObjectEClass, null, "setBigInteger"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, theEcorePackage.getEBigInteger(), "value"); + + op = addEOperation(dataObjectEClass, null, "setBoolean"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, ecorePackage.getEBoolean(), "value"); + + op = addEOperation(dataObjectEClass, null, "setByte"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, ecorePackage.getEByte(), "value"); + + op = addEOperation(dataObjectEClass, null, "setBytes"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, theEcorePackage.getEByteArray(), "value"); + + op = addEOperation(dataObjectEClass, null, "setChar"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, ecorePackage.getEChar(), "value"); + + op = addEOperation(dataObjectEClass, null, "setDataObject"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, this.getDataObject(), "value"); + + op = addEOperation(dataObjectEClass, null, "setDate"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, theEcorePackage.getEDate(), "value"); + + op = addEOperation(dataObjectEClass, null, "setDouble"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, ecorePackage.getEDouble(), "value"); + + op = addEOperation(dataObjectEClass, null, "setFloat"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, ecorePackage.getEFloat(), "value"); + + op = addEOperation(dataObjectEClass, null, "setInt"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, ecorePackage.getEInt(), "value"); + + op = addEOperation(dataObjectEClass, null, "setList"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, this.getEJavaList(), "value"); + + op = addEOperation(dataObjectEClass, null, "setLong"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, ecorePackage.getELong(), "value"); + + op = addEOperation(dataObjectEClass, null, "setShort"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, ecorePackage.getEShort(), "value"); + + op = addEOperation(dataObjectEClass, null, "setString"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, ecorePackage.getEString(), "value"); + + op = addEOperation(dataObjectEClass, this.getDataObject(), "createDataObject"); + addEParameter(op, ecorePackage.getEString(), "propertyName"); + + op = addEOperation(dataObjectEClass, this.getDataObject(), "createDataObject"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + + op = addEOperation(dataObjectEClass, this.getDataObject(), "createDataObject"); + addEParameter(op, this.getProperty(), "property"); + + op = addEOperation(dataObjectEClass, this.getDataObject(), "createDataObject"); + addEParameter(op, ecorePackage.getEString(), "propertyName"); + addEParameter(op, ecorePackage.getEString(), "namespaceURI"); + addEParameter(op, ecorePackage.getEString(), "typeName"); + + op = addEOperation(dataObjectEClass, this.getDataObject(), "createDataObject"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, ecorePackage.getEString(), "namespaceURI"); + addEParameter(op, ecorePackage.getEString(), "typeName"); + + op = addEOperation(dataObjectEClass, this.getDataObject(), "createDataObject"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, this.getType(), "type"); + + addEOperation(dataObjectEClass, null, "delete"); + + addEOperation(dataObjectEClass, this.getSequence(), "getSequence"); + + addEOperation(dataObjectEClass, this.getEJavaList(), "getInstanceProperties"); + + op = addEOperation(dataObjectEClass, this.getProperty(), "getProperty"); + addEParameter(op, ecorePackage.getEString(), "propertyName"); + + addEOperation(dataObjectEClass, this.getDataObject(), "getRootObject"); + + addEOperation(dataObjectEClass, this.getChangeSummary(), "getChangeSummary"); + + addEOperation(dataObjectEClass, null, "detach"); + + initEClass(propertyEClass, Property.class, "Property", IS_ABSTRACT, IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + addEOperation(propertyEClass, ecorePackage.getEString(), "getName"); + + addEOperation(propertyEClass, this.getType(), "getType"); + + addEOperation(propertyEClass, ecorePackage.getEBoolean(), "isMany"); + + addEOperation(propertyEClass, ecorePackage.getEBoolean(), "isContainment"); + + addEOperation(propertyEClass, ecorePackage.getEBoolean(), "isReadOnly"); + + addEOperation(propertyEClass, this.getType(), "getContainingType"); + + addEOperation(propertyEClass, this.getEJavaList(), "getAliasNames"); + + addEOperation(propertyEClass, this.getProperty(), "getOpposite"); + + addEOperation(propertyEClass, theEcorePackage.getEJavaObject(), "getDefault"); + + initEClass(sequenceEClass, Sequence.class, "Sequence", IS_ABSTRACT, IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + addEOperation(sequenceEClass, ecorePackage.getEInt(), "size"); + + op = addEOperation(sequenceEClass, this.getProperty(), "getProperty"); + addEParameter(op, ecorePackage.getEInt(), "index"); + + op = addEOperation(sequenceEClass, theEcorePackage.getEJavaObject(), "getValue"); + addEParameter(op, ecorePackage.getEInt(), "index"); + + op = addEOperation(sequenceEClass, theEcorePackage.getEJavaObject(), "setValue"); + addEParameter(op, ecorePackage.getEInt(), "index"); + addEParameter(op, theEcorePackage.getEJavaObject(), "value"); + + op = addEOperation(sequenceEClass, ecorePackage.getEBoolean(), "add"); + addEParameter(op, ecorePackage.getEString(), "propertyName"); + addEParameter(op, theEcorePackage.getEJavaObject(), "value"); + + op = addEOperation(sequenceEClass, ecorePackage.getEBoolean(), "add"); + addEParameter(op, ecorePackage.getEInt(), "propertIndex"); + addEParameter(op, theEcorePackage.getEJavaObject(), "value"); + + op = addEOperation(sequenceEClass, ecorePackage.getEBoolean(), "add"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, theEcorePackage.getEJavaObject(), "value"); + + op = addEOperation(sequenceEClass, null, "add"); + addEParameter(op, ecorePackage.getEInt(), "index"); + addEParameter(op, ecorePackage.getEString(), "propertyName"); + addEParameter(op, theEcorePackage.getEJavaObject(), "value"); + + op = addEOperation(sequenceEClass, null, "add"); + addEParameter(op, ecorePackage.getEInt(), "index"); + addEParameter(op, ecorePackage.getEInt(), "propertyIndex"); + addEParameter(op, theEcorePackage.getEJavaObject(), "value"); + + op = addEOperation(sequenceEClass, null, "add"); + addEParameter(op, ecorePackage.getEInt(), "index"); + addEParameter(op, this.getProperty(), "property"); + addEParameter(op, theEcorePackage.getEJavaObject(), "value"); + + op = addEOperation(sequenceEClass, null, "add"); + addEParameter(op, ecorePackage.getEString(), "text"); + + op = addEOperation(sequenceEClass, null, "add"); + addEParameter(op, ecorePackage.getEInt(), "index"); + addEParameter(op, ecorePackage.getEString(), "text"); + + initEClass(typeEClass, Type.class, "Type", IS_ABSTRACT, IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + addEOperation(typeEClass, ecorePackage.getEString(), "getName"); + + addEOperation(typeEClass, ecorePackage.getEString(), "getURI"); + + addEOperation(typeEClass, theEcorePackage.getEJavaClass(), "getInstanceClass"); + + op = addEOperation(typeEClass, ecorePackage.getEBoolean(), "isInstance"); + addEParameter(op, theEcorePackage.getEJavaObject(), "object"); + + addEOperation(typeEClass, ecorePackage.getEBoolean(), "isDataType"); + + addEOperation(typeEClass, ecorePackage.getEBoolean(), "isSequenced"); + + addEOperation(typeEClass, ecorePackage.getEBoolean(), "isOpen"); + + addEOperation(typeEClass, ecorePackage.getEBoolean(), "isAbstract"); + + addEOperation(typeEClass, this.getEJavaList(), "getBaseTypes"); + + addEOperation(typeEClass, this.getEJavaList(), "getAliasNames"); + + addEOperation(typeEClass, this.getEJavaList(), "getProperties"); + + addEOperation(typeEClass, this.getEJavaList(), "getDeclaredProperties"); + + op = addEOperation(typeEClass, this.getProperty(), "getProperty"); + addEParameter(op, ecorePackage.getEString(), "propertyName"); + + initEClass(anyTypeDataObjectEClass, AnyTypeDataObject.class, "AnyTypeDataObject", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(simpleAnyTypeDataObjectEClass, SimpleAnyTypeDataObject.class, "SimpleAnyTypeDataObject", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(classEClass, Type.class, "Class", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + initEClass(dataTypeEClass, Type.class, "DataType", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + initEClass(attributeEClass, Property.class, "Attribute", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + initEClass(referenceEClass, Property.class, "Reference", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + initEClass(enumEClass, Type.class, "Enum", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + initEClass(dynamicDataObjectEClass, DataObject.class, "DynamicDataObject", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + initEClass(storeDataObjectEClass, DataObject.class, "StoreDataObject", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + initEClass(dynamicStoreDataObjectEClass, DataObject.class, "DynamicStoreDataObject", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + + // Initialize data types + initEDataType(eJavaListEDataType, List.class, "EJavaList", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(eObjectStreamExceptionEDataType, ObjectStreamException.class, "EObjectStreamException", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http://www.eclipse.org/emf/2002/GenModel + createGenModelAnnotations(); + // http:///org/eclipse/emf/ecore/util/ExtendedMetaData + createExtendedMetaDataAnnotations(); + } + + /** + * Initializes the annotations for http://www.eclipse.org/emf/2002/GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() + { + String source = "http://www.eclipse.org/emf/2002/GenModel"; + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(0), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.get(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(1), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.set(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(2), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.isSet(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(3), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.unset(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(4), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.get(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(5), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.set(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(6), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.isSet(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(7), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.unset(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(8), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.get(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(9), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.set(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(10), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.isSet(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(11), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.unset(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(12), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getContainer(this);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(13), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getContainmentProperty(this);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(14), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getDataGraph(this);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(15), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getType(this);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(16), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBigDecimal(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(17), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBigInteger(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(18), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBoolean(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(19), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getByte(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(20), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBytes(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(21), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getChar(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(22), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getDataObject(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(23), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getDate(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(24), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getDouble(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(25), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getFloat(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(26), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getInt(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(27), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getList(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(28), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getLong(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(29), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getSequence(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(30), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getShort(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(31), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getString(this, path);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(32), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBigDecimal(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(33), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBigInteger(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(34), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBoolean(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(35), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setByte(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(36), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBytes(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(37), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setChar(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(38), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setDataObject(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(39), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setDate(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(40), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setDouble(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(41), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setFloat(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(42), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setInt(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(43), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setList(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(44), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setLong(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(45), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setShort(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(46), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setString(this, path, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(47), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBigDecimal(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(48), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBigInteger(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(49), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBoolean(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(50), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getByte(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(51), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBytes(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(52), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getChar(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(53), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getDataObject(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(54), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getDate(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(55), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getDouble(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(56), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getFloat(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(57), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getInt(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(58), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getList(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(59), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getLong(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(60), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getSequence(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(61), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getShort(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(62), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getString(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(63), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBigDecimal(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(64), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBigInteger(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(65), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBoolean(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(66), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setByte(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(67), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBytes(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(68), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setChar(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(69), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setDataObject(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(70), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setDate(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(71), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setDouble(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(72), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setFloat(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(73), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setInt(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(74), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setList(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(75), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setLong(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(76), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setShort(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(77), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setString(this, propertyIndex, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(78), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBigDecimal(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(79), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBigInteger(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(80), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBoolean(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(81), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getByte(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(82), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getBytes(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(83), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getChar(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(84), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getDataObject(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(85), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getDate(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(86), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getDouble(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(87), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getFloat(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(88), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getInt(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(89), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getList(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(90), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getLong(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(91), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getSequence(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(92), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getShort(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(93), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getString(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(94), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBigDecimal(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(95), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBigInteger(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(96), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBoolean(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(97), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setByte(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(98), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setBytes(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(99), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setChar(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(100), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setDataObject(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(101), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setDate(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(102), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setDouble(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(103), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setFloat(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(104), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setInt(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(105), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setList(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(106), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setLong(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(107), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setShort(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(108), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.setString(this, property, value);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(109), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyName);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(110), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyIndex);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(111), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, property);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(112), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyName, namespaceURI, typeName);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(113), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, propertyIndex, namespaceURI, typeName);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(114), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.createDataObject(this, property, type);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(115), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.delete(this);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(116), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getSequence(this);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(117), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getInstanceProperties(this);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(118), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getProperty(this, propertyName);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(119), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getRootObject(this);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(120), + source, + new String[] + { + "body", "return <%org.apache.sdo.util.SDOUtil%>.getChangeSummary(this);" + }); + addAnnotation + ((EOperation)dataObjectEClass.getEOperations().get(121), + source, + new String[] + { + "body", "<%org.apache.sdo.util.SDOUtil%>.detach(this);" + }); + } + + /** + * Initializes the annotations for http:///org/eclipse/emf/ecore/util/ExtendedMetaData. + * + * + * @generated + */ + protected void createExtendedMetaDataAnnotations() + { + String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; + addAnnotation + (anyTypeDataObjectEClass, + source, + new String[] + { + "kind", "mixed" + }); + addAnnotation + (simpleAnyTypeDataObjectEClass, + source, + new String[] + { + "kind", "simple" + }); + } + +} //SDOPackageImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SimpleAnyTypeDataObjectImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SimpleAnyTypeDataObjectImpl.java new file mode 100644 index 0000000000..33ca015ac9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/SimpleAnyTypeDataObjectImpl.java @@ -0,0 +1,330 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import java.util.Iterator; + +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.SimpleAnyTypeDataObject; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.xml.type.SimpleAnyType; +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; + +/** + * + * An implementation of the model object 'EData Object Simple Any Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.impl.SimpleAnyTypeDataObjectImpl#getRawValue Raw Value}
  • + *
  • {@link org.apache.tuscany.sdo.impl.SimpleAnyTypeDataObjectImpl#getValue Value}
  • + *
  • {@link org.apache.tuscany.sdo.impl.SimpleAnyTypeDataObjectImpl#getInstanceType Instance Type}
  • + *
+ *

+ * + * @generated + */ +public class SimpleAnyTypeDataObjectImpl extends AnyTypeDataObjectImpl implements SimpleAnyTypeDataObject +{ + /** + * The default value of the '{@link #getRawValue() Raw Value}' attribute. + * + * + * @see #getRawValue() + * @generated + * @ordered + */ + protected static final String RAW_VALUE_EDEFAULT = null; + + /** + * The default value of the '{@link #getValue() Value}' attribute. + * + * + * @see #getValue() + * @generated + * @ordered + */ + protected static final Object VALUE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getInstanceType() Instance Type}' reference. + * + * + * @see #getInstanceType() + * @generated + * @ordered + */ + protected EDataType instanceType = null; + + /** + * + * + * @generated + */ + protected SimpleAnyTypeDataObjectImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getSimpleAnyTypeDataObject(); + } + + /** + * + * + * @generated NOT + */ + public String getRawValue() + { + StringBuffer value = new StringBuffer(); + for (Iterator i = getMixed().iterator(); i.hasNext(); ) + { + FeatureMap.Entry entry = (FeatureMap.Entry)i.next(); + if (entry.getEStructuralFeature() == XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text()) + { + value.append(entry.getValue()); + } + } + return value.toString(); + } + + /** + * + * + * @generated NOT + */ + public void setRawValue(String newRawValue) + { + getMixed().clear(); + if (newRawValue != null) + { + getMixed().add(XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text(), newRawValue); + } + } + + /** + * + * + * @generated NOT + */ + public Object getValue() + { + return EcoreUtil.createFromString(instanceType, getRawValue()); + } + + /** + * + * + * @generated NOT + */ + public void setValue(Object newValue) + { + setRawValue(EcoreUtil.convertToString(instanceType, newValue)); + } + + /** + * + * + * @generated + */ + public EDataType getInstanceType() + { + return instanceType; + } + + /** + * + * + * @generated + */ + public void setInstanceType(EDataType newInstanceType) + { + EDataType oldInstanceType = instanceType; + instanceType = newInstanceType; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE, oldInstanceType, instanceType)); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__MIXED: + if (coreType) return getMixed(); + return ((FeatureMap.Internal)getMixed()).getWrapper(); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__ANY: + if (coreType) return getAny(); + return ((FeatureMap.Internal)getAny()).getWrapper(); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: + if (coreType) return getAnyAttribute(); + return ((FeatureMap.Internal)getAnyAttribute()).getWrapper(); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE: + return getRawValue(); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE: + return getValue(); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE: + return getInstanceType(); + } + return eDynamicGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__MIXED: + ((FeatureMap.Internal)getMixed()).set(newValue); + return; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__ANY: + ((FeatureMap.Internal)getAny()).set(newValue); + return; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: + ((FeatureMap.Internal)getAnyAttribute()).set(newValue); + return; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE: + setRawValue((String)newValue); + return; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE: + setValue((Object)newValue); + return; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE: + setInstanceType((EDataType)newValue); + return; + } + eDynamicSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__MIXED: + getMixed().clear(); + return; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__ANY: + getAny().clear(); + return; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: + getAnyAttribute().clear(); + return; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE: + setRawValue(RAW_VALUE_EDEFAULT); + return; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE: + setValue(VALUE_EDEFAULT); + return; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE: + setInstanceType((EDataType)null); + return; + } + eDynamicUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__MIXED: + return mixed != null && !mixed.isEmpty(); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__ANY: + return !getAny().isEmpty(); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__ANY_ATTRIBUTE: + return anyAttribute != null && !anyAttribute.isEmpty(); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE: + return RAW_VALUE_EDEFAULT == null ? getRawValue() != null : !RAW_VALUE_EDEFAULT.equals(getRawValue()); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE: + return VALUE_EDEFAULT == null ? getValue() != null : !VALUE_EDEFAULT.equals(getValue()); + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE: + return instanceType != null; + } + return eDynamicIsSet(featureID); + } + + /** + * + * + * @generated + */ + public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) + { + if (baseClass == SimpleAnyType.class) + { + switch (derivedFeatureID) + { + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE: return XMLTypePackage.SIMPLE_ANY_TYPE__RAW_VALUE; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE: return XMLTypePackage.SIMPLE_ANY_TYPE__VALUE; + case SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE: return XMLTypePackage.SIMPLE_ANY_TYPE__INSTANCE_TYPE; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * + * + * @generated + */ + public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) + { + if (baseClass == SimpleAnyType.class) + { + switch (baseFeatureID) + { + case XMLTypePackage.SIMPLE_ANY_TYPE__RAW_VALUE: return SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__RAW_VALUE; + case XMLTypePackage.SIMPLE_ANY_TYPE__VALUE: return SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__VALUE; + case XMLTypePackage.SIMPLE_ANY_TYPE__INSTANCE_TYPE: return SDOPackage.SIMPLE_ANY_TYPE_DATA_OBJECT__INSTANCE_TYPE; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + +} //EDataObjectSimpleAnyTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/StoreDataObjectImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/StoreDataObjectImpl.java new file mode 100644 index 0000000000..06bb3a6d05 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/StoreDataObjectImpl.java @@ -0,0 +1,311 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.impl; + +import org.apache.tuscany.sdo.SDOPackage; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.EStoreEObjectImpl.EStoreEList; +import org.eclipse.emf.ecore.impl.EStoreEObjectImpl.EStoreFeatureMap; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.FeatureMapUtil; + +import commonj.sdo.DataObject; + +/** + * + * An implementation of the model object 'Store Data Object'. + * @extends EStructuralFeature.Internal.DynamicValueHolder + * + *

+ *

+ * + * @generated + */ +public class StoreDataObjectImpl extends DataObjectImpl implements DataObject, EStructuralFeature.Internal.DynamicValueHolder +{ + //TODO consider factoring the eSettings code into a new base class that this and DynamicDataObjectImpl could extend + + protected static final Object [] ENO_SETTINGS = new Object [0]; + protected static final InternalEObject EUNINITIALIZED_CONTAINER = new DynamicDataObjectImpl(); + + protected Object [] eSettings; + protected InternalEObject.EStore eStore; + + /** + * Creates a store-based DataObject. + */ + public StoreDataObjectImpl() + { + super(); + eContainer = EUNINITIALIZED_CONTAINER; + } + + /** + * Creates a store-based DataObject. + */ + public StoreDataObjectImpl(InternalEObject.EStore eStore) + { + super(); + eSetStore(eStore); + eContainer = EUNINITIALIZED_CONTAINER; + } + + /** + * Creates a store-based DataObject. + */ + public StoreDataObjectImpl(EClass eClass) + { + super(); + eSetClass(eClass); + eContainer = EUNINITIALIZED_CONTAINER; + } + + /** + * Creates a store-based DataObject. + */ + public StoreDataObjectImpl(EClass eClass, InternalEObject.EStore eStore) + { + super(); + eSetClass(eClass); + eSetStore(eStore); + eContainer = EUNINITIALIZED_CONTAINER; + } + + protected boolean eIsCaching() + { + return true; + } + + public Object dynamicGet(int dynamicFeatureID) + { + Object result = eSettings[dynamicFeatureID]; + if (result == null) + { + EStructuralFeature eStructuralFeature = eDynamicFeature(dynamicFeatureID); + if (!eStructuralFeature.isTransient()) + { + if (FeatureMapUtil.isFeatureMap(eStructuralFeature)) + { + eSettings[dynamicFeatureID] = result = createFeatureMap(eStructuralFeature); + } + else if (eStructuralFeature.isMany()) + { + eSettings[dynamicFeatureID] = result = createList(eStructuralFeature); + } + else + { + result = eStore().get(this, eStructuralFeature, InternalEObject.EStore.NO_INDEX); + if (eIsCaching()) + { + eSettings[dynamicFeatureID] = result; + } + } + } + } + return result; + } + + public void dynamicSet(int dynamicFeatureID, Object value) + { + EStructuralFeature eStructuralFeature = eDynamicFeature(dynamicFeatureID); + if (eStructuralFeature.isTransient()) + { + eSettings[dynamicFeatureID] = value; + } + else + { + eStore().set(this, eStructuralFeature, InternalEObject.EStore.NO_INDEX, value == NIL ? null : value); + if (eIsCaching()) + { + eSettings[dynamicFeatureID] = value; + } + } + } + + public void dynamicUnset(int dynamicFeatureID) + { + eStore().unset(this, eDynamicFeature(dynamicFeatureID)); + eSettings[dynamicFeatureID] = null; + } + + public Object eDynamicGet(int featureID, boolean resolve, boolean coreType) + { + if (featureID < eClass().getFeatureCount()) + { + EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID); + return eSettingDelegate(eFeature).dynamicGet(this, eSettings(), featureID, resolve, coreType); + } + else + { + return super.eDynamicGet(featureID, resolve, coreType); + } + } + + public void eDynamicSet(int featureID, Object newValue) + { + if (featureID < eClass().getFeatureCount()) + { + EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID); + eDynamicSet(featureID, eFeature, newValue); + } + else + { + super.eDynamicSet(featureID, newValue); + } + } + + public void eDynamicUnset(int featureID) + { + if (featureID < eClass().getFeatureCount()) + { + EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID); + eDynamicUnset(featureID, eFeature); + } + else + { + super.eDynamicUnset(featureID); + } + } + + public boolean eDynamicIsSet(int featureID) + { + if (featureID < eClass().getFeatureCount()) + { + EStructuralFeature eFeature = eClass().getEStructuralFeature(featureID); + return eFeature.isTransient() ? + eSettingDelegate(eFeature).dynamicIsSet(this, eSettings(), featureID) : + eStore().isSet(this, eFeature); + } + else + { + return super.eDynamicIsSet(featureID); + } + } + + /* + public boolean eDynamicIsSet(EStructuralFeature eStructuralFeature) + { + return + eStructuralFeature.isTransient() ? + super.eDynamicIsSet(eStructuralFeature) : + eStore().isSet(this, eStructuralFeature); + } + */ + + protected EList createList(EStructuralFeature eStructuralFeature) + { + return new EStoreEList(this, eStructuralFeature, eStore()); + } + + protected FeatureMap createFeatureMap(EStructuralFeature eStructuralFeature) + { + return new EStoreFeatureMap(this, eStructuralFeature, eStore()); + } + + public EObject eContainer() + { + if (eContainer == EUNINITIALIZED_CONTAINER) + { + eInitializeContainer(); + } + + return eContainer; + } + + public int eContainerFeatureID() + { + if (eContainer == EUNINITIALIZED_CONTAINER) + { + eInitializeContainer(); + } + + return eContainerFeatureID; + } + + protected void eInitializeContainer() + { + eContainer = eStore().getContainer(this); + if (eContainer != null) + { + EStructuralFeature eContainingFeature = eStore().getContainingFeature(this); + if (eContainingFeature instanceof EReference) + { + EReference eContainingReference = (EReference)eContainingFeature; + EReference eOpposite = eContainingReference.getEOpposite(); + if (eOpposite != null) + { + eContainerFeatureID = eClass().getFeatureID(eOpposite); + return; + } + } + + eContainerFeatureID = EOPPOSITE_FEATURE_BASE - eContainer.eClass().getFeatureID(eContainingFeature); + } + } + + public InternalEObject.EStore eStore() + { + return eStore; + } + + public void eSetStore(InternalEObject.EStore store) + { + this.eStore = store; + } + + protected int eStaticFeatureCount() + { + return 0; + } + + public int eDerivedStructuralFeatureID(EStructuralFeature eStructuralFeature) + { + return eClass().getFeatureID(eStructuralFeature); + } + + protected boolean eHasSettings() + { + return eSettings != null; + } + + protected EStructuralFeature.Internal.DynamicValueHolder eSettings() + { + if (eSettings == null) + { + int size = eClass().getFeatureCount() - eStaticFeatureCount(); + eSettings = size == 0 ? ENO_SETTINGS : new Object [size]; + } + + return this; + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SDOPackage.eINSTANCE.getStoreDataObject(); + } + +} //StoreDataObjectImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/BaseDataGraphType.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/BaseDataGraphType.java new file mode 100644 index 0000000000..05fe4d1a8f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/BaseDataGraphType.java @@ -0,0 +1,125 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + +import commonj.sdo.Sequence; + +/** + * + * A representation of the model object 'Base Data Graph Type'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.sdo.model.BaseDataGraphType#getModels Models}
  • + *
  • {@link org.apache.tuscany.sdo.model.BaseDataGraphType#getXsd Xsd}
  • + *
  • {@link org.apache.tuscany.sdo.model.BaseDataGraphType#getChangeSummary Change Summary}
  • + *
  • {@link org.apache.tuscany.sdo.model.BaseDataGraphType#getAnyAttribute Any Attribute}
  • + *
+ *

+ * + * @generated + */ +public interface BaseDataGraphType +{ + /** + * Returns the value of the 'Models' containment reference. + * + *

+ * If the meaning of the 'Models' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Models' containment reference. + * @see #setModels(ModelsType) + * @generated + */ + ModelsType getModels(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getModels Models}' containment reference. + * + * + * @param value the new value of the 'Models' containment reference. + * @see #getModels() + * @generated + */ + void setModels(ModelsType value); + + /** + * Returns the value of the 'Xsd' containment reference. + * + *

+ * If the meaning of the 'Xsd' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Xsd' containment reference. + * @see #setXsd(XSDType) + * @generated + */ + XSDType getXsd(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getXsd Xsd}' containment reference. + * + * + * @param value the new value of the 'Xsd' containment reference. + * @see #getXsd() + * @generated + */ + void setXsd(XSDType value); + + /** + * Returns the value of the 'Change Summary' containment reference. + * + *

+ * If the meaning of the 'Change Summary' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Change Summary' containment reference. + * @see #setChangeSummary(ChangeSummaryType) + * @generated + */ + ChangeSummaryType getChangeSummary_(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getChangeSummary Change Summary}' containment reference. + * + * + * @param value the new value of the 'Change Summary' containment reference. + * @see #getChangeSummary() + * @generated + */ + void setChangeSummary(ChangeSummaryType value); + + /** + * Returns the value of the 'Any Attribute' attribute list. + * + *

+ * If the meaning of the 'Any Attribute' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Any Attribute' attribute list. + * @generated + */ + Sequence getAnyAttribute(); + +} // BaseDataGraphType diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ChangeSummaryType.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ChangeSummaryType.java new file mode 100644 index 0000000000..dfdc1d0b97 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ChangeSummaryType.java @@ -0,0 +1,152 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + +import commonj.sdo.Sequence; + +/** + * + * A representation of the model object 'Change Summary Type'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.sdo.model.ChangeSummaryType#getAny Any}
  • + *
  • {@link org.apache.tuscany.sdo.model.ChangeSummaryType#getCreate Create}
  • + *
  • {@link org.apache.tuscany.sdo.model.ChangeSummaryType#getDelete Delete}
  • + *
  • {@link org.apache.tuscany.sdo.model.ChangeSummaryType#isLogging Logging}
  • + *
+ *

+ * + * @generated + */ +public interface ChangeSummaryType +{ + /** + * Returns the value of the 'Any' attribute list. + * + *

+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + + /** + * Returns the value of the 'Create' attribute. + * + *

+ * If the meaning of the 'Create' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Create' attribute. + * @see #setCreate(String) + * @generated + */ + String getCreate(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.ChangeSummaryType#getCreate Create}' attribute. + * + * + * @param value the new value of the 'Create' attribute. + * @see #getCreate() + * @generated + */ + void setCreate(String value); + + /** + * Returns the value of the 'Delete' attribute. + * + *

+ * If the meaning of the 'Delete' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Delete' attribute. + * @see #setDelete(String) + * @generated + */ + String getDelete(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.ChangeSummaryType#getDelete Delete}' attribute. + * + * + * @param value the new value of the 'Delete' attribute. + * @see #getDelete() + * @generated + */ + void setDelete(String value); + + /** + * Returns the value of the 'Logging' attribute. + * + *

+ * If the meaning of the 'Logging' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Logging' attribute. + * @see #isSetLogging() + * @see #unsetLogging() + * @see #setLogging(boolean) + * @generated + */ + boolean isLogging(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.ChangeSummaryType#isLogging Logging}' attribute. + * + * + * @param value the new value of the 'Logging' attribute. + * @see #isSetLogging() + * @see #unsetLogging() + * @see #isLogging() + * @generated + */ + void setLogging(boolean value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.sdo.model.ChangeSummaryType#isLogging Logging}' attribute. + * + * + * @see #isSetLogging() + * @see #isLogging() + * @see #setLogging(boolean) + * @generated + */ + void unsetLogging(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.ChangeSummaryType#isLogging Logging}' attribute is set. + * + * + * @return whether the value of the 'Logging' attribute is set. + * @see #unsetLogging() + * @see #isLogging() + * @see #setLogging(boolean) + * @generated + */ + boolean isSetLogging(); + +} // ChangeSummaryType diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/DataGraphType.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/DataGraphType.java new file mode 100644 index 0000000000..353d25f6ef --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/DataGraphType.java @@ -0,0 +1,50 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + +import commonj.sdo.Sequence; + +/** + * + * A representation of the model object 'Data Graph Type'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.sdo.model.DataGraphType#getAny Any}
  • + *
+ *

+ * + * @generated + */ +public interface DataGraphType extends BaseDataGraphType +{ + /** + * Returns the value of the 'Any' attribute list. + * + *

+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + +} // DataGraphType diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/DataObject.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/DataObject.java new file mode 100644 index 0000000000..9d4f7b90a8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/DataObject.java @@ -0,0 +1,30 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + + +/** + * + * A representation of the model object 'Data Object'. + * + * + * + * @generated + */ +public interface DataObject +{ +} // DataObject diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelFactory.java new file mode 100644 index 0000000000..19e59bbc5f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelFactory.java @@ -0,0 +1,100 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface ModelFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + ModelFactory INSTANCE = org.apache.tuscany.sdo.model.impl.ModelFactoryImpl.eINSTANCE; + + /** + * Returns a new object of class 'Change Summary Type'. + * + * + * @return a new object of class 'Change Summary Type'. + * @generated + */ + ChangeSummaryType createChangeSummaryType(); + + /** + * Returns a new object of class 'Data Graph Type'. + * + * + * @return a new object of class 'Data Graph Type'. + * @generated + */ + DataGraphType createDataGraphType(); + + /** + * Returns a new object of class 'Models Type'. + * + * + * @return a new object of class 'Models Type'. + * @generated + */ + ModelsType createModelsType(); + + /** + * Returns a new object of class 'Property'. + * + * + * @return a new object of class 'Property'. + * @generated + */ + Property createProperty(); + + /** + * Returns a new object of class 'Type'. + * + * + * @return a new object of class 'Type'. + * @generated + */ + Type createType(); + + /** + * Returns a new object of class 'Types'. + * + * + * @return a new object of class 'Types'. + * @generated + */ + Types createTypes(); + + /** + * Returns a new object of class 'XSD Type'. + * + * + * @return a new object of class 'XSD Type'. + * @generated + */ + XSDType createXSDType(); + +} //ModelFactory diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelPackage.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelPackage.java new file mode 100644 index 0000000000..c33ca619cc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelPackage.java @@ -0,0 +1,141 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + +import org.apache.tuscany.sdo.model.impl.ModelPackageImpl; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +public interface ModelPackage extends EPackage { + + /** + * The package name. + * + * + * @generated + */ + public static final String eNAME = "model"; + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String eNS_URI = "commonj.sdo"; + + /** + * The package namespace name. + * + * + * @generated + */ + public static final String eNS_PREFIX = "commonj"; + + public static final ModelPackage eINSTANCE = ModelPackageImpl.eINSTANCE; + + public EClass getBaseDataGraphType(); + public EReference getBaseDataGraphType_Models(); + public EReference getBaseDataGraphType_Xsd(); + public EReference getBaseDataGraphType_ChangeSummary(); + public EAttribute getBaseDataGraphType_AnyAttribute(); + public EClass getChangeSummaryType(); + public EAttribute getChangeSummaryType_Any(); + public EAttribute getChangeSummaryType_Create(); + public EAttribute getChangeSummaryType_Delete(); + public EAttribute getChangeSummaryType_Logging(); + public EClass getDataGraphType(); + public EAttribute getDataGraphType_Any(); + public EClass getDataObject(); + public EClass getDocumentRoot(); + public EAttribute getDocumentRoot_Mixed(); + public EReference getDocumentRoot_XMLNSPrefixMap(); + public EReference getDocumentRoot_XSISchemaLocation(); + public EReference getDocumentRoot_Datagraph(); + public EReference getDocumentRoot_DataObject(); + public EReference getDocumentRoot_Type(); + public EReference getDocumentRoot_Types(); + public EAttribute getDocumentRoot_Ref(); + public EClass getModelsType(); + public EAttribute getModelsType_Any(); + public EClass getProperty(); + public EAttribute getProperty_AliasName(); + public EAttribute getProperty_Any(); + public EAttribute getProperty_Containment(); + public EAttribute getProperty_Default(); + public EAttribute getProperty_Many(); + public EAttribute getProperty_Name(); + public EReference getProperty_Opposite(); + public EAttribute getProperty_ReadOnly(); + public EReference getProperty_Type(); + public EAttribute getProperty_AnyAttribute(); + public EClass getTextType(); + public EAttribute getTextType_Text(); + public EClass getType(); + public EReference getType_BaseType(); + public EReference getType_Property(); + public EAttribute getType_AliasName(); + public EAttribute getType_Any(); + public EAttribute getType_Abstract(); + public EAttribute getType_DataType(); + public EAttribute getType_Name(); + public EAttribute getType_Open(); + public EAttribute getType_Sequenced(); + public EAttribute getType_Uri(); + public EAttribute getType_AnyAttribute(); + public EClass getTypes(); + public EReference getTypes_Type(); + public EClass getXSDType(); + public EAttribute getXSDType_Any(); + public EDataType getBoolean(); + public EDataType getBooleanObject(); + public EDataType getByte(); + public EDataType getByteObject(); + public EDataType getBytes(); + public EDataType getCharacter(); + public EDataType getCharacterObject(); + public EDataType getDate(); + public EDataType getDateTime(); + public EDataType getDay(); + public EDataType getDecimal(); + public EDataType getDouble(); + public EDataType getDoubleObject(); + public EDataType getDuration(); + public EDataType getFloat(); + public EDataType getFloatObject(); + public EDataType getInt(); + public EDataType getInteger(); + public EDataType getIntObject(); + public EDataType getLong(); + public EDataType getLongObject(); + public EDataType getMonth(); + public EDataType getMonthDay(); + public EDataType getObject(); + public EDataType getShort(); + public EDataType getShortObject(); + public EDataType getString(); + public EDataType getStrings(); + public EDataType getTime(); + public EDataType getURI(); + public EDataType getYear(); + public EDataType getYearMonth(); + public EDataType getYearMonthDay(); + public ModelFactory getModelFactory(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelsType.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelsType.java new file mode 100644 index 0000000000..a05545afed --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/ModelsType.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + +import commonj.sdo.Sequence; + +/** + * + * A representation of the model object 'Models Type'. + * + * + * + * + * Expected type is emof:Package. + * + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.sdo.model.ModelsType#getAny Any}
  • + *
+ *

+ * + * @generated + */ +public interface ModelsType +{ + /** + * Returns the value of the 'Any' attribute list. + * + *

+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + +} // ModelsType diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Property.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Property.java new file mode 100644 index 0000000000..a124dee1c2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Property.java @@ -0,0 +1,342 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + +import commonj.sdo.Sequence; + +import java.util.List; + +/** + * + * A representation of the model object 'Property'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.sdo.model.Property#getAliasName Alias Name}
  • + *
  • {@link org.apache.tuscany.sdo.model.Property#getAny Any}
  • + *
  • {@link org.apache.tuscany.sdo.model.Property#isContainment Containment}
  • + *
  • {@link org.apache.tuscany.sdo.model.Property#getDefault Default}
  • + *
  • {@link org.apache.tuscany.sdo.model.Property#isMany Many}
  • + *
  • {@link org.apache.tuscany.sdo.model.Property#getName Name}
  • + *
  • {@link org.apache.tuscany.sdo.model.Property#getOpposite Opposite}
  • + *
  • {@link org.apache.tuscany.sdo.model.Property#isReadOnly Read Only}
  • + *
  • {@link org.apache.tuscany.sdo.model.Property#getType Type}
  • + *
  • {@link org.apache.tuscany.sdo.model.Property#getAnyAttribute Any Attribute}
  • + *
+ *

+ * + * Note: The getDefault and getOpposite methods had to be renamed to avoid + * conflict with the commonj.sdo.Property getDefault and getOpposite + * methods in classes that implement both. Eventually, the two interfaces + * should be brought in-line with one another -- James Snell + * + * @generated + */ +public interface Property +{ + /** + * Returns the value of the 'Alias Name' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'Alias Name' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Alias Name' attribute list. + * @generated + */ + List getAliasName(); + + /** + * Returns the value of the 'Any' attribute list. + * + *

+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + + /** + * Returns the value of the 'Containment' attribute. + * + *

+ * If the meaning of the 'Containment' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Containment' attribute. + * @see #isSetContainment() + * @see #unsetContainment() + * @see #setContainment(boolean) + * @generated + */ + boolean isContainment(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isContainment Containment}' attribute. + * + * + * @param value the new value of the 'Containment' attribute. + * @see #isSetContainment() + * @see #unsetContainment() + * @see #isContainment() + * @generated + */ + void setContainment(boolean value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#isContainment Containment}' attribute. + * + * + * @see #isSetContainment() + * @see #isContainment() + * @see #setContainment(boolean) + * @generated + */ + void unsetContainment(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isContainment Containment}' attribute is set. + * + * + * @return whether the value of the 'Containment' attribute is set. + * @see #unsetContainment() + * @see #isContainment() + * @see #setContainment(boolean) + * @generated + */ + boolean isSetContainment(); + + /** + * Returns the value of the 'Default' attribute. + * + *

+ * If the meaning of the 'Default' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Default' attribute. + * @see #setDefault(String) + * @generated NOT + */ + String getDefault_(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getDefault Default}' attribute. + * + * + * @param value the new value of the 'Default' attribute. + * @see #getDefault() + * @generated + */ + void setDefault_(String value); + + /** + * Returns the value of the 'Many' attribute. + * + *

+ * If the meaning of the 'Many' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Many' attribute. + * @see #isSetMany() + * @see #unsetMany() + * @see #setMany(boolean) + * @generated + */ + boolean isMany(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isMany Many}' attribute. + * + * + * @param value the new value of the 'Many' attribute. + * @see #isSetMany() + * @see #unsetMany() + * @see #isMany() + * @generated + */ + void setMany(boolean value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#isMany Many}' attribute. + * + * + * @see #isSetMany() + * @see #isMany() + * @see #setMany(boolean) + * @generated + */ + void unsetMany(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isMany Many}' attribute is set. + * + * + * @return whether the value of the 'Many' attribute is set. + * @see #unsetMany() + * @see #isMany() + * @see #setMany(boolean) + * @generated + */ + boolean isSetMany(); + + /** + * Returns the value of the 'Name' attribute. + * + *

+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Opposite' reference. + * + *

+ * If the meaning of the 'Opposite' reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Opposite' reference. + * @see #setOpposite(Property) + * @generated + */ + Property getOpposite_(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getOpposite Opposite}' reference. + * + * + * @param value the new value of the 'Opposite' reference. + * @see #getOpposite() + * @generated + */ + void setOpposite_(Property value); + + /** + * Returns the value of the 'Read Only' attribute. + * + *

+ * If the meaning of the 'Read Only' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Read Only' attribute. + * @see #isSetReadOnly() + * @see #unsetReadOnly() + * @see #setReadOnly(boolean) + * @generated + */ + boolean isReadOnly(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#isReadOnly Read Only}' attribute. + * + * + * @param value the new value of the 'Read Only' attribute. + * @see #isSetReadOnly() + * @see #unsetReadOnly() + * @see #isReadOnly() + * @generated + */ + void setReadOnly(boolean value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.sdo.model.Property#isReadOnly Read Only}' attribute. + * + * + * @see #isSetReadOnly() + * @see #isReadOnly() + * @see #setReadOnly(boolean) + * @generated + */ + void unsetReadOnly(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Property#isReadOnly Read Only}' attribute is set. + * + * + * @return whether the value of the 'Read Only' attribute is set. + * @see #unsetReadOnly() + * @see #isReadOnly() + * @see #setReadOnly(boolean) + * @generated + */ + boolean isSetReadOnly(); + + /** + * Returns the value of the 'Type' reference. + * + *

+ * If the meaning of the 'Type' reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Type' reference. + * @see #setType(Type) + * @generated + */ + Type getType_(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Property#getType Type}' reference. + * + * + * @param value the new value of the 'Type' reference. + * @see #getType() + * @generated + */ + void setType(Type value); + + /** + * Returns the value of the 'Any Attribute' attribute list. + * + *

+ * If the meaning of the 'Any Attribute' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Any Attribute' attribute list. + * @generated + */ + Sequence getAnyAttribute(); + +} // Property diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/TextType.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/TextType.java new file mode 100644 index 0000000000..e792fc7a87 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/TextType.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + +import java.util.List; + +/** + * + * A representation of the model object 'Text Type'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.sdo.model.TextType#getText Text}
  • + *
+ *

+ * + * @generated + */ +public interface TextType +{ + /** + * Returns the value of the 'Text' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'Text' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Text' attribute list. + * @generated + */ + List getText(); + +} // TextType diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Type.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Type.java new file mode 100644 index 0000000000..3be181bd9a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Type.java @@ -0,0 +1,371 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + +import commonj.sdo.Sequence; + +import java.util.List; + +/** + * + * A representation of the model object 'Type'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.sdo.model.Type#getBaseType Base Type}
  • + *
  • {@link org.apache.tuscany.sdo.model.Type#getProperty Property}
  • + *
  • {@link org.apache.tuscany.sdo.model.Type#getAliasName Alias Name}
  • + *
  • {@link org.apache.tuscany.sdo.model.Type#getAny Any}
  • + *
  • {@link org.apache.tuscany.sdo.model.Type#isAbstract Abstract}
  • + *
  • {@link org.apache.tuscany.sdo.model.Type#isDataType Data Type}
  • + *
  • {@link org.apache.tuscany.sdo.model.Type#getName Name}
  • + *
  • {@link org.apache.tuscany.sdo.model.Type#isOpen Open}
  • + *
  • {@link org.apache.tuscany.sdo.model.Type#isSequenced Sequenced}
  • + *
  • {@link org.apache.tuscany.sdo.model.Type#getUri Uri}
  • + *
  • {@link org.apache.tuscany.sdo.model.Type#getAnyAttribute Any Attribute}
  • + *
+ *

+ * + * @generated + */ +public interface Type +{ + /** + * Returns the value of the 'Base Type' reference list. + * The list contents are of type {@link org.apache.tuscany.sdo.model.Type}. + * + *

+ * If the meaning of the 'Base Type' reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Base Type' reference list. + * @generated + */ + List getBaseType(); + + /** + * Returns the value of the 'Property' containment reference list. + * The list contents are of type {@link org.apache.tuscany.sdo.model.Property}. + * + *

+ * If the meaning of the 'Property' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Property' containment reference list. + * @generated + */ + List getProperty(); + + /** + * Returns the value of the 'Alias Name' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'Alias Name' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Alias Name' attribute list. + * @generated + */ + List getAliasName(); + + /** + * Returns the value of the 'Any' attribute list. + * + *

+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + + /** + * Returns the value of the 'Abstract' attribute. + * + *

+ * If the meaning of the 'Abstract' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Abstract' attribute. + * @see #isSetAbstract() + * @see #unsetAbstract() + * @see #setAbstract(boolean) + * @generated + */ + boolean isAbstract(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isAbstract Abstract}' attribute. + * + * + * @param value the new value of the 'Abstract' attribute. + * @see #isSetAbstract() + * @see #unsetAbstract() + * @see #isAbstract() + * @generated + */ + void setAbstract(boolean value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.sdo.model.Type#isAbstract Abstract}' attribute. + * + * + * @see #isSetAbstract() + * @see #isAbstract() + * @see #setAbstract(boolean) + * @generated + */ + void unsetAbstract(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isAbstract Abstract}' attribute is set. + * + * + * @return whether the value of the 'Abstract' attribute is set. + * @see #unsetAbstract() + * @see #isAbstract() + * @see #setAbstract(boolean) + * @generated + */ + boolean isSetAbstract(); + + /** + * Returns the value of the 'Data Type' attribute. + * + *

+ * If the meaning of the 'Data Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Data Type' attribute. + * @see #isSetDataType() + * @see #unsetDataType() + * @see #setDataType(boolean) + * @generated + */ + boolean isDataType(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isDataType Data Type}' attribute. + * + * + * @param value the new value of the 'Data Type' attribute. + * @see #isSetDataType() + * @see #unsetDataType() + * @see #isDataType() + * @generated + */ + void setDataType(boolean value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.sdo.model.Type#isDataType Data Type}' attribute. + * + * + * @see #isSetDataType() + * @see #isDataType() + * @see #setDataType(boolean) + * @generated + */ + void unsetDataType(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isDataType Data Type}' attribute is set. + * + * + * @return whether the value of the 'Data Type' attribute is set. + * @see #unsetDataType() + * @see #isDataType() + * @see #setDataType(boolean) + * @generated + */ + boolean isSetDataType(); + + /** + * Returns the value of the 'Name' attribute. + * + *

+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Open' attribute. + * + *

+ * If the meaning of the 'Open' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Open' attribute. + * @see #isSetOpen() + * @see #unsetOpen() + * @see #setOpen(boolean) + * @generated + */ + boolean isOpen(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isOpen Open}' attribute. + * + * + * @param value the new value of the 'Open' attribute. + * @see #isSetOpen() + * @see #unsetOpen() + * @see #isOpen() + * @generated + */ + void setOpen(boolean value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.sdo.model.Type#isOpen Open}' attribute. + * + * + * @see #isSetOpen() + * @see #isOpen() + * @see #setOpen(boolean) + * @generated + */ + void unsetOpen(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isOpen Open}' attribute is set. + * + * + * @return whether the value of the 'Open' attribute is set. + * @see #unsetOpen() + * @see #isOpen() + * @see #setOpen(boolean) + * @generated + */ + boolean isSetOpen(); + + /** + * Returns the value of the 'Sequenced' attribute. + * + *

+ * If the meaning of the 'Sequenced' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Sequenced' attribute. + * @see #isSetSequenced() + * @see #unsetSequenced() + * @see #setSequenced(boolean) + * @generated + */ + boolean isSequenced(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#isSequenced Sequenced}' attribute. + * + * + * @param value the new value of the 'Sequenced' attribute. + * @see #isSetSequenced() + * @see #unsetSequenced() + * @see #isSequenced() + * @generated + */ + void setSequenced(boolean value); + + /** + * Unsets the value of the '{@link org.apache.tuscany.sdo.model.Type#isSequenced Sequenced}' attribute. + * + * + * @see #isSetSequenced() + * @see #isSequenced() + * @see #setSequenced(boolean) + * @generated + */ + void unsetSequenced(); + + /** + * Returns whether the value of the '{@link org.apache.tuscany.sdo.model.Type#isSequenced Sequenced}' attribute is set. + * + * + * @return whether the value of the 'Sequenced' attribute is set. + * @see #unsetSequenced() + * @see #isSequenced() + * @see #setSequenced(boolean) + * @generated + */ + boolean isSetSequenced(); + + /** + * Returns the value of the 'Uri' attribute. + * + *

+ * If the meaning of the 'Uri' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Uri' attribute. + * @see #setUri(String) + * @generated + */ + String getUri(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.Type#getUri Uri}' attribute. + * + * + * @param value the new value of the 'Uri' attribute. + * @see #getUri() + * @generated + */ + void setUri(String value); + + /** + * Returns the value of the 'Any Attribute' attribute list. + * + *

+ * If the meaning of the 'Any Attribute' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Any Attribute' attribute list. + * @generated + */ + Sequence getAnyAttribute(); + + String getInstanceClassName(); + +} // Type diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Types.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Types.java new file mode 100644 index 0000000000..73188861d4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/Types.java @@ -0,0 +1,53 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + +import java.util.List; + +/** + * + * A representation of the model object 'Types'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.sdo.model.Types#getType Type}
  • + *
+ *

+ * + * @generated + */ +public interface Types +{ + /** + * Returns the value of the 'Type' containment reference list. + * The list contents are of type {@link org.apache.tuscany.sdo.model.Type}. + * + *

+ * If the meaning of the 'Type' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Type' containment reference list. + * @generated + */ + List getType_(); + + List getTypeList(); + +} // Types diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/XSDType.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/XSDType.java new file mode 100644 index 0000000000..9b12301381 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/XSDType.java @@ -0,0 +1,56 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model; + +import commonj.sdo.Sequence; + +/** + * + * A representation of the model object 'XSD Type'. + * + * + * + * + * Expected type is xsd:schema. + * + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.sdo.model.XSDType#getAny Any}
  • + *
+ *

+ * + * @generated + */ +public interface XSDType +{ + /** + * Returns the value of the 'Any' attribute list. + * + *

+ * If the meaning of the 'Any' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Any' attribute list. + * @generated + */ + Sequence getAny(); + +} // XSDType diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/BaseDataGraphTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/BaseDataGraphTypeImpl.java new file mode 100644 index 0000000000..31d54ca425 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/BaseDataGraphTypeImpl.java @@ -0,0 +1,408 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import commonj.sdo.Sequence; + + +import org.apache.tuscany.sdo.impl.DataObjectImpl; +import org.apache.tuscany.sdo.model.BaseDataGraphType; +import org.apache.tuscany.sdo.model.ChangeSummaryType; +import org.apache.tuscany.sdo.model.ModelsType; +import org.apache.tuscany.sdo.model.XSDType; + +import org.apache.tuscany.sdo.util.BasicSequence; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.BasicFeatureMap; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Base Data Graph Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl#getModels Models}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl#getXsd Xsd}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl#getChangeSummary Change Summary}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl#getAnyAttribute Any Attribute}
  • + *
+ *

+ * + * @generated + */ +public abstract class BaseDataGraphTypeImpl extends DataObjectImpl implements BaseDataGraphType +{ + /** + * The cached value of the '{@link #getModels() Models}' containment reference. + * + * + * @see #getModels() + * @generated + * @ordered + */ + protected ModelsType models = null; + + /** + * The cached value of the '{@link #getXsd() Xsd}' containment reference. + * + * + * @see #getXsd() + * @generated + * @ordered + */ + protected XSDType xsd = null; + + /** + * The cached value of the '{@link #getChangeSummary() Change Summary}' containment reference. + * + * + * @see #getChangeSummary() + * @generated + * @ordered + */ + protected ChangeSummaryType changeSummary = null; + + /** + * The cached value of the '{@link #getAnyAttribute() Any Attribute}' attribute list. + * + * + * @see #getAnyAttribute() + * @generated + * @ordered + */ + protected BasicSequence anyAttribute = null; + + /** + * + * + * @generated + */ + protected BaseDataGraphTypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return ModelPackageImpl.Literals.BASE_DATA_GRAPH_TYPE; + } + + /** + * + * + * @generated + */ + public ModelsType getModels() + { + return models; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetModels(ModelsType newModels, NotificationChain msgs) + { + ModelsType oldModels = models; + models = newModels; + if (eNotificationRequired()) + { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelPackageImpl.BASE_DATA_GRAPH_TYPE__MODELS, oldModels, newModels); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setModels(ModelsType newModels) + { + if (newModels != models) + { + NotificationChain msgs = null; + if (models != null) + msgs = ((InternalEObject)models).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelPackageImpl.BASE_DATA_GRAPH_TYPE__MODELS, null, msgs); + if (newModels != null) + msgs = ((InternalEObject)newModels).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelPackageImpl.BASE_DATA_GRAPH_TYPE__MODELS, null, msgs); + msgs = basicSetModels(newModels, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.BASE_DATA_GRAPH_TYPE__MODELS, newModels, newModels)); + } + + /** + * + * + * @generated + */ + public XSDType getXsd() + { + return xsd; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetXsd(XSDType newXsd, NotificationChain msgs) + { + XSDType oldXsd = xsd; + xsd = newXsd; + if (eNotificationRequired()) + { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelPackageImpl.BASE_DATA_GRAPH_TYPE__XSD, oldXsd, newXsd); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setXsd(XSDType newXsd) + { + if (newXsd != xsd) + { + NotificationChain msgs = null; + if (xsd != null) + msgs = ((InternalEObject)xsd).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelPackageImpl.BASE_DATA_GRAPH_TYPE__XSD, null, msgs); + if (newXsd != null) + msgs = ((InternalEObject)newXsd).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelPackageImpl.BASE_DATA_GRAPH_TYPE__XSD, null, msgs); + msgs = basicSetXsd(newXsd, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.BASE_DATA_GRAPH_TYPE__XSD, newXsd, newXsd)); + } + + /** + * + * + * @generated + */ + public ChangeSummaryType getChangeSummary_() + { + return changeSummary; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetChangeSummary(ChangeSummaryType newChangeSummary, NotificationChain msgs) + { + ChangeSummaryType oldChangeSummary = changeSummary; + changeSummary = newChangeSummary; + if (eNotificationRequired()) + { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelPackageImpl.BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY, oldChangeSummary, newChangeSummary); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setChangeSummary(ChangeSummaryType newChangeSummary) + { + if (newChangeSummary != changeSummary) + { + NotificationChain msgs = null; + if (changeSummary != null) + msgs = ((InternalEObject)changeSummary).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ModelPackageImpl.BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY, null, msgs); + if (newChangeSummary != null) + msgs = ((InternalEObject)newChangeSummary).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ModelPackageImpl.BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY, null, msgs); + msgs = basicSetChangeSummary(newChangeSummary, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY, newChangeSummary, newChangeSummary)); + } + + /** + * + * + * @generated + */ + public Sequence getAnyAttribute() + { + if (anyAttribute == null) + { + anyAttribute = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.BASE_DATA_GRAPH_TYPE__ANY_ATTRIBUTE)); + } + return anyAttribute; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__MODELS: + return basicSetModels(null, msgs); + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__XSD: + return basicSetXsd(null, msgs); + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY: + return basicSetChangeSummary(null, msgs); + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__ANY_ATTRIBUTE: + return ((InternalEList)((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__MODELS: + return getModels(); + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__XSD: + return getXsd(); + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY: + return getChangeSummary(); + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__ANY_ATTRIBUTE: + if (coreType) return ((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap(); + return getAnyAttribute(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__MODELS: + setModels((ModelsType)newValue); + return; + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__XSD: + setXsd((XSDType)newValue); + return; + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY: + setChangeSummary((ChangeSummaryType)newValue); + return; + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__ANY_ATTRIBUTE: + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap()).set(newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__MODELS: + setModels((ModelsType)null); + return; + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__XSD: + setXsd((XSDType)null); + return; + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY: + setChangeSummary((ChangeSummaryType)null); + return; + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__ANY_ATTRIBUTE: + ((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__MODELS: + return models != null; + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__XSD: + return xsd != null; + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY: + return changeSummary != null; + case ModelPackageImpl.BASE_DATA_GRAPH_TYPE__ANY_ATTRIBUTE: + return anyAttribute != null && !anyAttribute.featureMap().isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (anyAttribute: "); + result.append(anyAttribute); + result.append(')'); + return result.toString(); + } + +} //BaseDataGraphTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ChangeSummaryTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ChangeSummaryTypeImpl.java new file mode 100644 index 0000000000..07ff624c4f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ChangeSummaryTypeImpl.java @@ -0,0 +1,396 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import commonj.sdo.Sequence; + + +import org.apache.tuscany.sdo.impl.DataObjectImpl; +import org.apache.tuscany.sdo.model.ChangeSummaryType; + +import org.apache.tuscany.sdo.util.BasicSequence; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.BasicFeatureMap; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Change Summary Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.model.impl.ChangeSummaryTypeImpl#getAny Any}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.ChangeSummaryTypeImpl#getCreate Create}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.ChangeSummaryTypeImpl#getDelete Delete}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.ChangeSummaryTypeImpl#isLogging Logging}
  • + *
+ *

+ * + * @generated + */ +public class ChangeSummaryTypeImpl extends DataObjectImpl implements ChangeSummaryType +{ + /** + * The cached value of the '{@link #getAny() Any}' attribute list. + * + * + * @see #getAny() + * @generated + * @ordered + */ + protected BasicSequence any = null; + + /** + * The default value of the '{@link #getCreate() Create}' attribute. + * + * + * @see #getCreate() + * @generated + * @ordered + */ + protected static final String CREATE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getCreate() Create}' attribute. + * + * + * @see #getCreate() + * @generated + * @ordered + */ + protected String create = CREATE_EDEFAULT; + + /** + * The default value of the '{@link #getDelete() Delete}' attribute. + * + * + * @see #getDelete() + * @generated + * @ordered + */ + protected static final String DELETE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDelete() Delete}' attribute. + * + * + * @see #getDelete() + * @generated + * @ordered + */ + protected String delete = DELETE_EDEFAULT; + + /** + * The default value of the '{@link #isLogging() Logging}' attribute. + * + * + * @see #isLogging() + * @generated + * @ordered + */ + protected static final boolean LOGGING_EDEFAULT = false; + + /** + * The cached value of the '{@link #isLogging() Logging}' attribute. + * + * + * @see #isLogging() + * @generated + * @ordered + */ + protected boolean logging = LOGGING_EDEFAULT; + + /** + * This is true if the Logging attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean loggingESet = false; + + /** + * + * + * @generated + */ + protected ChangeSummaryTypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return ModelPackageImpl.Literals.CHANGE_SUMMARY_TYPE; + } + + /** + * + * + * @generated + */ + public Sequence getAny() + { + if (any == null) + { + any = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.CHANGE_SUMMARY_TYPE__ANY)); + } + return any; + } + + /** + * + * + * @generated + */ + public String getCreate() + { + return create; + } + + /** + * + * + * @generated + */ + public void setCreate(String newCreate) + { + String oldCreate = create; + create = newCreate; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.CHANGE_SUMMARY_TYPE__CREATE, oldCreate, create)); + } + + /** + * + * + * @generated + */ + public String getDelete() + { + return delete; + } + + /** + * + * + * @generated + */ + public void setDelete(String newDelete) + { + String oldDelete = delete; + delete = newDelete; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.CHANGE_SUMMARY_TYPE__DELETE, oldDelete, delete)); + } + + /** + * + * + * @generated + */ + public boolean isLogging() + { + return logging; + } + + /** + * + * + * @generated + */ + public void setLogging(boolean newLogging) + { + boolean oldLogging = logging; + logging = newLogging; + boolean oldLoggingESet = loggingESet; + loggingESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.CHANGE_SUMMARY_TYPE__LOGGING, oldLogging, logging, !oldLoggingESet)); + } + + /** + * + * + * @generated + */ + public void unsetLogging() + { + boolean oldLogging = logging; + boolean oldLoggingESet = loggingESet; + logging = LOGGING_EDEFAULT; + loggingESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.CHANGE_SUMMARY_TYPE__LOGGING, oldLogging, LOGGING_EDEFAULT, oldLoggingESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetLogging() + { + return loggingESet; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__ANY: + return ((InternalEList)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__ANY: + if (coreType) return ((FeatureMap.Internal.Wrapper)getAny()).featureMap(); + return getAny(); + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__CREATE: + return getCreate(); + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__DELETE: + return getDelete(); + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__LOGGING: + return isLogging() ? Boolean.TRUE : Boolean.FALSE; + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__ANY: + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).set(newValue); + return; + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__CREATE: + setCreate((String)newValue); + return; + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__DELETE: + setDelete((String)newValue); + return; + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__LOGGING: + setLogging(((Boolean)newValue).booleanValue()); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__ANY: + ((FeatureMap.Internal.Wrapper)getAny()).featureMap().clear(); + return; + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__CREATE: + setCreate(CREATE_EDEFAULT); + return; + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__DELETE: + setDelete(DELETE_EDEFAULT); + return; + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__LOGGING: + unsetLogging(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__ANY: + return any != null && !any.featureMap().isEmpty(); + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__CREATE: + return CREATE_EDEFAULT == null ? create != null : !CREATE_EDEFAULT.equals(create); + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__DELETE: + return DELETE_EDEFAULT == null ? delete != null : !DELETE_EDEFAULT.equals(delete); + case ModelPackageImpl.CHANGE_SUMMARY_TYPE__LOGGING: + return isSetLogging(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (any: "); + result.append(any); + result.append(", create: "); + result.append(create); + result.append(", delete: "); + result.append(delete); + result.append(", logging: "); + if (loggingESet) result.append(logging); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //ChangeSummaryTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/DataGraphTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/DataGraphTypeImpl.java new file mode 100644 index 0000000000..e6e8dd1f39 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/DataGraphTypeImpl.java @@ -0,0 +1,187 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import commonj.sdo.Sequence; + + +import org.apache.tuscany.sdo.model.DataGraphType; +import org.apache.tuscany.sdo.util.BasicSequence; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.util.BasicFeatureMap; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Data Graph Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.model.impl.DataGraphTypeImpl#getAny Any}
  • + *
+ *

+ * + * @generated + */ +public class DataGraphTypeImpl extends BaseDataGraphTypeImpl implements DataGraphType +{ + /** + * The cached value of the '{@link #getAny() Any}' attribute list. + * + * + * @see #getAny() + * @generated + * @ordered + */ + protected BasicSequence any = null; + + /** + * + * + * @generated + */ + protected DataGraphTypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return ModelPackageImpl.Literals.DATA_GRAPH_TYPE; + } + + /** + * + * + * @generated + */ + public Sequence getAny() + { + if (any == null) + { + any = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.DATA_GRAPH_TYPE__ANY)); + } + return any; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case ModelPackageImpl.DATA_GRAPH_TYPE__ANY: + return ((InternalEList)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case ModelPackageImpl.DATA_GRAPH_TYPE__ANY: + if (coreType) return ((FeatureMap.Internal.Wrapper)getAny()).featureMap(); + return getAny(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case ModelPackageImpl.DATA_GRAPH_TYPE__ANY: + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).set(newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.DATA_GRAPH_TYPE__ANY: + ((FeatureMap.Internal.Wrapper)getAny()).featureMap().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.DATA_GRAPH_TYPE__ANY: + return any != null && !any.featureMap().isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (any: "); + result.append(any); + result.append(')'); + return result.toString(); + } + +} //DataGraphTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/DataObjectImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/DataObjectImpl.java new file mode 100644 index 0000000000..ed516ebd95 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/DataObjectImpl.java @@ -0,0 +1,54 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import org.apache.tuscany.sdo.model.DataObject; + +import org.eclipse.emf.ecore.EClass; + +/** + * + * An implementation of the model object 'Data Object'. + * + *

+ *

+ * + * @generated + */ +public abstract class DataObjectImpl extends org.apache.tuscany.sdo.impl.DataObjectImpl implements DataObject +{ + /** + * + * + * @generated + */ + protected DataObjectImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return ModelPackageImpl.Literals.DATA_OBJECT; + } + +} //DataObjectImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java new file mode 100644 index 0000000000..eaf56bd477 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelFactoryImpl.java @@ -0,0 +1,1091 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import java.math.BigDecimal; +import java.math.BigInteger; + +import java.util.Date; +import java.util.List; + +import org.apache.tuscany.sdo.model.*; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.emf.ecore.xml.type.XMLTypeFactory; +import org.eclipse.emf.ecore.xml.type.internal.XMLCalendar; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class ModelFactoryImpl extends EFactoryImpl implements ModelFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + public static final ModelFactoryImpl eINSTANCE = init(); + + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static ModelFactoryImpl init() + { + try + { + ModelFactoryImpl theModelFactory = (ModelFactoryImpl)EPackage.Registry.INSTANCE.getEFactory("commonj.sdo"); + if (theModelFactory != null) + { + return theModelFactory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new ModelFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public ModelFactoryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public EObject create(EClass eClass) + { + switch (eClass.getClassifierID()) + { + case ModelPackageImpl.CHANGE_SUMMARY_TYPE: return (EObject)createChangeSummaryType(); + case ModelPackageImpl.DATA_GRAPH_TYPE: return (EObject)createDataGraphType(); + case ModelPackageImpl.DOCUMENT_ROOT: return (EObject)createDocumentRoot(); + case ModelPackageImpl.MODELS_TYPE: return (EObject)createModelsType(); + case ModelPackageImpl.PROPERTY: return (EObject)createProperty(); + case ModelPackageImpl.TYPE: return (EObject)createType(); + case ModelPackageImpl.TYPES: return (EObject)createTypes(); + case ModelPackageImpl.XSD_TYPE: return (EObject)createXSDType(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public Object createFromString(EDataType eDataType, String initialValue) + { + switch (eDataType.getClassifierID()) + { + case ModelPackageImpl.BOOLEAN: + return createBooleanFromString(eDataType, initialValue); + case ModelPackageImpl.BOOLEAN_OBJECT: + return createBooleanObjectFromString(eDataType, initialValue); + case ModelPackageImpl.BYTE: + return createByteFromString(eDataType, initialValue); + case ModelPackageImpl.BYTE_OBJECT: + return createByteObjectFromString(eDataType, initialValue); + case ModelPackageImpl.BYTES: + return createBytesFromString(eDataType, initialValue); + case ModelPackageImpl.CHARACTER: + return createCharacterFromString(eDataType, initialValue); + case ModelPackageImpl.CHARACTER_OBJECT: + return createCharacterObjectFromString(eDataType, initialValue); + case ModelPackageImpl.DATE: + return createDateFromString(eDataType, initialValue); + case ModelPackageImpl.DATE_TIME: + return createDateTimeFromString(eDataType, initialValue); + case ModelPackageImpl.DAY: + return createDayFromString(eDataType, initialValue); + case ModelPackageImpl.DECIMAL: + return createDecimalFromString(eDataType, initialValue); + case ModelPackageImpl.DOUBLE: + return createDoubleFromString(eDataType, initialValue); + case ModelPackageImpl.DOUBLE_OBJECT: + return createDoubleObjectFromString(eDataType, initialValue); + case ModelPackageImpl.DURATION: + return createDurationFromString(eDataType, initialValue); + case ModelPackageImpl.FLOAT: + return createFloatFromString(eDataType, initialValue); + case ModelPackageImpl.FLOAT_OBJECT: + return createFloatObjectFromString(eDataType, initialValue); + case ModelPackageImpl.INT: + return createIntFromString(eDataType, initialValue); + case ModelPackageImpl.INTEGER: + return createIntegerFromString(eDataType, initialValue); + case ModelPackageImpl.INT_OBJECT: + return createIntObjectFromString(eDataType, initialValue); + case ModelPackageImpl.LONG: + return createLongFromString(eDataType, initialValue); + case ModelPackageImpl.LONG_OBJECT: + return createLongObjectFromString(eDataType, initialValue); + case ModelPackageImpl.MONTH: + return createMonthFromString(eDataType, initialValue); + case ModelPackageImpl.MONTH_DAY: + return createMonthDayFromString(eDataType, initialValue); + case ModelPackageImpl.OBJECT: + return createObjectFromString(eDataType, initialValue); + case ModelPackageImpl.SHORT: + return createShortFromString(eDataType, initialValue); + case ModelPackageImpl.SHORT_OBJECT: + return createShortObjectFromString(eDataType, initialValue); + case ModelPackageImpl.STRING: + return createStringFromString(eDataType, initialValue); + case ModelPackageImpl.STRINGS: + return createStringsFromString(eDataType, initialValue); + case ModelPackageImpl.TIME: + return createTimeFromString(eDataType, initialValue); + case ModelPackageImpl.URI: + return createURIFromString(eDataType, initialValue); + case ModelPackageImpl.YEAR: + return createYearFromString(eDataType, initialValue); + case ModelPackageImpl.YEAR_MONTH: + return createYearMonthFromString(eDataType, initialValue); + case ModelPackageImpl.YEAR_MONTH_DAY: + return createYearMonthDayFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public String convertToString(EDataType eDataType, Object instanceValue) + { + switch (eDataType.getClassifierID()) + { + case ModelPackageImpl.BOOLEAN: + return convertBooleanToString(eDataType, instanceValue); + case ModelPackageImpl.BOOLEAN_OBJECT: + return convertBooleanObjectToString(eDataType, instanceValue); + case ModelPackageImpl.BYTE: + return convertByteToString(eDataType, instanceValue); + case ModelPackageImpl.BYTE_OBJECT: + return convertByteObjectToString(eDataType, instanceValue); + case ModelPackageImpl.BYTES: + return convertBytesToString(eDataType, instanceValue); + case ModelPackageImpl.CHARACTER: + return convertCharacterToString(eDataType, instanceValue); + case ModelPackageImpl.CHARACTER_OBJECT: + return convertCharacterObjectToString(eDataType, instanceValue); + case ModelPackageImpl.DATE: + return convertDateToString(eDataType, instanceValue); + case ModelPackageImpl.DATE_TIME: + return convertDateTimeToString(eDataType, instanceValue); + case ModelPackageImpl.DAY: + return convertDayToString(eDataType, instanceValue); + case ModelPackageImpl.DECIMAL: + return convertDecimalToString(eDataType, instanceValue); + case ModelPackageImpl.DOUBLE: + return convertDoubleToString(eDataType, instanceValue); + case ModelPackageImpl.DOUBLE_OBJECT: + return convertDoubleObjectToString(eDataType, instanceValue); + case ModelPackageImpl.DURATION: + return convertDurationToString(eDataType, instanceValue); + case ModelPackageImpl.FLOAT: + return convertFloatToString(eDataType, instanceValue); + case ModelPackageImpl.FLOAT_OBJECT: + return convertFloatObjectToString(eDataType, instanceValue); + case ModelPackageImpl.INT: + return convertIntToString(eDataType, instanceValue); + case ModelPackageImpl.INTEGER: + return convertIntegerToString(eDataType, instanceValue); + case ModelPackageImpl.INT_OBJECT: + return convertIntObjectToString(eDataType, instanceValue); + case ModelPackageImpl.LONG: + return convertLongToString(eDataType, instanceValue); + case ModelPackageImpl.LONG_OBJECT: + return convertLongObjectToString(eDataType, instanceValue); + case ModelPackageImpl.MONTH: + return convertMonthToString(eDataType, instanceValue); + case ModelPackageImpl.MONTH_DAY: + return convertMonthDayToString(eDataType, instanceValue); + case ModelPackageImpl.OBJECT: + return convertObjectToString(eDataType, instanceValue); + case ModelPackageImpl.SHORT: + return convertShortToString(eDataType, instanceValue); + case ModelPackageImpl.SHORT_OBJECT: + return convertShortObjectToString(eDataType, instanceValue); + case ModelPackageImpl.STRING: + return convertStringToString(eDataType, instanceValue); + case ModelPackageImpl.STRINGS: + return convertStringsToString(eDataType, instanceValue); + case ModelPackageImpl.TIME: + return convertTimeToString(eDataType, instanceValue); + case ModelPackageImpl.URI: + return convertURIToString(eDataType, instanceValue); + case ModelPackageImpl.YEAR: + return convertYearToString(eDataType, instanceValue); + case ModelPackageImpl.YEAR_MONTH: + return convertYearMonthToString(eDataType, instanceValue); + case ModelPackageImpl.YEAR_MONTH_DAY: + return convertYearMonthDayToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public ChangeSummaryType createChangeSummaryType() + { + ChangeSummaryTypeImpl changeSummaryType = new ChangeSummaryTypeImpl(); + return changeSummaryType; + } + + /** + * + * + * @generated + */ + public DataGraphType createDataGraphType() + { + DataGraphTypeImpl dataGraphType = new DataGraphTypeImpl(); + return dataGraphType; + } + + /** + * + * + * @generated + */ + public EObject createDocumentRoot() + { + EObject documentRoot = super.create(ModelPackageImpl.Literals.DOCUMENT_ROOT); + return documentRoot; + } + + /** + * + * + * @generated + */ + public ModelsType createModelsType() + { + ModelsTypeImpl modelsType = new ModelsTypeImpl(); + return modelsType; + } + + /** + * + * + * @generated + */ + public Property createProperty() + { + PropertyImpl property = new PropertyImpl(); + return property; + } + + /** + * + * + * @generated + */ + public Type createType() + { + TypeImpl type = new TypeImpl(); + return type; + } + + /** + * + * + * @generated + */ + public Types createTypes() + { + TypesImpl types = new TypesImpl(); + return types; + } + + /** + * + * + * @generated + */ + public XSDType createXSDType() + { + XSDTypeImpl xsdType = new XSDTypeImpl(); + return xsdType; + } + + /** + * + * + * @generated NOT + */ + public Boolean createBooleanFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createBooleanObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertBooleanToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertBooleanObject((Boolean)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Boolean createBooleanObjectFromString(EDataType eDataType, String initialValue) + { + return (Boolean)createBooleanFromString(ModelPackageImpl.Literals.BOOLEAN, initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertBooleanObjectToString(EDataType eDataType, Object instanceValue) + { + return convertBooleanToString(ModelPackageImpl.Literals.BOOLEAN, instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Byte createByteFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createByteObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertByteToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertByteObject((Byte)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Byte createByteObjectFromString(EDataType eDataType, String initialValue) + { + return (Byte)createByteFromString(ModelPackageImpl.Literals.BYTE, initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertByteObjectToString(EDataType eDataType, Object instanceValue) + { + return convertByteToString(ModelPackageImpl.Literals.BYTE, instanceValue); + } + + /** + * + * + * @generated NOT + */ + public byte[] createBytesFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createBase64Binary(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertBytesToString(EDataType eDataType, Object instanceValue) + { + if (instanceValue instanceof byte[]) { + return XMLTypeFactory.eINSTANCE.convertBase64Binary((byte[])instanceValue); + } else { + return XMLTypeFactory.eINSTANCE.convertBase64Binary(instanceValue.toString().getBytes()); + } + } + + /** + * + * + * @generated NOT + */ + public Character createCharacterFromString(EDataType eDataType, String initialValue) + { + return (initialValue == null && initialValue.length() > 0) + ? null : (new Character(collapseWhiteSpace(initialValue).charAt(0))); + } + + /** + * + * + * @generated NOT + */ + public String convertCharacterToString(EDataType eDataType, Object instanceValue) + { + return String.valueOf(((Character)instanceValue).charValue()); + } + + /** + * + * + * @generated NOT + */ + public Character createCharacterObjectFromString(EDataType eDataType, String initialValue) + { + return (Character)createCharacterFromString(ModelPackageImpl.Literals.CHARACTER, initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertCharacterObjectToString(EDataType eDataType, Object instanceValue) + { + return convertCharacterToString(ModelPackageImpl.Literals.CHARACTER, instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Date createDateFromString(EDataType eDataType, String initialValue) + { + XMLCalendar cal = (XMLCalendar) XMLTypeFactory.eINSTANCE.createDate(initialValue); + return (cal != null) ? cal.getDate() : null; + } + + /** + * + * + * @generated NOT + */ + public String convertDateToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertDate(instanceValue); + } + + /** + * + * + * @generated NOT + */ + public String createDateTimeFromString(EDataType eDataType, String initialValue) + { + Object obj = XMLTypeFactory.eINSTANCE.createDateTime(initialValue); + return (obj != null) ? obj.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public String convertDateTimeToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertDateTime(instanceValue); + } + + /** + * + * + * @generated NOT + */ + public String createDayFromString(EDataType eDataType, String initialValue) + { + Object obj = XMLTypeFactory.eINSTANCE.createGDay(initialValue); + return (obj != null) ? obj.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public String convertDayToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertGDay(instanceValue); + } + + /** + * + * + * @generated NOT + */ + public BigDecimal createDecimalFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createDecimal(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertDecimalToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertDecimal((BigDecimal)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Double createDoubleFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createDoubleObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertDoubleToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertDoubleObject((Double)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Double createDoubleObjectFromString(EDataType eDataType, String initialValue) + { + return (Double)createDoubleFromString(ModelPackageImpl.Literals.DOUBLE, initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertDoubleObjectToString(EDataType eDataType, Object instanceValue) + { + return convertDoubleToString(ModelPackageImpl.Literals.DOUBLE, instanceValue); + } + + /** + * + * + * @generated NOT + */ + public String createDurationFromString(EDataType eDataType, String initialValue) + { + Object obj = XMLTypeFactory.eINSTANCE.createDuration(initialValue); + return (obj != null) ? obj.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public String convertDurationToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertDuration(instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Float createFloatFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createFloatObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertFloatToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertFloatObject((Float)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Float createFloatObjectFromString(EDataType eDataType, String initialValue) + { + return (Float)createFloatFromString(ModelPackageImpl.Literals.FLOAT, initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertFloatObjectToString(EDataType eDataType, Object instanceValue) + { + return convertFloatToString(ModelPackageImpl.Literals.FLOAT, instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Integer createIntFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createIntObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertIntToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertIntObject((Integer)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public BigInteger createIntegerFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createInteger(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertIntegerToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertInteger((BigInteger)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Integer createIntObjectFromString(EDataType eDataType, String initialValue) + { + return (Integer)createIntFromString(ModelPackageImpl.Literals.INT, initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertIntObjectToString(EDataType eDataType, Object instanceValue) + { + return convertIntToString(ModelPackageImpl.Literals.INT, instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Long createLongFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createLongObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertLongToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertLongObject((Long)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Long createLongObjectFromString(EDataType eDataType, String initialValue) + { + return (Long)createLongFromString(ModelPackageImpl.Literals.LONG, initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertLongObjectToString(EDataType eDataType, Object instanceValue) + { + return convertLongToString(ModelPackageImpl.Literals.LONG, instanceValue); + } + + /** + * + * + * @generated NOT + */ + public String createMonthFromString(EDataType eDataType, String initialValue) + { + Object obj = XMLTypeFactory.eINSTANCE.createGMonth(initialValue); + return (obj != null) ? obj.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public String convertMonthToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertGMonth(instanceValue); + } + + /** + * + * + * @generated NOT + */ + public String createMonthDayFromString(EDataType eDataType, String initialValue) + { + Object obj = XMLTypeFactory.eINSTANCE.createGMonthDay(initialValue); + return (obj != null) ? obj.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public String convertMonthDayToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertGMonthDay(instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Object createObjectFromString(EDataType eDataType, String initialValue) + { + return initialValue; + } + + /** + * + * + * @generated NOT + */ + public String convertObjectToString(EDataType eDataType, Object instanceValue) + { + return (instanceValue != null) ? instanceValue.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public Short createShortFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createShortObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertShortToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertShortObject((Short)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Short createShortObjectFromString(EDataType eDataType, String initialValue) + { + return (Short)createShortFromString(ModelPackageImpl.Literals.SHORT, initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertShortObjectToString(EDataType eDataType, Object instanceValue) + { + return convertShortToString(ModelPackageImpl.Literals.SHORT, instanceValue); + } + + /** + * + * + * @generated NOT + */ + public String createStringFromString(EDataType eDataType, String initialValue) + { + return initialValue; + } + + /** + * + * + * @generated NOT + */ + public String convertStringToString(EDataType eDataType, Object instanceValue) + { + return (instanceValue != null) ? instanceValue.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public List createStringsFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createENTITIES(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertStringsToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertENTITIES((List)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public String createTimeFromString(EDataType eDataType, String initialValue) + { + Object obj = XMLTypeFactory.eINSTANCE.createTime(initialValue); + return (obj != null) ? obj.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public String convertTimeToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertTime(instanceValue); + } + + /** + * + * + * @generated NOT + */ + public String createURIFromString(EDataType eDataType, String initialValue) + { + return initialValue; + } + + /** + * + * + * @generated NOT + */ + public String convertURIToString(EDataType eDataType, Object instanceValue) + { + return (instanceValue != null) ? instanceValue.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public String createYearFromString(EDataType eDataType, String initialValue) + { + Object obj = XMLTypeFactory.eINSTANCE.createGYear(initialValue); + return (obj != null) ? obj.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public String convertYearToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertGYear(instanceValue); + } + + /** + * + * + * @generated NOT + */ + public String createYearMonthFromString(EDataType eDataType, String initialValue) + { + Object obj = XMLTypeFactory.eINSTANCE.createGYearMonth(initialValue); + return (obj != null) ? obj.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public String convertYearMonthToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertGYearMonth(instanceValue); + } + + /** + * + * + * @generated NOT + */ + public String createYearMonthDayFromString(EDataType eDataType, String initialValue) + { + Object obj = XMLTypeFactory.eINSTANCE.createDate(initialValue); + return (obj != null) ? obj.toString() : null; + } + + /** + * + * + * @generated NOT + */ + public String convertYearMonthDayToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertDate(instanceValue); + } + + /** + * + * + * @generated + */ + public ModelPackageImpl getModelPackageImpl() + { + return (ModelPackageImpl)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + public static ModelPackageImpl getPackage() + { + return ModelPackageImpl.eINSTANCE; + } + + // Following methods are temporary ... for interop with new factory codegen pattern + // + public static final String NAMESPACE_URI = ModelPackageImpl.eNS_URI; + public commonj.sdo.Type getBoolean() { return (commonj.sdo.Type)getModelPackageImpl().getBoolean(); } + public commonj.sdo.Type getBooleanObject() { return (commonj.sdo.Type)getModelPackageImpl().getBooleanObject(); } + public commonj.sdo.Type getByte() { return (commonj.sdo.Type)getModelPackageImpl().getByte(); } + public commonj.sdo.Type getByteObject() { return (commonj.sdo.Type)getModelPackageImpl().getByteObject(); } + public commonj.sdo.Type getBytes() { return (commonj.sdo.Type)getModelPackageImpl().getBytes(); } + public commonj.sdo.Type getCharacter() { return (commonj.sdo.Type)getModelPackageImpl().getCharacter(); } + public commonj.sdo.Type getCharacterObject() { return (commonj.sdo.Type)getModelPackageImpl().getCharacterObject(); } + public commonj.sdo.Type getDate() { return (commonj.sdo.Type)getModelPackageImpl().getDate(); } + public commonj.sdo.Type getDateTime() { return (commonj.sdo.Type)getModelPackageImpl().getDateTime(); } + public commonj.sdo.Type getDay() { return (commonj.sdo.Type)getModelPackageImpl().getDay(); } + public commonj.sdo.Type getDecimal() { return (commonj.sdo.Type)getModelPackageImpl().getDecimal(); } + public commonj.sdo.Type getDouble() { return (commonj.sdo.Type)getModelPackageImpl().getDouble(); } + public commonj.sdo.Type getDoubleObject() { return (commonj.sdo.Type)getModelPackageImpl().getDoubleObject(); } + public commonj.sdo.Type getDuration() { return (commonj.sdo.Type)getModelPackageImpl().getDuration(); } + public commonj.sdo.Type getFloat() { return (commonj.sdo.Type)getModelPackageImpl().getFloat(); } + public commonj.sdo.Type getFloatObject() { return (commonj.sdo.Type)getModelPackageImpl().getFloatObject(); } + public commonj.sdo.Type getInt() { return (commonj.sdo.Type)getModelPackageImpl().getInt(); } + public commonj.sdo.Type getInteger() { return (commonj.sdo.Type)getModelPackageImpl().getInteger(); } + public commonj.sdo.Type getIntObject() { return (commonj.sdo.Type)getModelPackageImpl().getIntObject(); } + public commonj.sdo.Type getLong() { return (commonj.sdo.Type)getModelPackageImpl().getLong(); } + public commonj.sdo.Type getLongObject() { return (commonj.sdo.Type)getModelPackageImpl().getLongObject(); } + public commonj.sdo.Type getMonth() { return (commonj.sdo.Type)getModelPackageImpl().getMonth(); } + public commonj.sdo.Type getMonthDay() { return (commonj.sdo.Type)getModelPackageImpl().getMonthDay(); } + public commonj.sdo.Type getObject() { return (commonj.sdo.Type)getModelPackageImpl().getObject(); } + public commonj.sdo.Type getShort() { return (commonj.sdo.Type)getModelPackageImpl().getShort(); } + public commonj.sdo.Type getShortObject() { return (commonj.sdo.Type)getModelPackageImpl().getShortObject(); } + public commonj.sdo.Type getString() { return (commonj.sdo.Type)getModelPackageImpl().getString(); } + public commonj.sdo.Type getStrings() { return (commonj.sdo.Type)getModelPackageImpl().getStrings(); } + public commonj.sdo.Type getTime() { return (commonj.sdo.Type)getModelPackageImpl().getTime(); } + public commonj.sdo.Type getURI() { return (commonj.sdo.Type)getModelPackageImpl().getURI(); } + public commonj.sdo.Type getYear() { return (commonj.sdo.Type)getModelPackageImpl().getYear(); } + public commonj.sdo.Type getYearMonth() { return (commonj.sdo.Type)getModelPackageImpl().getYearMonth(); } + public commonj.sdo.Type getYearMonthDay() { return (commonj.sdo.Type)getModelPackageImpl().getYearMonthDay(); } + +} //ModelFactoryImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelPackageImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelPackageImpl.java new file mode 100644 index 0000000000..86604e91f6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelPackageImpl.java @@ -0,0 +1,4331 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import java.math.BigDecimal; +import java.math.BigInteger; + +import java.util.Date; +import java.util.List; + +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.model.BaseDataGraphType; +import org.apache.tuscany.sdo.model.ChangeSummaryType; +import org.apache.tuscany.sdo.model.DataGraphType; +import org.apache.tuscany.sdo.model.DataObject; +import org.apache.tuscany.sdo.model.ModelFactory; +import org.apache.tuscany.sdo.model.ModelPackage; +import org.apache.tuscany.sdo.model.ModelsType; +import org.apache.tuscany.sdo.model.Property; +import org.apache.tuscany.sdo.model.TextType; +import org.apache.tuscany.sdo.model.Type; +import org.apache.tuscany.sdo.model.Types; +import org.apache.tuscany.sdo.model.XSDType; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.apache.tuscany.sdo.model.ModelFactory + * @generated + */ +public class ModelPackageImpl extends EPackageImpl implements ModelPackage +{ + /** + * The package name. + * + * + * @generated + */ + public static final String eNAME = "model"; + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String eNS_URI = "commonj.sdo"; + + /** + * The package namespace name. + * + * + * @generated NOT + */ + public static final String eNS_PREFIX = "sdo"; //FB why was this generated = "commonj" ? + + /** + * The singleton instance of the package. + * + * + * @generated + */ + public static final ModelPackageImpl eINSTANCE = org.apache.tuscany.sdo.model.impl.ModelPackageImpl.init(); + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl Base Data Graph Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getBaseDataGraphType() + * @generated + */ + public static final int BASE_DATA_GRAPH_TYPE = 0; + + /** + * The feature id for the 'Models' containment reference. + * + * + * @generated + * @ordered + */ + public static final int BASE_DATA_GRAPH_TYPE__MODELS = 0; + + /** + * The feature id for the 'Xsd' containment reference. + * + * + * @generated + * @ordered + */ + public static final int BASE_DATA_GRAPH_TYPE__XSD = 1; + + /** + * The feature id for the 'Change Summary' containment reference. + * + * + * @generated + * @ordered + */ + public static final int BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY = 2; + + /** + * The feature id for the 'Any Attribute' attribute list. + * + * + * @generated + * @ordered + */ + public static final int BASE_DATA_GRAPH_TYPE__ANY_ATTRIBUTE = 3; + + /** + * The number of structural features of the 'Base Data Graph Type' class. + * + * + * @generated + * @ordered + */ + public static final int BASE_DATA_GRAPH_TYPE_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.ChangeSummaryTypeImpl Change Summary Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.ChangeSummaryTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getChangeSummaryType() + * @generated + */ + public static final int CHANGE_SUMMARY_TYPE = 1; + + /** + * The feature id for the 'Any' attribute list. + * + * + * @generated + * @ordered + */ + public static final int CHANGE_SUMMARY_TYPE__ANY = 0; + + /** + * The feature id for the 'Create' attribute. + * + * + * @generated + * @ordered + */ + public static final int CHANGE_SUMMARY_TYPE__CREATE = 1; + + /** + * The feature id for the 'Delete' attribute. + * + * + * @generated + * @ordered + */ + public static final int CHANGE_SUMMARY_TYPE__DELETE = 2; + + /** + * The feature id for the 'Logging' attribute. + * + * + * @generated + * @ordered + */ + public static final int CHANGE_SUMMARY_TYPE__LOGGING = 3; + + /** + * The number of structural features of the 'Change Summary Type' class. + * + * + * @generated + * @ordered + */ + public static final int CHANGE_SUMMARY_TYPE_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.DataGraphTypeImpl Data Graph Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.DataGraphTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDataGraphType() + * @generated + */ + public static final int DATA_GRAPH_TYPE = 2; + + /** + * The feature id for the 'Models' containment reference. + * + * + * @generated + * @ordered + */ + public static final int DATA_GRAPH_TYPE__MODELS = BASE_DATA_GRAPH_TYPE__MODELS; + + /** + * The feature id for the 'Xsd' containment reference. + * + * + * @generated + * @ordered + */ + public static final int DATA_GRAPH_TYPE__XSD = BASE_DATA_GRAPH_TYPE__XSD; + + /** + * The feature id for the 'Change Summary' containment reference. + * + * + * @generated + * @ordered + */ + public static final int DATA_GRAPH_TYPE__CHANGE_SUMMARY = BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY; + + /** + * The feature id for the 'Any Attribute' attribute list. + * + * + * @generated + * @ordered + */ + public static final int DATA_GRAPH_TYPE__ANY_ATTRIBUTE = BASE_DATA_GRAPH_TYPE__ANY_ATTRIBUTE; + + /** + * The feature id for the 'Any' attribute list. + * + * + * @generated + * @ordered + */ + public static final int DATA_GRAPH_TYPE__ANY = BASE_DATA_GRAPH_TYPE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Data Graph Type' class. + * + * + * @generated + * @ordered + */ + public static final int DATA_GRAPH_TYPE_FEATURE_COUNT = BASE_DATA_GRAPH_TYPE_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.DataObjectImpl Data Object}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.DataObjectImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDataObject() + * @generated + */ + public static final int DATA_OBJECT = 3; + + /** + * The number of structural features of the 'Data Object' class. + * + * + * @generated + * @ordered + */ + public static final int DATA_OBJECT_FEATURE_COUNT = 0; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.DocumentRootImpl Document Root}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.DocumentRootImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDocumentRoot() + * @generated + */ + public static final int DOCUMENT_ROOT = 4; + + /** + * The feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__MIXED = 0; + + /** + * The feature id for the 'XMLNS Prefix Map' map. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__XMLNS_PREFIX_MAP = 1; + + /** + * The feature id for the 'XSI Schema Location' map. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = 2; + + /** + * The feature id for the 'Datagraph' containment reference. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__DATAGRAPH = 3; + + /** + * The feature id for the 'Data Object' containment reference. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__DATA_OBJECT = 4; + + /** + * The feature id for the 'Type' containment reference. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__TYPE = 5; + + /** + * The feature id for the 'Types' containment reference. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__TYPES = 6; + + /** + * The feature id for the 'Ref' attribute. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__REF = 7; + + /** + * The number of structural features of the 'Document Root' class. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT_FEATURE_COUNT = 8; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.ModelsTypeImpl Models Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelsTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getModelsType() + * @generated + */ + public static final int MODELS_TYPE = 5; + + /** + * The feature id for the 'Any' attribute list. + * + * + * @generated + * @ordered + */ + public static final int MODELS_TYPE__ANY = 0; + + /** + * The number of structural features of the 'Models Type' class. + * + * + * @generated + * @ordered + */ + public static final int MODELS_TYPE_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.PropertyImpl Property}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.PropertyImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getProperty() + * @generated + */ + public static final int PROPERTY = 6; + + /** + * The feature id for the 'Alias Name' attribute list. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY__ALIAS_NAME = 0; + + /** + * The feature id for the 'Any' attribute list. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY__ANY = 1; + + /** + * The feature id for the 'Containment' attribute. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY__CONTAINMENT = 2; + + /** + * The feature id for the 'Default' attribute. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY__DEFAULT = 3; + + /** + * The feature id for the 'Many' attribute. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY__MANY = 4; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY__NAME = 5; + + /** + * The feature id for the 'Opposite' reference. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY__OPPOSITE = 6; + + /** + * The feature id for the 'Read Only' attribute. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY__READ_ONLY = 7; + + /** + * The feature id for the 'Type' reference. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY__TYPE = 8; + + /** + * The feature id for the 'Any Attribute' attribute list. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY__ANY_ATTRIBUTE = 9; + + /** + * The number of structural features of the 'Property' class. + * + * + * @generated + * @ordered + */ + public static final int PROPERTY_FEATURE_COUNT = 10; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.TextTypeImpl Text Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.TextTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getTextType() + * @generated + */ + public static final int TEXT_TYPE = 7; + + /** + * The feature id for the 'Text' attribute list. + * + * + * @generated + * @ordered + */ + public static final int TEXT_TYPE__TEXT = 0; + + /** + * The number of structural features of the 'Text Type' class. + * + * + * @generated + * @ordered + */ + public static final int TEXT_TYPE_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.TypeImpl Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.TypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getType() + * @generated + */ + public static final int TYPE = 8; + + /** + * The feature id for the 'Base Type' reference list. + * + * + * @generated + * @ordered + */ + public static final int TYPE__BASE_TYPE = 0; + + /** + * The feature id for the 'Property' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int TYPE__PROPERTY = 1; + + /** + * The feature id for the 'Alias Name' attribute list. + * + * + * @generated + * @ordered + */ + public static final int TYPE__ALIAS_NAME = 2; + + /** + * The feature id for the 'Any' attribute list. + * + * + * @generated + * @ordered + */ + public static final int TYPE__ANY = 3; + + /** + * The feature id for the 'Abstract' attribute. + * + * + * @generated + * @ordered + */ + public static final int TYPE__ABSTRACT = 4; + + /** + * The feature id for the 'Data Type' attribute. + * + * + * @generated + * @ordered + */ + public static final int TYPE__DATA_TYPE = 5; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + public static final int TYPE__NAME = 6; + + /** + * The feature id for the 'Open' attribute. + * + * + * @generated + * @ordered + */ + public static final int TYPE__OPEN = 7; + + /** + * The feature id for the 'Sequenced' attribute. + * + * + * @generated + * @ordered + */ + public static final int TYPE__SEQUENCED = 8; + + /** + * The feature id for the 'Uri' attribute. + * + * + * @generated + * @ordered + */ + public static final int TYPE__URI = 9; + + /** + * The feature id for the 'Any Attribute' attribute list. + * + * + * @generated + * @ordered + */ + public static final int TYPE__ANY_ATTRIBUTE = 10; + + /** + * The number of structural features of the 'Type' class. + * + * + * @generated + * @ordered + */ + public static final int TYPE_FEATURE_COUNT = 11; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.TypesImpl Types}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.TypesImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getTypes() + * @generated + */ + public static final int TYPES = 9; + + /** + * The feature id for the 'Type' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int TYPES__TYPE = 0; + + /** + * The number of structural features of the 'Types' class. + * + * + * @generated + * @ordered + */ + public static final int TYPES_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.impl.XSDTypeImpl XSD Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.XSDTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getXSDType() + * @generated + */ + public static final int XSD_TYPE = 10; + + /** + * The feature id for the 'Any' attribute list. + * + * + * @generated + * @ordered + */ + public static final int XSD_TYPE__ANY = 0; + + /** + * The number of structural features of the 'XSD Type' class. + * + * + * @generated + * @ordered + */ + public static final int XSD_TYPE_FEATURE_COUNT = 1; + + /** + * The meta object id for the 'Boolean' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getBoolean() + * @generated + */ + public static final int BOOLEAN = 11; + + /** + * The meta object id for the 'Boolean Object' data type. + * + * + * @see java.lang.Boolean + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getBooleanObject() + * @generated + */ + public static final int BOOLEAN_OBJECT = 12; + + /** + * The meta object id for the 'Byte' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getByte() + * @generated + */ + public static final int BYTE = 13; + + /** + * The meta object id for the 'Byte Object' data type. + * + * + * @see java.lang.Byte + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getByteObject() + * @generated + */ + public static final int BYTE_OBJECT = 14; + + /** + * The meta object id for the 'Bytes' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getBytes() + * @generated + */ + public static final int BYTES = 15; + + /** + * The meta object id for the 'Character' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getCharacter() + * @generated + */ + public static final int CHARACTER = 16; + + /** + * The meta object id for the 'Character Object' data type. + * + * + * @see java.lang.Character + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getCharacterObject() + * @generated + */ + public static final int CHARACTER_OBJECT = 17; + + /** + * The meta object id for the 'Date' data type. + * + * + * @see java.util.Date + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDate() + * @generated + */ + public static final int DATE = 18; + + /** + * The meta object id for the 'Date Time' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDateTime() + * @generated + */ + public static final int DATE_TIME = 19; + + /** + * The meta object id for the 'Day' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDay() + * @generated + */ + public static final int DAY = 20; + + /** + * The meta object id for the 'Decimal' data type. + * + * + * @see java.math.BigDecimal + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDecimal() + * @generated + */ + public static final int DECIMAL = 21; + + /** + * The meta object id for the 'Double' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDouble() + * @generated + */ + public static final int DOUBLE = 22; + + /** + * The meta object id for the 'Double Object' data type. + * + * + * @see java.lang.Double + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDoubleObject() + * @generated + */ + public static final int DOUBLE_OBJECT = 23; + + /** + * The meta object id for the 'Duration' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDuration() + * @generated + */ + public static final int DURATION = 24; + + /** + * The meta object id for the 'Float' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getFloat() + * @generated + */ + public static final int FLOAT = 25; + + /** + * The meta object id for the 'Float Object' data type. + * + * + * @see java.lang.Float + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getFloatObject() + * @generated + */ + public static final int FLOAT_OBJECT = 26; + + /** + * The meta object id for the 'Int' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getInt() + * @generated + */ + public static final int INT = 27; + + /** + * The meta object id for the 'Integer' data type. + * + * + * @see java.math.BigInteger + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getInteger() + * @generated + */ + public static final int INTEGER = 28; + + /** + * The meta object id for the 'Int Object' data type. + * + * + * @see java.lang.Integer + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getIntObject() + * @generated + */ + public static final int INT_OBJECT = 29; + + /** + * The meta object id for the 'Long' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getLong() + * @generated + */ + public static final int LONG = 30; + + /** + * The meta object id for the 'Long Object' data type. + * + * + * @see java.lang.Long + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getLongObject() + * @generated + */ + public static final int LONG_OBJECT = 31; + + /** + * The meta object id for the 'Month' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getMonth() + * @generated + */ + public static final int MONTH = 32; + + /** + * The meta object id for the 'Month Day' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getMonthDay() + * @generated + */ + public static final int MONTH_DAY = 33; + + /** + * The meta object id for the 'Object' data type. + * + * + * @see java.lang.Object + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getObject() + * @generated + */ + public static final int OBJECT = 34; + + /** + * The meta object id for the 'Short' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getShort() + * @generated + */ + public static final int SHORT = 35; + + /** + * The meta object id for the 'Short Object' data type. + * + * + * @see java.lang.Short + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getShortObject() + * @generated + */ + public static final int SHORT_OBJECT = 36; + + /** + * The meta object id for the 'String' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getString() + * @generated + */ + public static final int STRING = 37; + + /** + * The meta object id for the 'Strings' data type. + * + * + * @see java.util.List + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getStrings() + * @generated + */ + public static final int STRINGS = 38; + + /** + * The meta object id for the 'Time' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getTime() + * @generated + */ + public static final int TIME = 39; + + /** + * The meta object id for the 'URI' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getURI() + * @generated + */ + public static final int URI = 40; + + /** + * The meta object id for the 'Year' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getYear() + * @generated + */ + public static final int YEAR = 41; + + /** + * The meta object id for the 'Year Month' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getYearMonth() + * @generated + */ + public static final int YEAR_MONTH = 42; + + /** + * The meta object id for the 'Year Month Day' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getYearMonthDay() + * @generated + */ + public static final int YEAR_MONTH_DAY = 43; + + /** + * + * + * @generated + */ + private EClass baseDataGraphTypeEClass = null; + + /** + * + * + * @generated + */ + private EClass changeSummaryTypeEClass = null; + + /** + * + * + * @generated + */ + private EClass dataGraphTypeEClass = null; + + /** + * + * + * @generated + */ + private EClass dataObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass documentRootEClass = null; + + /** + * + * + * @generated + */ + private EClass modelsTypeEClass = null; + + /** + * + * + * @generated + */ + private EClass propertyEClass = null; + + /** + * + * + * @generated + */ + private EClass textTypeEClass = null; + + /** + * + * + * @generated + */ + private EClass typeEClass = null; + + /** + * + * + * @generated + */ + private EClass typesEClass = null; + + /** + * + * + * @generated + */ + private EClass xsdTypeEClass = null; + + /** + * + * + * @generated + */ + private EDataType booleanEDataType = null; + + /** + * + * + * @generated + */ + private EDataType booleanObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType byteEDataType = null; + + /** + * + * + * @generated + */ + private EDataType byteObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType bytesEDataType = null; + + /** + * + * + * @generated + */ + private EDataType characterEDataType = null; + + /** + * + * + * @generated + */ + private EDataType characterObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType dateEDataType = null; + + /** + * + * + * @generated + */ + private EDataType dateTimeEDataType = null; + + /** + * + * + * @generated + */ + private EDataType dayEDataType = null; + + /** + * + * + * @generated + */ + private EDataType decimalEDataType = null; + + /** + * + * + * @generated + */ + private EDataType doubleEDataType = null; + + /** + * + * + * @generated + */ + private EDataType doubleObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType durationEDataType = null; + + /** + * + * + * @generated + */ + private EDataType floatEDataType = null; + + /** + * + * + * @generated + */ + private EDataType floatObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType intEDataType = null; + + /** + * + * + * @generated + */ + private EDataType integerEDataType = null; + + /** + * + * + * @generated + */ + private EDataType intObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType longEDataType = null; + + /** + * + * + * @generated + */ + private EDataType longObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType monthEDataType = null; + + /** + * + * + * @generated + */ + private EDataType monthDayEDataType = null; + + /** + * + * + * @generated + */ + private EDataType objectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType shortEDataType = null; + + /** + * + * + * @generated + */ + private EDataType shortObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType stringEDataType = null; + + /** + * + * + * @generated + */ + private EDataType stringsEDataType = null; + + /** + * + * + * @generated + */ + private EDataType timeEDataType = null; + + /** + * + * + * @generated + */ + private EDataType uriEDataType = null; + + /** + * + * + * @generated + */ + private EDataType yearEDataType = null; + + /** + * + * + * @generated + */ + private EDataType yearMonthEDataType = null; + + /** + * + * + * @generated + */ + private EDataType yearMonthDayEDataType = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#eNS_URI + * @see #init() + * @generated + */ + private ModelPackageImpl() + { + super(eNS_URI, ((EFactory)ModelFactory.INSTANCE)); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + *

Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + *

Invocation of this method will not affect any packages that have + * already been initialized. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static ModelPackageImpl init() + { + if (isInited) return (ModelPackageImpl)EPackage.Registry.INSTANCE.getEPackage(ModelPackageImpl.eNS_URI); + + // Obtain or create and register package + ModelPackageImpl theModelPackageImpl = (ModelPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new ModelPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + XMLTypePackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theModelPackageImpl.createPackageContents(); + + // Initialize created meta-data + theModelPackageImpl.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theModelPackageImpl.freeze(); + + return theModelPackageImpl; + } + + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.BaseDataGraphType Base Data Graph Type}'. + * + * + * @return the meta object for class 'Base Data Graph Type'. + * @see org.apache.tuscany.sdo.model.BaseDataGraphType + * @generated + */ + public EClass getBaseDataGraphType() + { + return baseDataGraphTypeEClass; + } + + /** + * Returns the meta object for the containment reference '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getModels Models}'. + * + * + * @return the meta object for the containment reference 'Models'. + * @see org.apache.tuscany.sdo.model.BaseDataGraphType#getModels() + * @see #getBaseDataGraphType() + * @generated + */ + public EReference getBaseDataGraphType_Models() + { + return (EReference)baseDataGraphTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the containment reference '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getXsd Xsd}'. + * + * + * @return the meta object for the containment reference 'Xsd'. + * @see org.apache.tuscany.sdo.model.BaseDataGraphType#getXsd() + * @see #getBaseDataGraphType() + * @generated + */ + public EReference getBaseDataGraphType_Xsd() + { + return (EReference)baseDataGraphTypeEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the containment reference '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getChangeSummary Change Summary}'. + * + * + * @return the meta object for the containment reference 'Change Summary'. + * @see org.apache.tuscany.sdo.model.BaseDataGraphType#getChangeSummary() + * @see #getBaseDataGraphType() + * @generated + */ + public EReference getBaseDataGraphType_ChangeSummary() + { + return (EReference)baseDataGraphTypeEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.BaseDataGraphType#getAnyAttribute Any Attribute}'. + * + * + * @return the meta object for the attribute list 'Any Attribute'. + * @see org.apache.tuscany.sdo.model.BaseDataGraphType#getAnyAttribute() + * @see #getBaseDataGraphType() + * @generated + */ + public EAttribute getBaseDataGraphType_AnyAttribute() + { + return (EAttribute)baseDataGraphTypeEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.ChangeSummaryType Change Summary Type}'. + * + * + * @return the meta object for class 'Change Summary Type'. + * @see org.apache.tuscany.sdo.model.ChangeSummaryType + * @generated + */ + public EClass getChangeSummaryType() + { + return changeSummaryTypeEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.ChangeSummaryType#getAny Any}'. + * + * + * @return the meta object for the attribute list 'Any'. + * @see org.apache.tuscany.sdo.model.ChangeSummaryType#getAny() + * @see #getChangeSummaryType() + * @generated + */ + public EAttribute getChangeSummaryType_Any() + { + return (EAttribute)changeSummaryTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.ChangeSummaryType#getCreate Create}'. + * + * + * @return the meta object for the attribute 'Create'. + * @see org.apache.tuscany.sdo.model.ChangeSummaryType#getCreate() + * @see #getChangeSummaryType() + * @generated + */ + public EAttribute getChangeSummaryType_Create() + { + return (EAttribute)changeSummaryTypeEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.ChangeSummaryType#getDelete Delete}'. + * + * + * @return the meta object for the attribute 'Delete'. + * @see org.apache.tuscany.sdo.model.ChangeSummaryType#getDelete() + * @see #getChangeSummaryType() + * @generated + */ + public EAttribute getChangeSummaryType_Delete() + { + return (EAttribute)changeSummaryTypeEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.ChangeSummaryType#isLogging Logging}'. + * + * + * @return the meta object for the attribute 'Logging'. + * @see org.apache.tuscany.sdo.model.ChangeSummaryType#isLogging() + * @see #getChangeSummaryType() + * @generated + */ + public EAttribute getChangeSummaryType_Logging() + { + return (EAttribute)changeSummaryTypeEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.DataGraphType Data Graph Type}'. + * + * + * @return the meta object for class 'Data Graph Type'. + * @see org.apache.tuscany.sdo.model.DataGraphType + * @generated + */ + public EClass getDataGraphType() + { + return dataGraphTypeEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.DataGraphType#getAny Any}'. + * + * + * @return the meta object for the attribute list 'Any'. + * @see org.apache.tuscany.sdo.model.DataGraphType#getAny() + * @see #getDataGraphType() + * @generated + */ + public EAttribute getDataGraphType_Any() + { + return (EAttribute)dataGraphTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.DataObject Data Object}'. + * + * + * @return the meta object for class 'Data Object'. + * @see org.apache.tuscany.sdo.model.DataObject + * @generated + */ + public EClass getDataObject() + { + return dataObjectEClass; + } + + /** + * Returns the meta object for class '{@link org.eclipse.emf.ecore.EObject Document Root}'. + * + * + * @return the meta object for class 'Document Root'. + * @see org.eclipse.emf.ecore.EObject + * @generated + */ + public EClass getDocumentRoot() + { + return documentRootEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.eclipse.emf.ecore.EObject#getMixed Mixed}'. + * + * + * @return the meta object for the attribute list 'Mixed'. + * @see org.eclipse.emf.ecore.EObject#getMixed() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_Mixed() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap XMLNS Prefix Map}'. + * + * + * @return the meta object for the map 'XMLNS Prefix Map'. + * @see org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_XMLNSPrefixMap() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXSISchemaLocation XSI Schema Location}'. + * + * + * @return the meta object for the map 'XSI Schema Location'. + * @see org.eclipse.emf.ecore.EObject#getXSISchemaLocation() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_XSISchemaLocation() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.emf.ecore.EObject#getDatagraph Datagraph}'. + * + * + * @return the meta object for the containment reference 'Datagraph'. + * @see org.eclipse.emf.ecore.EObject#getDatagraph() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_Datagraph() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.emf.ecore.EObject#getDataObject Data Object}'. + * + * + * @return the meta object for the containment reference 'Data Object'. + * @see org.eclipse.emf.ecore.EObject#getDataObject() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_DataObject() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(4); + } + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.emf.ecore.EObject#getType Type}'. + * + * + * @return the meta object for the containment reference 'Type'. + * @see org.eclipse.emf.ecore.EObject#getType() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_Type() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(5); + } + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.emf.ecore.EObject#getTypes Types}'. + * + * + * @return the meta object for the containment reference 'Types'. + * @see org.eclipse.emf.ecore.EObject#getTypes() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_Types() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(6); + } + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.ecore.EObject#getRef Ref}'. + * + * + * @return the meta object for the attribute 'Ref'. + * @see org.eclipse.emf.ecore.EObject#getRef() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_Ref() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(7); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.ModelsType Models Type}'. + * + * + * @return the meta object for class 'Models Type'. + * @see org.apache.tuscany.sdo.model.ModelsType + * @generated + */ + public EClass getModelsType() + { + return modelsTypeEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.ModelsType#getAny Any}'. + * + * + * @return the meta object for the attribute list 'Any'. + * @see org.apache.tuscany.sdo.model.ModelsType#getAny() + * @see #getModelsType() + * @generated + */ + public EAttribute getModelsType_Any() + { + return (EAttribute)modelsTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.Property Property}'. + * + * + * @return the meta object for class 'Property'. + * @see org.apache.tuscany.sdo.model.Property + * @generated + */ + public EClass getProperty() + { + return propertyEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.Property#getAliasName Alias Name}'. + * + * + * @return the meta object for the attribute list 'Alias Name'. + * @see org.apache.tuscany.sdo.model.Property#getAliasName() + * @see #getProperty() + * @generated + */ + public EAttribute getProperty_AliasName() + { + return (EAttribute)propertyEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.Property#getAny Any}'. + * + * + * @return the meta object for the attribute list 'Any'. + * @see org.apache.tuscany.sdo.model.Property#getAny() + * @see #getProperty() + * @generated + */ + public EAttribute getProperty_Any() + { + return (EAttribute)propertyEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Property#isContainment Containment}'. + * + * + * @return the meta object for the attribute 'Containment'. + * @see org.apache.tuscany.sdo.model.Property#isContainment() + * @see #getProperty() + * @generated + */ + public EAttribute getProperty_Containment() + { + return (EAttribute)propertyEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Property#getDefault Default}'. + * + * + * @return the meta object for the attribute 'Default'. + * @see org.apache.tuscany.sdo.model.Property#getDefault() + * @see #getProperty() + * @generated + */ + public EAttribute getProperty_Default() + { + return (EAttribute)propertyEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Property#isMany Many}'. + * + * + * @return the meta object for the attribute 'Many'. + * @see org.apache.tuscany.sdo.model.Property#isMany() + * @see #getProperty() + * @generated + */ + public EAttribute getProperty_Many() + { + return (EAttribute)propertyEClass.getEStructuralFeatures().get(4); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Property#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.apache.tuscany.sdo.model.Property#getName() + * @see #getProperty() + * @generated + */ + public EAttribute getProperty_Name() + { + return (EAttribute)propertyEClass.getEStructuralFeatures().get(5); + } + + /** + * Returns the meta object for the reference '{@link org.apache.tuscany.sdo.model.Property#getOpposite Opposite}'. + * + * + * @return the meta object for the reference 'Opposite'. + * @see org.apache.tuscany.sdo.model.Property#getOpposite() + * @see #getProperty() + * @generated + */ + public EReference getProperty_Opposite() + { + return (EReference)propertyEClass.getEStructuralFeatures().get(6); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Property#isReadOnly Read Only}'. + * + * + * @return the meta object for the attribute 'Read Only'. + * @see org.apache.tuscany.sdo.model.Property#isReadOnly() + * @see #getProperty() + * @generated + */ + public EAttribute getProperty_ReadOnly() + { + return (EAttribute)propertyEClass.getEStructuralFeatures().get(7); + } + + /** + * Returns the meta object for the reference '{@link org.apache.tuscany.sdo.model.Property#getType Type}'. + * + * + * @return the meta object for the reference 'Type'. + * @see org.apache.tuscany.sdo.model.Property#getType() + * @see #getProperty() + * @generated + */ + public EReference getProperty_Type() + { + return (EReference)propertyEClass.getEStructuralFeatures().get(8); + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.Property#getAnyAttribute Any Attribute}'. + * + * + * @return the meta object for the attribute list 'Any Attribute'. + * @see org.apache.tuscany.sdo.model.Property#getAnyAttribute() + * @see #getProperty() + * @generated + */ + public EAttribute getProperty_AnyAttribute() + { + return (EAttribute)propertyEClass.getEStructuralFeatures().get(9); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.TextType Text Type}'. + * + * + * @return the meta object for class 'Text Type'. + * @see org.apache.tuscany.sdo.model.TextType + * @generated + */ + public EClass getTextType() + { + return textTypeEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.TextType#getText Text}'. + * + * + * @return the meta object for the attribute list 'Text'. + * @see org.apache.tuscany.sdo.model.TextType#getText() + * @see #getTextType() + * @generated + */ + public EAttribute getTextType_Text() + { + return (EAttribute)textTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.Type Type}'. + * + * + * @return the meta object for class 'Type'. + * @see org.apache.tuscany.sdo.model.Type + * @generated + */ + public EClass getType() + { + return typeEClass; + } + + /** + * Returns the meta object for the reference list '{@link org.apache.tuscany.sdo.model.Type#getBaseType Base Type}'. + * + * + * @return the meta object for the reference list 'Base Type'. + * @see org.apache.tuscany.sdo.model.Type#getBaseType() + * @see #getType() + * @generated + */ + public EReference getType_BaseType() + { + return (EReference)typeEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.sdo.model.Type#getProperty Property}'. + * + * + * @return the meta object for the containment reference list 'Property'. + * @see org.apache.tuscany.sdo.model.Type#getProperty() + * @see #getType() + * @generated + */ + public EReference getType_Property() + { + return (EReference)typeEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.Type#getAliasName Alias Name}'. + * + * + * @return the meta object for the attribute list 'Alias Name'. + * @see org.apache.tuscany.sdo.model.Type#getAliasName() + * @see #getType() + * @generated + */ + public EAttribute getType_AliasName() + { + return (EAttribute)typeEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.Type#getAny Any}'. + * + * + * @return the meta object for the attribute list 'Any'. + * @see org.apache.tuscany.sdo.model.Type#getAny() + * @see #getType() + * @generated + */ + public EAttribute getType_Any() + { + return (EAttribute)typeEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Type#isAbstract Abstract}'. + * + * + * @return the meta object for the attribute 'Abstract'. + * @see org.apache.tuscany.sdo.model.Type#isAbstract() + * @see #getType() + * @generated + */ + public EAttribute getType_Abstract() + { + return (EAttribute)typeEClass.getEStructuralFeatures().get(4); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Type#isDataType Data Type}'. + * + * + * @return the meta object for the attribute 'Data Type'. + * @see org.apache.tuscany.sdo.model.Type#isDataType() + * @see #getType() + * @generated + */ + public EAttribute getType_DataType() + { + return (EAttribute)typeEClass.getEStructuralFeatures().get(5); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Type#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.apache.tuscany.sdo.model.Type#getName() + * @see #getType() + * @generated + */ + public EAttribute getType_Name() + { + return (EAttribute)typeEClass.getEStructuralFeatures().get(6); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Type#isOpen Open}'. + * + * + * @return the meta object for the attribute 'Open'. + * @see org.apache.tuscany.sdo.model.Type#isOpen() + * @see #getType() + * @generated + */ + public EAttribute getType_Open() + { + return (EAttribute)typeEClass.getEStructuralFeatures().get(7); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Type#isSequenced Sequenced}'. + * + * + * @return the meta object for the attribute 'Sequenced'. + * @see org.apache.tuscany.sdo.model.Type#isSequenced() + * @see #getType() + * @generated + */ + public EAttribute getType_Sequenced() + { + return (EAttribute)typeEClass.getEStructuralFeatures().get(8); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.Type#getUri Uri}'. + * + * + * @return the meta object for the attribute 'Uri'. + * @see org.apache.tuscany.sdo.model.Type#getUri() + * @see #getType() + * @generated + */ + public EAttribute getType_Uri() + { + return (EAttribute)typeEClass.getEStructuralFeatures().get(9); + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.Type#getAnyAttribute Any Attribute}'. + * + * + * @return the meta object for the attribute list 'Any Attribute'. + * @see org.apache.tuscany.sdo.model.Type#getAnyAttribute() + * @see #getType() + * @generated + */ + public EAttribute getType_AnyAttribute() + { + return (EAttribute)typeEClass.getEStructuralFeatures().get(10); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.Types Types}'. + * + * + * @return the meta object for class 'Types'. + * @see org.apache.tuscany.sdo.model.Types + * @generated + */ + public EClass getTypes() + { + return typesEClass; + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.sdo.model.Types#getType Type}'. + * + * + * @return the meta object for the containment reference list 'Type'. + * @see org.apache.tuscany.sdo.model.Types#getType() + * @see #getTypes() + * @generated + */ + public EReference getTypes_Type() + { + return (EReference)typesEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.XSDType XSD Type}'. + * + * + * @return the meta object for class 'XSD Type'. + * @see org.apache.tuscany.sdo.model.XSDType + * @generated + */ + public EClass getXSDType() + { + return xsdTypeEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.apache.tuscany.sdo.model.XSDType#getAny Any}'. + * + * + * @return the meta object for the attribute list 'Any'. + * @see org.apache.tuscany.sdo.model.XSDType#getAny() + * @see #getXSDType() + * @generated + */ + public EAttribute getXSDType_Any() + { + return (EAttribute)xsdTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for data type 'Boolean'. + * + * + * @return the meta object for data type 'Boolean'. + * @generated + */ + public EDataType getBoolean() + { + return booleanEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Boolean Boolean Object}'. + * + * + * @return the meta object for data type 'Boolean Object'. + * @see java.lang.Boolean + * @generated + */ + public EDataType getBooleanObject() + { + return booleanObjectEDataType; + } + + /** + * Returns the meta object for data type 'Byte'. + * + * + * @return the meta object for data type 'Byte'. + * @generated + */ + public EDataType getByte() + { + return byteEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Byte Byte Object}'. + * + * + * @return the meta object for data type 'Byte Object'. + * @see java.lang.Byte + * @generated + */ + public EDataType getByteObject() + { + return byteObjectEDataType; + } + + /** + * Returns the meta object for data type 'Bytes'. + * + * + * @return the meta object for data type 'Bytes'. + * @generated + */ + public EDataType getBytes() + { + return bytesEDataType; + } + + /** + * Returns the meta object for data type 'Character'. + * + * + * @return the meta object for data type 'Character'. + * @generated + */ + public EDataType getCharacter() + { + return characterEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Character Character Object}'. + * + * + * @return the meta object for data type 'Character Object'. + * @see java.lang.Character + * @generated + */ + public EDataType getCharacterObject() + { + return characterObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.util.Date Date}'. + * + * + * @return the meta object for data type 'Date'. + * @see java.util.Date + * @generated + */ + public EDataType getDate() + { + return dateEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String Date Time}'. + * + * + * @return the meta object for data type 'Date Time'. + * @see java.lang.String + * @generated + */ + public EDataType getDateTime() + { + return dateTimeEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String Day}'. + * + * + * @return the meta object for data type 'Day'. + * @see java.lang.String + * @generated + */ + public EDataType getDay() + { + return dayEDataType; + } + + /** + * Returns the meta object for data type '{@link java.math.BigDecimal Decimal}'. + * + * + * @return the meta object for data type 'Decimal'. + * @see java.math.BigDecimal + * @generated + */ + public EDataType getDecimal() + { + return decimalEDataType; + } + + /** + * Returns the meta object for data type 'Double'. + * + * + * @return the meta object for data type 'Double'. + * @generated + */ + public EDataType getDouble() + { + return doubleEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Double Double Object}'. + * + * + * @return the meta object for data type 'Double Object'. + * @see java.lang.Double + * @generated + */ + public EDataType getDoubleObject() + { + return doubleObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String Duration}'. + * + * + * @return the meta object for data type 'Duration'. + * @see java.lang.String + * @generated + */ + public EDataType getDuration() + { + return durationEDataType; + } + + /** + * Returns the meta object for data type 'Float'. + * + * + * @return the meta object for data type 'Float'. + * @generated + */ + public EDataType getFloat() + { + return floatEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Float Float Object}'. + * + * + * @return the meta object for data type 'Float Object'. + * @see java.lang.Float + * @generated + */ + public EDataType getFloatObject() + { + return floatObjectEDataType; + } + + /** + * Returns the meta object for data type 'Int'. + * + * + * @return the meta object for data type 'Int'. + * @generated + */ + public EDataType getInt() + { + return intEDataType; + } + + /** + * Returns the meta object for data type '{@link java.math.BigInteger Integer}'. + * + * + * @return the meta object for data type 'Integer'. + * @see java.math.BigInteger + * @generated + */ + public EDataType getInteger() + { + return integerEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Integer Int Object}'. + * + * + * @return the meta object for data type 'Int Object'. + * @see java.lang.Integer + * @generated + */ + public EDataType getIntObject() + { + return intObjectEDataType; + } + + /** + * Returns the meta object for data type 'Long'. + * + * + * @return the meta object for data type 'Long'. + * @generated + */ + public EDataType getLong() + { + return longEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Long Long Object}'. + * + * + * @return the meta object for data type 'Long Object'. + * @see java.lang.Long + * @generated + */ + public EDataType getLongObject() + { + return longObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String Month}'. + * + * + * @return the meta object for data type 'Month'. + * @see java.lang.String + * @generated + */ + public EDataType getMonth() + { + return monthEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String Month Day}'. + * + * + * @return the meta object for data type 'Month Day'. + * @see java.lang.String + * @generated + */ + public EDataType getMonthDay() + { + return monthDayEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Object Object}'. + * + * + * @return the meta object for data type 'Object'. + * @see java.lang.Object + * @generated + */ + public EDataType getObject() + { + return objectEDataType; + } + + /** + * Returns the meta object for data type 'Short'. + * + * + * @return the meta object for data type 'Short'. + * @generated + */ + public EDataType getShort() + { + return shortEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Short Short Object}'. + * + * + * @return the meta object for data type 'Short Object'. + * @see java.lang.Short + * @generated + */ + public EDataType getShortObject() + { + return shortObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String String}'. + * + * + * @return the meta object for data type 'String'. + * @see java.lang.String + * @generated + */ + public EDataType getString() + { + return stringEDataType; + } + + /** + * Returns the meta object for data type '{@link java.util.List Strings}'. + * + * + * @return the meta object for data type 'Strings'. + * @see java.util.List + * @generated + */ + public EDataType getStrings() + { + return stringsEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String Time}'. + * + * + * @return the meta object for data type 'Time'. + * @see java.lang.String + * @generated + */ + public EDataType getTime() + { + return timeEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String URI}'. + * + * + * @return the meta object for data type 'URI'. + * @see java.lang.String + * @generated + */ + public EDataType getURI() + { + return uriEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String Year}'. + * + * + * @return the meta object for data type 'Year'. + * @see java.lang.String + * @generated + */ + public EDataType getYear() + { + return yearEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String Year Month}'. + * + * + * @return the meta object for data type 'Year Month'. + * @see java.lang.String + * @generated + */ + public EDataType getYearMonth() + { + return yearMonthEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.String Year Month Day}'. + * + * + * @return the meta object for data type 'Year Month Day'. + * @see java.lang.String + * @generated + */ + public EDataType getYearMonthDay() + { + return yearMonthDayEDataType; + } + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + public ModelFactory getModelFactory() + { + return (ModelFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + baseDataGraphTypeEClass = createEClass(BASE_DATA_GRAPH_TYPE); + createEReference(baseDataGraphTypeEClass, BASE_DATA_GRAPH_TYPE__MODELS); + createEReference(baseDataGraphTypeEClass, BASE_DATA_GRAPH_TYPE__XSD); + createEReference(baseDataGraphTypeEClass, BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY); + createEAttribute(baseDataGraphTypeEClass, BASE_DATA_GRAPH_TYPE__ANY_ATTRIBUTE); + + changeSummaryTypeEClass = createEClass(CHANGE_SUMMARY_TYPE); + createEAttribute(changeSummaryTypeEClass, CHANGE_SUMMARY_TYPE__ANY); + createEAttribute(changeSummaryTypeEClass, CHANGE_SUMMARY_TYPE__CREATE); + createEAttribute(changeSummaryTypeEClass, CHANGE_SUMMARY_TYPE__DELETE); + createEAttribute(changeSummaryTypeEClass, CHANGE_SUMMARY_TYPE__LOGGING); + + dataGraphTypeEClass = createEClass(DATA_GRAPH_TYPE); + createEAttribute(dataGraphTypeEClass, DATA_GRAPH_TYPE__ANY); + + dataObjectEClass = createEClass(DATA_OBJECT); + + documentRootEClass = createEClass(DOCUMENT_ROOT); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__MIXED); + createEReference(documentRootEClass, DOCUMENT_ROOT__XMLNS_PREFIX_MAP); + createEReference(documentRootEClass, DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); + createEReference(documentRootEClass, DOCUMENT_ROOT__DATAGRAPH); + createEReference(documentRootEClass, DOCUMENT_ROOT__DATA_OBJECT); + createEReference(documentRootEClass, DOCUMENT_ROOT__TYPE); + createEReference(documentRootEClass, DOCUMENT_ROOT__TYPES); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__REF); + + modelsTypeEClass = createEClass(MODELS_TYPE); + createEAttribute(modelsTypeEClass, MODELS_TYPE__ANY); + + propertyEClass = createEClass(PROPERTY); + createEAttribute(propertyEClass, PROPERTY__ALIAS_NAME); + createEAttribute(propertyEClass, PROPERTY__ANY); + createEAttribute(propertyEClass, PROPERTY__CONTAINMENT); + createEAttribute(propertyEClass, PROPERTY__DEFAULT); + createEAttribute(propertyEClass, PROPERTY__MANY); + createEAttribute(propertyEClass, PROPERTY__NAME); + createEReference(propertyEClass, PROPERTY__OPPOSITE); + createEAttribute(propertyEClass, PROPERTY__READ_ONLY); + createEReference(propertyEClass, PROPERTY__TYPE); + createEAttribute(propertyEClass, PROPERTY__ANY_ATTRIBUTE); + + textTypeEClass = createEClass(TEXT_TYPE); + createEAttribute(textTypeEClass, TEXT_TYPE__TEXT); + + typeEClass = createEClass(TYPE); + createEReference(typeEClass, TYPE__BASE_TYPE); + createEReference(typeEClass, TYPE__PROPERTY); + createEAttribute(typeEClass, TYPE__ALIAS_NAME); + createEAttribute(typeEClass, TYPE__ANY); + createEAttribute(typeEClass, TYPE__ABSTRACT); + createEAttribute(typeEClass, TYPE__DATA_TYPE); + createEAttribute(typeEClass, TYPE__NAME); + createEAttribute(typeEClass, TYPE__OPEN); + createEAttribute(typeEClass, TYPE__SEQUENCED); + createEAttribute(typeEClass, TYPE__URI); + createEAttribute(typeEClass, TYPE__ANY_ATTRIBUTE); + + typesEClass = createEClass(TYPES); + createEReference(typesEClass, TYPES__TYPE); + + xsdTypeEClass = createEClass(XSD_TYPE); + createEAttribute(xsdTypeEClass, XSD_TYPE__ANY); + + // Create data types + booleanEDataType = createEDataType(BOOLEAN); + booleanObjectEDataType = createEDataType(BOOLEAN_OBJECT); + byteEDataType = createEDataType(BYTE); + byteObjectEDataType = createEDataType(BYTE_OBJECT); + bytesEDataType = createEDataType(BYTES); + characterEDataType = createEDataType(CHARACTER); + characterObjectEDataType = createEDataType(CHARACTER_OBJECT); + dateEDataType = createEDataType(DATE); + dateTimeEDataType = createEDataType(DATE_TIME); + dayEDataType = createEDataType(DAY); + decimalEDataType = createEDataType(DECIMAL); + doubleEDataType = createEDataType(DOUBLE); + doubleObjectEDataType = createEDataType(DOUBLE_OBJECT); + durationEDataType = createEDataType(DURATION); + floatEDataType = createEDataType(FLOAT); + floatObjectEDataType = createEDataType(FLOAT_OBJECT); + intEDataType = createEDataType(INT); + integerEDataType = createEDataType(INTEGER); + intObjectEDataType = createEDataType(INT_OBJECT); + longEDataType = createEDataType(LONG); + longObjectEDataType = createEDataType(LONG_OBJECT); + monthEDataType = createEDataType(MONTH); + monthDayEDataType = createEDataType(MONTH_DAY); + objectEDataType = createEDataType(OBJECT); + shortEDataType = createEDataType(SHORT); + shortObjectEDataType = createEDataType(SHORT_OBJECT); + stringEDataType = createEDataType(STRING); + stringsEDataType = createEDataType(STRINGS); + timeEDataType = createEDataType(TIME); + uriEDataType = createEDataType(URI); + yearEDataType = createEDataType(YEAR); + yearMonthEDataType = createEDataType(YEAR_MONTH); + yearMonthDayEDataType = createEDataType(YEAR_MONTH_DAY); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); + + // Add supertypes to classes + dataGraphTypeEClass.getESuperTypes().add(this.getBaseDataGraphType()); + + // Initialize classes and features; add operations and parameters + initEClass(baseDataGraphTypeEClass, BaseDataGraphType.class, "BaseDataGraphType", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getBaseDataGraphType_Models(), this.getModelsType(), null, "models", null, 0, 1, BaseDataGraphType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getBaseDataGraphType_Xsd(), this.getXSDType(), null, "xsd", null, 0, 1, BaseDataGraphType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getBaseDataGraphType_ChangeSummary(), this.getChangeSummaryType(), null, "changeSummary", null, 0, 1, BaseDataGraphType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getBaseDataGraphType_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), "anyAttribute", null, 0, -1, BaseDataGraphType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(changeSummaryTypeEClass, ChangeSummaryType.class, "ChangeSummaryType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getChangeSummaryType_Any(), ecorePackage.getEFeatureMapEntry(), "any", null, 0, -1, ChangeSummaryType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getChangeSummaryType_Create(), theXMLTypePackage.getString(), "create", null, 0, 1, ChangeSummaryType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getChangeSummaryType_Delete(), theXMLTypePackage.getString(), "delete", null, 0, 1, ChangeSummaryType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getChangeSummaryType_Logging(), theXMLTypePackage.getBoolean(), "logging", null, 0, 1, ChangeSummaryType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(dataGraphTypeEClass, DataGraphType.class, "DataGraphType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDataGraphType_Any(), ecorePackage.getEFeatureMapEntry(), "any", null, 0, 1, DataGraphType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(dataObjectEClass, DataObject.class, "DataObject", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(documentRootEClass, null, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_Datagraph(), this.getDataGraphType(), null, "datagraph", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_DataObject(), ecorePackage.getEObject(), null, "dataObject", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_Type(), this.getType(), null, "type", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_Types(), this.getTypes(), null, "types", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + initEAttribute(getDocumentRoot_Ref(), theXMLTypePackage.getString(), "ref", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(modelsTypeEClass, ModelsType.class, "ModelsType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getModelsType_Any(), ecorePackage.getEFeatureMapEntry(), "any", null, 0, -1, ModelsType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(propertyEClass, Property.class, "Property", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getProperty_AliasName(), this.getString(), "aliasName", null, 0, -1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getProperty_Any(), ecorePackage.getEFeatureMapEntry(), "any", null, 0, -1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getProperty_Containment(), this.getBoolean(), "containment", null, 0, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getProperty_Default(), this.getString(), "default", null, 0, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getProperty_Many(), this.getBoolean(), "many", null, 0, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getProperty_Name(), this.getString(), "name", null, 0, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getProperty_Opposite(), this.getProperty(), null, "opposite", null, 0, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getProperty_ReadOnly(), this.getBoolean(), "readOnly", null, 0, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getProperty_Type(), this.getType(), null, "type", null, 0, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getProperty_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), "anyAttribute", null, 0, -1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(textTypeEClass, TextType.class, "TextType", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getTextType_Text(), theXMLTypePackage.getString(), "text", null, 0, -1, TextType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(typeEClass, Type.class, "Type", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getType_BaseType(), this.getType(), null, "baseType", null, 0, -1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getType_Property(), this.getProperty(), null, "property", null, 0, -1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getType_AliasName(), this.getString(), "aliasName", null, 0, -1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getType_Any(), ecorePackage.getEFeatureMapEntry(), "any", null, 0, -1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getType_Abstract(), this.getBoolean(), "abstract", null, 0, 1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getType_DataType(), this.getBoolean(), "dataType", null, 0, 1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getType_Name(), theXMLTypePackage.getID(), "name", null, 0, 1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getType_Open(), this.getBoolean(), "open", null, 0, 1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getType_Sequenced(), this.getBoolean(), "sequenced", null, 0, 1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getType_Uri(), this.getURI(), "uri", null, 0, 1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getType_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), "anyAttribute", null, 0, -1, Type.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(typesEClass, Types.class, "Types", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getTypes_Type(), this.getType(), null, "type", null, 0, -1, Types.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(xsdTypeEClass, XSDType.class, "XSDType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getXSDType_Any(), ecorePackage.getEFeatureMapEntry(), "any", null, 0, -1, XSDType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Initialize data types + initEDataType(booleanEDataType, boolean.class, "Boolean", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(booleanObjectEDataType, Boolean.class, "BooleanObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(byteEDataType, byte.class, "Byte", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(byteObjectEDataType, Byte.class, "ByteObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(bytesEDataType, byte[].class, "Bytes", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(characterEDataType, char.class, "Character", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(characterObjectEDataType, Character.class, "CharacterObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(dateEDataType, Date.class, "Date", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(dateTimeEDataType, String.class, "DateTime", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(dayEDataType, String.class, "Day", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(decimalEDataType, BigDecimal.class, "Decimal", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(doubleEDataType, double.class, "Double", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(doubleObjectEDataType, Double.class, "DoubleObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(durationEDataType, String.class, "Duration", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(floatEDataType, float.class, "Float", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(floatObjectEDataType, Float.class, "FloatObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(intEDataType, int.class, "Int", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(integerEDataType, BigInteger.class, "Integer", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(intObjectEDataType, Integer.class, "IntObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(longEDataType, long.class, "Long", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(longObjectEDataType, Long.class, "LongObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(monthEDataType, String.class, "Month", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(monthDayEDataType, String.class, "MonthDay", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(objectEDataType, Object.class, "Object", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(shortEDataType, short.class, "Short", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(shortObjectEDataType, Short.class, "ShortObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(stringEDataType, String.class, "String", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(stringsEDataType, List.class, "Strings", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(timeEDataType, String.class, "Time", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(uriEDataType, String.class, "URI", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(yearEDataType, String.class, "Year", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(yearMonthEDataType, String.class, "YearMonth", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(yearMonthDayEDataType, String.class, "YearMonthDay", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http:///org/eclipse/emf/ecore/util/ExtendedMetaData + createExtendedMetaDataAnnotations(); + } + + /** + * Initializes the annotations for http:///org/eclipse/emf/ecore/util/ExtendedMetaData. + * + * + * @generated + */ + protected void createExtendedMetaDataAnnotations() + { + String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; + addAnnotation + (baseDataGraphTypeEClass, + source, + new String[] + { + "name", "BaseDataGraphType", + "kind", "elementOnly" + }); + addAnnotation + (getBaseDataGraphType_Models(), + source, + new String[] + { + "kind", "element", + "name", "models" + }); + addAnnotation + (getBaseDataGraphType_Xsd(), + source, + new String[] + { + "kind", "element", + "name", "xsd" + }); + addAnnotation + (getBaseDataGraphType_ChangeSummary(), + source, + new String[] + { + "kind", "element", + "name", "changeSummary" + }); + addAnnotation + (getBaseDataGraphType_AnyAttribute(), + source, + new String[] + { + "kind", "attributeWildcard", + "wildcards", "##other", + "name", ":3", + "processing", "lax" + }); + addAnnotation + (booleanEDataType, + source, + new String[] + { + "name", "Boolean" + }); + addAnnotation + (booleanObjectEDataType, + source, + new String[] + { + "name", "Boolean:Object", + "baseType", "Boolean" + }); + addAnnotation + (byteEDataType, + source, + new String[] + { + "name", "Byte" + }); + addAnnotation + (byteObjectEDataType, + source, + new String[] + { + "name", "Byte:Object", + "baseType", "Byte" + }); + addAnnotation + (bytesEDataType, + source, + new String[] + { + "name", "Bytes" + }); + addAnnotation + (changeSummaryTypeEClass, + source, + new String[] + { + "name", "ChangeSummaryType", + "kind", "elementOnly" + }); + addAnnotation + (getChangeSummaryType_Any(), + source, + new String[] + { + "kind", "elementWildcard", + "wildcards", "##any", + "name", ":0", + "processing", "lax" + }); + addAnnotation + (getChangeSummaryType_Create(), + source, + new String[] + { + "kind", "attribute", + "name", "create" + }); + addAnnotation + (getChangeSummaryType_Delete(), + source, + new String[] + { + "kind", "attribute", + "name", "delete" + }); + addAnnotation + (getChangeSummaryType_Logging(), + source, + new String[] + { + "kind", "attribute", + "name", "logging" + }); + addAnnotation + (characterEDataType, + source, + new String[] + { + "name", "Character" + }); + addAnnotation + (characterObjectEDataType, + source, + new String[] + { + "name", "Character:Object", + "baseType", "Character" + }); + addAnnotation + (dataGraphTypeEClass, + source, + new String[] + { + "name", "DataGraphType", + "kind", "elementOnly" + }); + addAnnotation + (getDataGraphType_Any(), + source, + new String[] + { + "kind", "elementWildcard", + "wildcards", "##other", + "name", ":4", + "processing", "lax" + }); + addAnnotation + (dataObjectEClass, + source, + new String[] + { + "name", "DataObject", + "kind", "empty" + }); + addAnnotation + (dateEDataType, + source, + new String[] + { + "name", "Date" + }); + addAnnotation + (dateTimeEDataType, + source, + new String[] + { + "name", "DateTime" + }); + addAnnotation + (dayEDataType, + source, + new String[] + { + "name", "Day" + }); + addAnnotation + (decimalEDataType, + source, + new String[] + { + "name", "Decimal" + }); + addAnnotation + (documentRootEClass, + source, + new String[] + { + "name", "", + "kind", "mixed" + }); + addAnnotation + (getDocumentRoot_Mixed(), + source, + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + addAnnotation + (getDocumentRoot_XMLNSPrefixMap(), + source, + new String[] + { + "kind", "attribute", + "name", "xmlns:prefix" + }); + addAnnotation + (getDocumentRoot_XSISchemaLocation(), + source, + new String[] + { + "kind", "attribute", + "name", "xsi:schemaLocation" + }); + addAnnotation + (getDocumentRoot_Datagraph(), + source, + new String[] + { + "kind", "element", + "name", "datagraph", + "namespace", "##targetNamespace" + }); + addAnnotation + (getDocumentRoot_DataObject(), + source, + new String[] + { + "kind", "element", + "name", "dataObject", + "namespace", "##targetNamespace" + }); + addAnnotation + (getDocumentRoot_Type(), + source, + new String[] + { + "kind", "element", + "name", "type", + "namespace", "##targetNamespace" + }); + addAnnotation + (getDocumentRoot_Types(), + source, + new String[] + { + "kind", "element", + "name", "types", + "namespace", "##targetNamespace" + }); + addAnnotation + (getDocumentRoot_Ref(), + source, + new String[] + { + "kind", "attribute", + "name", "ref", + "namespace", "##targetNamespace" + }); + addAnnotation + (doubleEDataType, + source, + new String[] + { + "name", "Double" + }); + addAnnotation + (doubleObjectEDataType, + source, + new String[] + { + "name", "Double:Object", + "baseType", "Double" + }); + addAnnotation + (durationEDataType, + source, + new String[] + { + "name", "Duration" + }); + addAnnotation + (floatEDataType, + source, + new String[] + { + "name", "Float" + }); + addAnnotation + (floatObjectEDataType, + source, + new String[] + { + "name", "Float:Object", + "baseType", "Float" + }); + addAnnotation + (intEDataType, + source, + new String[] + { + "name", "Int" + }); + addAnnotation + (integerEDataType, + source, + new String[] + { + "name", "Integer" + }); + addAnnotation + (intObjectEDataType, + source, + new String[] + { + "name", "Int:Object", + "baseType", "Int" + }); + addAnnotation + (longEDataType, + source, + new String[] + { + "name", "Long" + }); + addAnnotation + (longObjectEDataType, + source, + new String[] + { + "name", "Long:Object", + "baseType", "Long" + }); + addAnnotation + (modelsTypeEClass, + source, + new String[] + { + "name", "ModelsType", + "kind", "elementOnly" + }); + addAnnotation + (getModelsType_Any(), + source, + new String[] + { + "kind", "elementWildcard", + "wildcards", "##other", + "name", ":0", + "processing", "lax" + }); + addAnnotation + (monthEDataType, + source, + new String[] + { + "name", "Month" + }); + addAnnotation + (monthDayEDataType, + source, + new String[] + { + "name", "MonthDay" + }); + addAnnotation + (objectEDataType, + source, + new String[] + { + "name", "Object" + }); + addAnnotation + (propertyEClass, + source, + new String[] + { + "name", "Property", + "kind", "elementOnly" + }); + addAnnotation + (getProperty_AliasName(), + source, + new String[] + { + "kind", "element", + "name", "aliasName", + "namespace", "##targetNamespace" + }); + addAnnotation + (getProperty_Any(), + source, + new String[] + { + "kind", "elementWildcard", + "wildcards", "##other", + "name", ":1", + "processing", "lax" + }); + addAnnotation + (getProperty_Containment(), + source, + new String[] + { + "kind", "attribute", + "name", "containment" + }); + addAnnotation + (getProperty_Default(), + source, + new String[] + { + "kind", "attribute", + "name", "default" + }); + addAnnotation + (getProperty_Many(), + source, + new String[] + { + "kind", "attribute", + "name", "many" + }); + addAnnotation + (getProperty_Name(), + source, + new String[] + { + "kind", "attribute", + "name", "name" + }); + addAnnotation + (getProperty_Opposite(), + source, + new String[] + { + "kind", "attribute", + "name", "opposite" + }); + addAnnotation + (getProperty_ReadOnly(), + source, + new String[] + { + "kind", "attribute", + "name", "readOnly" + }); + addAnnotation + (getProperty_Type(), + source, + new String[] + { + "kind", "attribute", + "name", "type" + }); + addAnnotation + (getProperty_AnyAttribute(), + source, + new String[] + { + "kind", "attributeWildcard", + "wildcards", "##any", + "name", ":9", + "processing", "lax" + }); + addAnnotation + (shortEDataType, + source, + new String[] + { + "name", "Short" + }); + addAnnotation + (shortObjectEDataType, + source, + new String[] + { + "name", "Short:Object", + "baseType", "Short" + }); + addAnnotation + (stringEDataType, + source, + new String[] + { + "name", "String" + }); + addAnnotation + (stringsEDataType, + source, + new String[] + { + "name", "Strings" + }); + addAnnotation + (textTypeEClass, + source, + new String[] + { + "name", "TextType", + "kind", "elementOnly" + }); + addAnnotation + (getTextType_Text(), + source, + new String[] + { + "kind", "element", + "name", "text", + "namespace", "##targetNamespace" + }); + addAnnotation + (timeEDataType, + source, + new String[] + { + "name", "Time" + }); + addAnnotation + (typeEClass, + source, + new String[] + { + "name", "Type", + "kind", "elementOnly" + }); + addAnnotation + (getType_BaseType(), + source, + new String[] + { + "kind", "element", + "name", "baseType", + "namespace", "##targetNamespace" + }); + addAnnotation + (getType_Property(), + source, + new String[] + { + "kind", "element", + "name", "property", + "namespace", "##targetNamespace" + }); + addAnnotation + (getType_AliasName(), + source, + new String[] + { + "kind", "element", + "name", "aliasName", + "namespace", "##targetNamespace" + }); + addAnnotation + (getType_Any(), + source, + new String[] + { + "kind", "elementWildcard", + "wildcards", "##other", + "name", ":3", + "processing", "lax" + }); + addAnnotation + (getType_Abstract(), + source, + new String[] + { + "kind", "attribute", + "name", "abstract" + }); + addAnnotation + (getType_DataType(), + source, + new String[] + { + "kind", "attribute", + "name", "dataType" + }); + addAnnotation + (getType_Name(), + source, + new String[] + { + "kind", "attribute", + "name", "name" + }); + addAnnotation + (getType_Open(), + source, + new String[] + { + "kind", "attribute", + "name", "open" + }); + addAnnotation + (getType_Sequenced(), + source, + new String[] + { + "kind", "attribute", + "name", "sequenced" + }); + addAnnotation + (getType_Uri(), + source, + new String[] + { + "kind", "attribute", + "name", "uri" + }); + addAnnotation + (getType_AnyAttribute(), + source, + new String[] + { + "kind", "attributeWildcard", + "wildcards", "##any", + "name", ":10", + "processing", "lax" + }); + addAnnotation + (typesEClass, + source, + new String[] + { + "name", "Types", + "kind", "elementOnly" + }); + addAnnotation + (getTypes_Type(), + source, + new String[] + { + "kind", "element", + "name", "type", + "namespace", "##targetNamespace" + }); + addAnnotation + (uriEDataType, + source, + new String[] + { + "name", "URI" + }); + addAnnotation + (xsdTypeEClass, + source, + new String[] + { + "name", "XSDType", + "kind", "elementOnly" + }); + addAnnotation + (getXSDType_Any(), + source, + new String[] + { + "kind", "elementWildcard", + "wildcards", "http://www.w3.org/2001/XMLSchema", + "name", ":0", + "processing", "lax" + }); + addAnnotation + (yearEDataType, + source, + new String[] + { + "name", "Year" + }); + addAnnotation + (yearMonthEDataType, + source, + new String[] + { + "name", "YearMonth" + }); + addAnnotation + (yearMonthDayEDataType, + source, + new String[] + { + "name", "YearMonthDay" + }); + } + + /** + * + * Defines literals for the meta objects that represent + *

    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + public interface Literals + { + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl Base Data Graph Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.BaseDataGraphTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getBaseDataGraphType() + * @generated + */ + public static final EClass BASE_DATA_GRAPH_TYPE = eINSTANCE.getBaseDataGraphType(); + + /** + * The meta object literal for the 'Models' containment reference feature. + * + * + * @generated + */ + public static final EReference BASE_DATA_GRAPH_TYPE__MODELS = eINSTANCE.getBaseDataGraphType_Models(); + + /** + * The meta object literal for the 'Xsd' containment reference feature. + * + * + * @generated + */ + public static final EReference BASE_DATA_GRAPH_TYPE__XSD = eINSTANCE.getBaseDataGraphType_Xsd(); + + /** + * The meta object literal for the 'Change Summary' containment reference feature. + * + * + * @generated + */ + public static final EReference BASE_DATA_GRAPH_TYPE__CHANGE_SUMMARY = eINSTANCE.getBaseDataGraphType_ChangeSummary(); + + /** + * The meta object literal for the 'Any Attribute' attribute list feature. + * + * + * @generated + */ + public static final EAttribute BASE_DATA_GRAPH_TYPE__ANY_ATTRIBUTE = eINSTANCE.getBaseDataGraphType_AnyAttribute(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.ChangeSummaryTypeImpl Change Summary Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.ChangeSummaryTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getChangeSummaryType() + * @generated + */ + public static final EClass CHANGE_SUMMARY_TYPE = eINSTANCE.getChangeSummaryType(); + + /** + * The meta object literal for the 'Any' attribute list feature. + * + * + * @generated + */ + public static final EAttribute CHANGE_SUMMARY_TYPE__ANY = eINSTANCE.getChangeSummaryType_Any(); + + /** + * The meta object literal for the 'Create' attribute feature. + * + * + * @generated + */ + public static final EAttribute CHANGE_SUMMARY_TYPE__CREATE = eINSTANCE.getChangeSummaryType_Create(); + + /** + * The meta object literal for the 'Delete' attribute feature. + * + * + * @generated + */ + public static final EAttribute CHANGE_SUMMARY_TYPE__DELETE = eINSTANCE.getChangeSummaryType_Delete(); + + /** + * The meta object literal for the 'Logging' attribute feature. + * + * + * @generated + */ + public static final EAttribute CHANGE_SUMMARY_TYPE__LOGGING = eINSTANCE.getChangeSummaryType_Logging(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.DataGraphTypeImpl Data Graph Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.DataGraphTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDataGraphType() + * @generated + */ + public static final EClass DATA_GRAPH_TYPE = eINSTANCE.getDataGraphType(); + + /** + * The meta object literal for the 'Any' attribute list feature. + * + * + * @generated + */ + public static final EAttribute DATA_GRAPH_TYPE__ANY = eINSTANCE.getDataGraphType_Any(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.DataObjectImpl Data Object}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.DataObjectImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDataObject() + * @generated + */ + public static final EClass DATA_OBJECT = eINSTANCE.getDataObject(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.DocumentRootImpl Document Root}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.DocumentRootImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDocumentRoot() + * @generated + */ + public static final EClass DOCUMENT_ROOT = eINSTANCE.getDocumentRoot(); + + /** + * The meta object literal for the 'Mixed' attribute list feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__MIXED = eINSTANCE.getDocumentRoot_Mixed(); + + /** + * The meta object literal for the 'XMLNS Prefix Map' map feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__XMLNS_PREFIX_MAP = eINSTANCE.getDocumentRoot_XMLNSPrefixMap(); + + /** + * The meta object literal for the 'XSI Schema Location' map feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = eINSTANCE.getDocumentRoot_XSISchemaLocation(); + + /** + * The meta object literal for the 'Datagraph' containment reference feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__DATAGRAPH = eINSTANCE.getDocumentRoot_Datagraph(); + + /** + * The meta object literal for the 'Data Object' containment reference feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__DATA_OBJECT = eINSTANCE.getDocumentRoot_DataObject(); + + /** + * The meta object literal for the 'Type' containment reference feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__TYPE = eINSTANCE.getDocumentRoot_Type(); + + /** + * The meta object literal for the 'Types' containment reference feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__TYPES = eINSTANCE.getDocumentRoot_Types(); + + /** + * The meta object literal for the 'Ref' attribute feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__REF = eINSTANCE.getDocumentRoot_Ref(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.ModelsTypeImpl Models Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelsTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getModelsType() + * @generated + */ + public static final EClass MODELS_TYPE = eINSTANCE.getModelsType(); + + /** + * The meta object literal for the 'Any' attribute list feature. + * + * + * @generated + */ + public static final EAttribute MODELS_TYPE__ANY = eINSTANCE.getModelsType_Any(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.PropertyImpl Property}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.PropertyImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getProperty() + * @generated + */ + public static final EClass PROPERTY = eINSTANCE.getProperty(); + + /** + * The meta object literal for the 'Alias Name' attribute list feature. + * + * + * @generated + */ + public static final EAttribute PROPERTY__ALIAS_NAME = eINSTANCE.getProperty_AliasName(); + + /** + * The meta object literal for the 'Any' attribute list feature. + * + * + * @generated + */ + public static final EAttribute PROPERTY__ANY = eINSTANCE.getProperty_Any(); + + /** + * The meta object literal for the 'Containment' attribute feature. + * + * + * @generated + */ + public static final EAttribute PROPERTY__CONTAINMENT = eINSTANCE.getProperty_Containment(); + + /** + * The meta object literal for the 'Default' attribute feature. + * + * + * @generated + */ + public static final EAttribute PROPERTY__DEFAULT = eINSTANCE.getProperty_Default(); + + /** + * The meta object literal for the 'Many' attribute feature. + * + * + * @generated + */ + public static final EAttribute PROPERTY__MANY = eINSTANCE.getProperty_Many(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + public static final EAttribute PROPERTY__NAME = eINSTANCE.getProperty_Name(); + + /** + * The meta object literal for the 'Opposite' reference feature. + * + * + * @generated + */ + public static final EReference PROPERTY__OPPOSITE = eINSTANCE.getProperty_Opposite(); + + /** + * The meta object literal for the 'Read Only' attribute feature. + * + * + * @generated + */ + public static final EAttribute PROPERTY__READ_ONLY = eINSTANCE.getProperty_ReadOnly(); + + /** + * The meta object literal for the 'Type' reference feature. + * + * + * @generated + */ + public static final EReference PROPERTY__TYPE = eINSTANCE.getProperty_Type(); + + /** + * The meta object literal for the 'Any Attribute' attribute list feature. + * + * + * @generated + */ + public static final EAttribute PROPERTY__ANY_ATTRIBUTE = eINSTANCE.getProperty_AnyAttribute(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.TextTypeImpl Text Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.TextTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getTextType() + * @generated + */ + public static final EClass TEXT_TYPE = eINSTANCE.getTextType(); + + /** + * The meta object literal for the 'Text' attribute list feature. + * + * + * @generated + */ + public static final EAttribute TEXT_TYPE__TEXT = eINSTANCE.getTextType_Text(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.TypeImpl Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.TypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getType() + * @generated + */ + public static final EClass TYPE = eINSTANCE.getType(); + + /** + * The meta object literal for the 'Base Type' reference list feature. + * + * + * @generated + */ + public static final EReference TYPE__BASE_TYPE = eINSTANCE.getType_BaseType(); + + /** + * The meta object literal for the 'Property' containment reference list feature. + * + * + * @generated + */ + public static final EReference TYPE__PROPERTY = eINSTANCE.getType_Property(); + + /** + * The meta object literal for the 'Alias Name' attribute list feature. + * + * + * @generated + */ + public static final EAttribute TYPE__ALIAS_NAME = eINSTANCE.getType_AliasName(); + + /** + * The meta object literal for the 'Any' attribute list feature. + * + * + * @generated + */ + public static final EAttribute TYPE__ANY = eINSTANCE.getType_Any(); + + /** + * The meta object literal for the 'Abstract' attribute feature. + * + * + * @generated + */ + public static final EAttribute TYPE__ABSTRACT = eINSTANCE.getType_Abstract(); + + /** + * The meta object literal for the 'Data Type' attribute feature. + * + * + * @generated + */ + public static final EAttribute TYPE__DATA_TYPE = eINSTANCE.getType_DataType(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + public static final EAttribute TYPE__NAME = eINSTANCE.getType_Name(); + + /** + * The meta object literal for the 'Open' attribute feature. + * + * + * @generated + */ + public static final EAttribute TYPE__OPEN = eINSTANCE.getType_Open(); + + /** + * The meta object literal for the 'Sequenced' attribute feature. + * + * + * @generated + */ + public static final EAttribute TYPE__SEQUENCED = eINSTANCE.getType_Sequenced(); + + /** + * The meta object literal for the 'Uri' attribute feature. + * + * + * @generated + */ + public static final EAttribute TYPE__URI = eINSTANCE.getType_Uri(); + + /** + * The meta object literal for the 'Any Attribute' attribute list feature. + * + * + * @generated + */ + public static final EAttribute TYPE__ANY_ATTRIBUTE = eINSTANCE.getType_AnyAttribute(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.TypesImpl Types}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.TypesImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getTypes() + * @generated + */ + public static final EClass TYPES = eINSTANCE.getTypes(); + + /** + * The meta object literal for the 'Type' containment reference list feature. + * + * + * @generated + */ + public static final EReference TYPES__TYPE = eINSTANCE.getTypes_Type(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.impl.XSDTypeImpl XSD Type}' class. + * + * + * @see org.apache.tuscany.sdo.model.impl.XSDTypeImpl + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getXSDType() + * @generated + */ + public static final EClass XSD_TYPE = eINSTANCE.getXSDType(); + + /** + * The meta object literal for the 'Any' attribute list feature. + * + * + * @generated + */ + public static final EAttribute XSD_TYPE__ANY = eINSTANCE.getXSDType_Any(); + + /** + * The meta object literal for the 'Boolean' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getBoolean() + * @generated + */ + public static final EDataType BOOLEAN = eINSTANCE.getBoolean(); + + /** + * The meta object literal for the 'Boolean Object' data type. + * + * + * @see java.lang.Boolean + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getBooleanObject() + * @generated + */ + public static final EDataType BOOLEAN_OBJECT = eINSTANCE.getBooleanObject(); + + /** + * The meta object literal for the 'Byte' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getByte() + * @generated + */ + public static final EDataType BYTE = eINSTANCE.getByte(); + + /** + * The meta object literal for the 'Byte Object' data type. + * + * + * @see java.lang.Byte + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getByteObject() + * @generated + */ + public static final EDataType BYTE_OBJECT = eINSTANCE.getByteObject(); + + /** + * The meta object literal for the 'Bytes' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getBytes() + * @generated + */ + public static final EDataType BYTES = eINSTANCE.getBytes(); + + /** + * The meta object literal for the 'Character' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getCharacter() + * @generated + */ + public static final EDataType CHARACTER = eINSTANCE.getCharacter(); + + /** + * The meta object literal for the 'Character Object' data type. + * + * + * @see java.lang.Character + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getCharacterObject() + * @generated + */ + public static final EDataType CHARACTER_OBJECT = eINSTANCE.getCharacterObject(); + + /** + * The meta object literal for the 'Date' data type. + * + * + * @see java.util.Date + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDate() + * @generated + */ + public static final EDataType DATE = eINSTANCE.getDate(); + + /** + * The meta object literal for the 'Date Time' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDateTime() + * @generated + */ + public static final EDataType DATE_TIME = eINSTANCE.getDateTime(); + + /** + * The meta object literal for the 'Day' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDay() + * @generated + */ + public static final EDataType DAY = eINSTANCE.getDay(); + + /** + * The meta object literal for the 'Decimal' data type. + * + * + * @see java.math.BigDecimal + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDecimal() + * @generated + */ + public static final EDataType DECIMAL = eINSTANCE.getDecimal(); + + /** + * The meta object literal for the 'Double' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDouble() + * @generated + */ + public static final EDataType DOUBLE = eINSTANCE.getDouble(); + + /** + * The meta object literal for the 'Double Object' data type. + * + * + * @see java.lang.Double + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDoubleObject() + * @generated + */ + public static final EDataType DOUBLE_OBJECT = eINSTANCE.getDoubleObject(); + + /** + * The meta object literal for the 'Duration' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getDuration() + * @generated + */ + public static final EDataType DURATION = eINSTANCE.getDuration(); + + /** + * The meta object literal for the 'Float' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getFloat() + * @generated + */ + public static final EDataType FLOAT = eINSTANCE.getFloat(); + + /** + * The meta object literal for the 'Float Object' data type. + * + * + * @see java.lang.Float + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getFloatObject() + * @generated + */ + public static final EDataType FLOAT_OBJECT = eINSTANCE.getFloatObject(); + + /** + * The meta object literal for the 'Int' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getInt() + * @generated + */ + public static final EDataType INT = eINSTANCE.getInt(); + + /** + * The meta object literal for the 'Integer' data type. + * + * + * @see java.math.BigInteger + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getInteger() + * @generated + */ + public static final EDataType INTEGER = eINSTANCE.getInteger(); + + /** + * The meta object literal for the 'Int Object' data type. + * + * + * @see java.lang.Integer + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getIntObject() + * @generated + */ + public static final EDataType INT_OBJECT = eINSTANCE.getIntObject(); + + /** + * The meta object literal for the 'Long' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getLong() + * @generated + */ + public static final EDataType LONG = eINSTANCE.getLong(); + + /** + * The meta object literal for the 'Long Object' data type. + * + * + * @see java.lang.Long + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getLongObject() + * @generated + */ + public static final EDataType LONG_OBJECT = eINSTANCE.getLongObject(); + + /** + * The meta object literal for the 'Month' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getMonth() + * @generated + */ + public static final EDataType MONTH = eINSTANCE.getMonth(); + + /** + * The meta object literal for the 'Month Day' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getMonthDay() + * @generated + */ + public static final EDataType MONTH_DAY = eINSTANCE.getMonthDay(); + + /** + * The meta object literal for the 'Object' data type. + * + * + * @see java.lang.Object + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getObject() + * @generated + */ + public static final EDataType OBJECT = eINSTANCE.getObject(); + + /** + * The meta object literal for the 'Short' data type. + * + * + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getShort() + * @generated + */ + public static final EDataType SHORT = eINSTANCE.getShort(); + + /** + * The meta object literal for the 'Short Object' data type. + * + * + * @see java.lang.Short + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getShortObject() + * @generated + */ + public static final EDataType SHORT_OBJECT = eINSTANCE.getShortObject(); + + /** + * The meta object literal for the 'String' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getString() + * @generated + */ + public static final EDataType STRING = eINSTANCE.getString(); + + /** + * The meta object literal for the 'Strings' data type. + * + * + * @see java.util.List + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getStrings() + * @generated + */ + public static final EDataType STRINGS = eINSTANCE.getStrings(); + + /** + * The meta object literal for the 'Time' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getTime() + * @generated + */ + public static final EDataType TIME = eINSTANCE.getTime(); + + /** + * The meta object literal for the 'URI' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getURI() + * @generated + */ + public static final EDataType URI = eINSTANCE.getURI(); + + /** + * The meta object literal for the 'Year' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getYear() + * @generated + */ + public static final EDataType YEAR = eINSTANCE.getYear(); + + /** + * The meta object literal for the 'Year Month' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getYearMonth() + * @generated + */ + public static final EDataType YEAR_MONTH = eINSTANCE.getYearMonth(); + + /** + * The meta object literal for the 'Year Month Day' data type. + * + * + * @see java.lang.String + * @see org.apache.tuscany.sdo.model.impl.ModelPackageImpl#getYearMonthDay() + * @generated + */ + public static final EDataType YEAR_MONTH_DAY = eINSTANCE.getYearMonthDay(); + + } + +} //ModelPackageImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelsTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelsTypeImpl.java new file mode 100644 index 0000000000..f2873031ee --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/ModelsTypeImpl.java @@ -0,0 +1,189 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import commonj.sdo.Sequence; + + +import org.apache.tuscany.sdo.impl.DataObjectImpl; +import org.apache.tuscany.sdo.model.ModelsType; + +import org.apache.tuscany.sdo.util.BasicSequence; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.util.BasicFeatureMap; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Models Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.model.impl.ModelsTypeImpl#getAny Any}
  • + *
+ *

+ * + * @generated + */ +public class ModelsTypeImpl extends DataObjectImpl implements ModelsType +{ + /** + * The cached value of the '{@link #getAny() Any}' attribute list. + * + * + * @see #getAny() + * @generated + * @ordered + */ + protected BasicSequence any = null; + + /** + * + * + * @generated + */ + protected ModelsTypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return ModelPackageImpl.Literals.MODELS_TYPE; + } + + /** + * + * + * @generated + */ + public Sequence getAny() + { + if (any == null) + { + any = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.MODELS_TYPE__ANY)); + } + return any; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case ModelPackageImpl.MODELS_TYPE__ANY: + return ((InternalEList)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case ModelPackageImpl.MODELS_TYPE__ANY: + if (coreType) return ((FeatureMap.Internal.Wrapper)getAny()).featureMap(); + return getAny(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case ModelPackageImpl.MODELS_TYPE__ANY: + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).set(newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.MODELS_TYPE__ANY: + ((FeatureMap.Internal.Wrapper)getAny()).featureMap().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.MODELS_TYPE__ANY: + return any != null && !any.featureMap().isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (any: "); + result.append(any); + result.append(')'); + return result.toString(); + } + +} //ModelsTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/PropertyImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/PropertyImpl.java new file mode 100644 index 0000000000..6a4e346bb1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/PropertyImpl.java @@ -0,0 +1,801 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import commonj.sdo.Sequence; + +import java.util.Collection; +import java.util.List; + + +import org.apache.tuscany.sdo.impl.DataObjectImpl; +import org.apache.tuscany.sdo.model.Property; +import org.apache.tuscany.sdo.model.Type; + +import org.apache.tuscany.sdo.util.BasicSequence; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.BasicFeatureMap; +import org.eclipse.emf.ecore.util.EDataTypeEList; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Property'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getAliasName Alias Name}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getAny Any}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#isContainment Containment}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getDefault Default}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#isMany Many}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getName Name}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getOpposite Opposite}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#isReadOnly Read Only}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getType Type}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.PropertyImpl#getAnyAttribute Any Attribute}
  • + *
+ *

+ * + * Note: The getDefault and getOpposite methods had to be renamed to avoid + * conflict with the commonj.sdo.Property getDefault and getOpposite + * methods in classes that implement both. Eventually, the two interfaces + * should be brought in-line with one another -- James Snell + * + * @generated + */ +public class PropertyImpl extends DataObjectImpl implements Property +{ + /** + * The cached value of the '{@link #getAliasName() Alias Name}' attribute list. + * + * + * @see #getAliasName() + * @generated + * @ordered + */ + protected EList aliasName = null; + + /** + * The cached value of the '{@link #getAny() Any}' attribute list. + * + * + * @see #getAny() + * @generated + * @ordered + */ + protected BasicSequence any = null; + + /** + * The default value of the '{@link #isContainment() Containment}' attribute. + * + * + * @see #isContainment() + * @generated + * @ordered + */ + protected static final boolean CONTAINMENT_EDEFAULT = false; + + /** + * The cached value of the '{@link #isContainment() Containment}' attribute. + * + * + * @see #isContainment() + * @generated + * @ordered + */ + protected boolean containment = CONTAINMENT_EDEFAULT; + + /** + * This is true if the Containment attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean containmentESet = false; + + /** + * The default value of the '{@link #getDefault() Default}' attribute. + * + * + * @see #getDefault() + * @generated + * @ordered + */ + protected static final String DEFAULT_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDefault() Default}' attribute. + * + * + * @see #getDefault() + * @generated + * @ordered + */ + protected String default_ = DEFAULT_EDEFAULT; + + /** + * The default value of the '{@link #isMany() Many}' attribute. + * + * + * @see #isMany() + * @generated + * @ordered + */ + protected static final boolean MANY_EDEFAULT = false; + + /** + * The cached value of the '{@link #isMany() Many}' attribute. + * + * + * @see #isMany() + * @generated + * @ordered + */ + protected boolean many = MANY_EDEFAULT; + + /** + * This is true if the Many attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean manyESet = false; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The cached value of the '{@link #getOpposite() Opposite}' reference. + * + * + * @see #getOpposite() + * @generated + * @ordered + */ + protected Property opposite = null; + + /** + * The default value of the '{@link #isReadOnly() Read Only}' attribute. + * + * + * @see #isReadOnly() + * @generated + * @ordered + */ + protected static final boolean READ_ONLY_EDEFAULT = false; + + /** + * The cached value of the '{@link #isReadOnly() Read Only}' attribute. + * + * + * @see #isReadOnly() + * @generated + * @ordered + */ + protected boolean readOnly = READ_ONLY_EDEFAULT; + + /** + * This is true if the Read Only attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean readOnlyESet = false; + + /** + * The cached value of the '{@link #getType() Type}' reference. + * + * + * @see #getType() + * @generated + * @ordered + */ + protected Type type = null; + + /** + * The cached value of the '{@link #getAnyAttribute() Any Attribute}' attribute list. + * + * + * @see #getAnyAttribute() + * @generated + * @ordered + */ + protected BasicSequence anyAttribute = null; + + /** + * + * + * @generated + */ + protected PropertyImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return ModelPackageImpl.Literals.PROPERTY; + } + + /** + * + * + * @generated + */ + public List getAliasName() + { + if (aliasName == null) + { + aliasName = new EDataTypeEList(String.class, this, ModelPackageImpl.PROPERTY__ALIAS_NAME); + } + return aliasName; + } + + /** + * + * + * @generated + */ + public Sequence getAny() + { + if (any == null) + { + any = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.PROPERTY__ANY)); + } + return any; + } + + /** + * + * + * @generated + */ + public boolean isContainment() + { + return containment; + } + + /** + * + * + * @generated + */ + public void setContainment(boolean newContainment) + { + boolean oldContainment = containment; + containment = newContainment; + boolean oldContainmentESet = containmentESet; + containmentESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__CONTAINMENT, oldContainment, containment, !oldContainmentESet)); + } + + /** + * + * + * @generated + */ + public void unsetContainment() + { + boolean oldContainment = containment; + boolean oldContainmentESet = containmentESet; + containment = CONTAINMENT_EDEFAULT; + containmentESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.PROPERTY__CONTAINMENT, oldContainment, CONTAINMENT_EDEFAULT, oldContainmentESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetContainment() + { + return containmentESet; + } + + /** + * + * + * @generated NOT + */ + public String getDefault_() + { + return default_; + } + + /** + * + * + * @generated + */ + public void setDefault_(String newDefault) + { + String oldDefault = default_; + default_ = newDefault; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__DEFAULT, oldDefault, default_)); + } + + /** + * + * + * @generated + */ + public boolean isMany() + { + return many; + } + + /** + * + * + * @generated + */ + public void setMany(boolean newMany) + { + boolean oldMany = many; + many = newMany; + boolean oldManyESet = manyESet; + manyESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__MANY, oldMany, many, !oldManyESet)); + } + + /** + * + * + * @generated + */ + public void unsetMany() + { + boolean oldMany = many; + boolean oldManyESet = manyESet; + many = MANY_EDEFAULT; + manyESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.PROPERTY__MANY, oldMany, MANY_EDEFAULT, oldManyESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetMany() + { + return manyESet; + } + + /** + * + * + * @generated + */ + public String getName() + { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) + { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__NAME, oldName, name)); + } + + /** + * + * + * @generated NOT + */ + public Property getOpposite_() + { + if (opposite != null && ((EObject)opposite).eIsProxy()) + { + InternalEObject oldOpposite = (InternalEObject)opposite; + opposite = (Property)eResolveProxy(oldOpposite); + if (opposite != oldOpposite) + { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackageImpl.PROPERTY__OPPOSITE, oldOpposite, opposite)); + } + } + return opposite; + } + + /** + * + * + * @generated + */ + public Property basicGetOpposite() + { + return opposite; + } + + /** + * + * + * @generated NOT + */ + public void setOpposite_(Property newOpposite) + { + Property oldOpposite = opposite; + opposite = newOpposite; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__OPPOSITE, oldOpposite, opposite)); + } + + /** + * + * + * @generated + */ + public boolean isReadOnly() + { + return readOnly; + } + + /** + * + * + * @generated + */ + public void setReadOnly(boolean newReadOnly) + { + boolean oldReadOnly = readOnly; + readOnly = newReadOnly; + boolean oldReadOnlyESet = readOnlyESet; + readOnlyESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__READ_ONLY, oldReadOnly, readOnly, !oldReadOnlyESet)); + } + + /** + * + * + * @generated + */ + public void unsetReadOnly() + { + boolean oldReadOnly = readOnly; + boolean oldReadOnlyESet = readOnlyESet; + readOnly = READ_ONLY_EDEFAULT; + readOnlyESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.PROPERTY__READ_ONLY, oldReadOnly, READ_ONLY_EDEFAULT, oldReadOnlyESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetReadOnly() + { + return readOnlyESet; + } + + /** + * + * + * @generated + */ + public Type getType_() + { + if (type != null && ((EObject)type).eIsProxy()) + { + InternalEObject oldType = (InternalEObject)type; + type = (Type)eResolveProxy(oldType); + if (type != oldType) + { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackageImpl.PROPERTY__TYPE, oldType, type)); + } + } + return type; + } + + /** + * + * + * @generated + */ + public Type basicGetType() + { + return type; + } + + /** + * + * + * @generated + */ + public void setType(Type newType) + { + Type oldType = type; + type = newType; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.PROPERTY__TYPE, oldType, type)); + } + + /** + * + * + * @generated + */ + public Sequence getAnyAttribute() + { + if (anyAttribute == null) + { + anyAttribute = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE)); + } + return anyAttribute; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case ModelPackageImpl.PROPERTY__ANY: + return ((InternalEList)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).basicRemove(otherEnd, msgs); + case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE: + return ((InternalEList)((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case ModelPackageImpl.PROPERTY__ALIAS_NAME: + return getAliasName(); + case ModelPackageImpl.PROPERTY__ANY: + if (coreType) return ((FeatureMap.Internal.Wrapper)getAny()).featureMap(); + return getAny(); + case ModelPackageImpl.PROPERTY__CONTAINMENT: + return isContainment() ? Boolean.TRUE : Boolean.FALSE; + case ModelPackageImpl.PROPERTY__DEFAULT: + return getDefault_(); + case ModelPackageImpl.PROPERTY__MANY: + return isMany() ? Boolean.TRUE : Boolean.FALSE; + case ModelPackageImpl.PROPERTY__NAME: + return getName(); + case ModelPackageImpl.PROPERTY__OPPOSITE: + if (resolve) return getOpposite_(); + return basicGetOpposite(); + case ModelPackageImpl.PROPERTY__READ_ONLY: + return isReadOnly() ? Boolean.TRUE : Boolean.FALSE; + case ModelPackageImpl.PROPERTY__TYPE: + if (resolve) return getType(); + return basicGetType(); + case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE: + if (coreType) return ((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap(); + return getAnyAttribute(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case ModelPackageImpl.PROPERTY__ALIAS_NAME: + getAliasName().clear(); + getAliasName().addAll((Collection)newValue); + return; + case ModelPackageImpl.PROPERTY__ANY: + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).set(newValue); + return; + case ModelPackageImpl.PROPERTY__CONTAINMENT: + setContainment(((Boolean)newValue).booleanValue()); + return; + case ModelPackageImpl.PROPERTY__DEFAULT: + setDefault_((String)newValue); + return; + case ModelPackageImpl.PROPERTY__MANY: + setMany(((Boolean)newValue).booleanValue()); + return; + case ModelPackageImpl.PROPERTY__NAME: + setName((String)newValue); + return; + case ModelPackageImpl.PROPERTY__OPPOSITE: + setOpposite_((Property)newValue); + return; + case ModelPackageImpl.PROPERTY__READ_ONLY: + setReadOnly(((Boolean)newValue).booleanValue()); + return; + case ModelPackageImpl.PROPERTY__TYPE: + setType((Type)newValue); + return; + case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE: + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap()).set(newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.PROPERTY__ALIAS_NAME: + getAliasName().clear(); + return; + case ModelPackageImpl.PROPERTY__ANY: + ((FeatureMap.Internal.Wrapper)getAny()).featureMap().clear(); + return; + case ModelPackageImpl.PROPERTY__CONTAINMENT: + unsetContainment(); + return; + case ModelPackageImpl.PROPERTY__DEFAULT: + setDefault_(DEFAULT_EDEFAULT); + return; + case ModelPackageImpl.PROPERTY__MANY: + unsetMany(); + return; + case ModelPackageImpl.PROPERTY__NAME: + setName(NAME_EDEFAULT); + return; + case ModelPackageImpl.PROPERTY__OPPOSITE: + setOpposite_((Property)null); + return; + case ModelPackageImpl.PROPERTY__READ_ONLY: + unsetReadOnly(); + return; + case ModelPackageImpl.PROPERTY__TYPE: + setType((Type)null); + return; + case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE: + ((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.PROPERTY__ALIAS_NAME: + return aliasName != null && !aliasName.isEmpty(); + case ModelPackageImpl.PROPERTY__ANY: + return any != null && !any.featureMap().isEmpty(); + case ModelPackageImpl.PROPERTY__CONTAINMENT: + return isSetContainment(); + case ModelPackageImpl.PROPERTY__DEFAULT: + return DEFAULT_EDEFAULT == null ? default_ != null : !DEFAULT_EDEFAULT.equals(default_); + case ModelPackageImpl.PROPERTY__MANY: + return isSetMany(); + case ModelPackageImpl.PROPERTY__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case ModelPackageImpl.PROPERTY__OPPOSITE: + return opposite != null; + case ModelPackageImpl.PROPERTY__READ_ONLY: + return isSetReadOnly(); + case ModelPackageImpl.PROPERTY__TYPE: + return type != null; + case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE: + return anyAttribute != null && !anyAttribute.featureMap().isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (aliasName: "); + result.append(aliasName); + result.append(", any: "); + result.append(any); + result.append(", containment: "); + if (containmentESet) result.append(containment); else result.append(""); + result.append(", default: "); + result.append(default_); + result.append(", many: "); + if (manyESet) result.append(many); else result.append(""); + result.append(", name: "); + result.append(name); + result.append(", readOnly: "); + if (readOnlyESet) result.append(readOnly); else result.append(""); + result.append(", anyAttribute: "); + result.append(anyAttribute); + result.append(')'); + return result.toString(); + } + +} //PropertyImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TextTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TextTypeImpl.java new file mode 100644 index 0000000000..5d77ce2fae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TextTypeImpl.java @@ -0,0 +1,170 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import java.util.Collection; +import java.util.List; + + +import org.apache.tuscany.sdo.impl.DataObjectImpl; +import org.apache.tuscany.sdo.model.TextType; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.util.EDataTypeEList; + +/** + * + * An implementation of the model object 'Text Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.model.impl.TextTypeImpl#getText Text}
  • + *
+ *

+ * + * @generated + */ +public abstract class TextTypeImpl extends DataObjectImpl implements TextType +{ + /** + * The cached value of the '{@link #getText() Text}' attribute list. + * + * + * @see #getText() + * @generated + * @ordered + */ + protected EList text = null; + + /** + * + * + * @generated + */ + protected TextTypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return ModelPackageImpl.Literals.TEXT_TYPE; + } + + /** + * + * + * @generated + */ + public List getText() + { + if (text == null) + { + text = new EDataTypeEList(String.class, this, ModelPackageImpl.TEXT_TYPE__TEXT); + } + return text; + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case ModelPackageImpl.TEXT_TYPE__TEXT: + return getText(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case ModelPackageImpl.TEXT_TYPE__TEXT: + getText().clear(); + getText().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.TEXT_TYPE__TEXT: + getText().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.TEXT_TYPE__TEXT: + return text != null && !text.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (text: "); + result.append(text); + result.append(')'); + return result.toString(); + } + +} //TextTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TypeImpl.java new file mode 100644 index 0000000000..c51cd7948c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TypeImpl.java @@ -0,0 +1,851 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import commonj.sdo.Sequence; + +import java.util.Collection; +import java.util.List; + + +import org.apache.tuscany.sdo.impl.DataObjectImpl; +import org.apache.tuscany.sdo.model.Property; +import org.apache.tuscany.sdo.model.Type; +import org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl; + +import org.apache.tuscany.sdo.util.BasicSequence; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.BasicFeatureMap; +import org.eclipse.emf.ecore.util.EDataTypeEList; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#getBaseType Base Type}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#getProperty Property}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#getAliasName Alias Name}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#getAny Any}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#isAbstract Abstract}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#isDataType Data Type}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#getName Name}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#isOpen Open}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#isSequenced Sequenced}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#getUri Uri}
  • + *
  • {@link org.apache.tuscany.sdo.model.impl.TypeImpl#getAnyAttribute Any Attribute}
  • + *
+ *

+ * + * @generated + */ +public class TypeImpl extends DataObjectImpl implements Type +{ + /** + * The cached value of the '{@link #getBaseType() Base Type}' reference list. + * + * + * @see #getBaseType() + * @generated + * @ordered + */ + protected EList baseType = null; + + /** + * The cached value of the '{@link #getProperty() Property}' containment reference list. + * + * + * @see #getProperty() + * @generated + * @ordered + */ + protected EList property = null; + + /** + * The cached value of the '{@link #getAliasName() Alias Name}' attribute list. + * + * + * @see #getAliasName() + * @generated + * @ordered + */ + protected EList aliasName = null; + + /** + * The cached value of the '{@link #getAny() Any}' attribute list. + * + * + * @see #getAny() + * @generated + * @ordered + */ + protected BasicSequence any = null; + + /** + * The default value of the '{@link #isAbstract() Abstract}' attribute. + * + * + * @see #isAbstract() + * @generated + * @ordered + */ + protected static final boolean ABSTRACT_EDEFAULT = false; + + /** + * The cached value of the '{@link #isAbstract() Abstract}' attribute. + * + * + * @see #isAbstract() + * @generated + * @ordered + */ + protected boolean abstract_ = ABSTRACT_EDEFAULT; + + /** + * This is true if the Abstract attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean abstractESet = false; + + /** + * The default value of the '{@link #isDataType() Data Type}' attribute. + * + * + * @see #isDataType() + * @generated + * @ordered + */ + protected static final boolean DATA_TYPE_EDEFAULT = false; + + /** + * The cached value of the '{@link #isDataType() Data Type}' attribute. + * + * + * @see #isDataType() + * @generated + * @ordered + */ + protected boolean dataType = DATA_TYPE_EDEFAULT; + + /** + * This is true if the Data Type attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean dataTypeESet = false; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The default value of the '{@link #isOpen() Open}' attribute. + * + * + * @see #isOpen() + * @generated + * @ordered + */ + protected static final boolean OPEN_EDEFAULT = false; + + /** + * The cached value of the '{@link #isOpen() Open}' attribute. + * + * + * @see #isOpen() + * @generated + * @ordered + */ + protected boolean open = OPEN_EDEFAULT; + + /** + * This is true if the Open attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean openESet = false; + + /** + * The default value of the '{@link #isSequenced() Sequenced}' attribute. + * + * + * @see #isSequenced() + * @generated + * @ordered + */ + protected static final boolean SEQUENCED_EDEFAULT = false; + + /** + * The cached value of the '{@link #isSequenced() Sequenced}' attribute. + * + * + * @see #isSequenced() + * @generated + * @ordered + */ + protected boolean sequenced = SEQUENCED_EDEFAULT; + + /** + * This is true if the Sequenced attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean sequencedESet = false; + + /** + * The default value of the '{@link #getUri() Uri}' attribute. + * + * + * @see #getUri() + * @generated + * @ordered + */ + protected static final String URI_EDEFAULT = null; + + /** + * The cached value of the '{@link #getUri() Uri}' attribute. + * + * + * @see #getUri() + * @generated + * @ordered + */ + protected String uri = URI_EDEFAULT; + + /** + * The cached value of the '{@link #getAnyAttribute() Any Attribute}' attribute list. + * + * + * @see #getAnyAttribute() + * @generated + * @ordered + */ + protected BasicSequence anyAttribute = null; + + /** + * + * + * @generated + */ + protected TypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return ModelPackageImpl.Literals.TYPE; + } + + /** + * + * + * @generated + */ + public List getBaseType() + { + if (baseType == null) + { + baseType = new EObjectResolvingEList(Type.class, this, ModelPackageImpl.TYPE__BASE_TYPE); + } + return baseType; + } + + /** + * + * + * @generated + */ + public List getProperty() + { + if (property == null) + { + property = new EObjectContainmentEList(Property.class, this, ModelPackageImpl.TYPE__PROPERTY); + } + return property; + } + + /** + * + * + * @generated + */ + public List getAliasName() + { + if (aliasName == null) + { + aliasName = new EDataTypeEList(String.class, this, ModelPackageImpl.TYPE__ALIAS_NAME); + } + return aliasName; + } + + /** + * + * + * @generated + */ + public Sequence getAny() + { + if (any == null) + { + any = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.TYPE__ANY)); + } + return any; + } + + /** + * + * + * @generated + */ + public boolean isAbstract() + { + return abstract_; + } + + /** + * + * + * @generated + */ + public void setAbstract(boolean newAbstract) + { + boolean oldAbstract = abstract_; + abstract_ = newAbstract; + boolean oldAbstractESet = abstractESet; + abstractESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.TYPE__ABSTRACT, oldAbstract, abstract_, !oldAbstractESet)); + } + + /** + * + * + * @generated + */ + public void unsetAbstract() + { + boolean oldAbstract = abstract_; + boolean oldAbstractESet = abstractESet; + abstract_ = ABSTRACT_EDEFAULT; + abstractESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.TYPE__ABSTRACT, oldAbstract, ABSTRACT_EDEFAULT, oldAbstractESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetAbstract() + { + return abstractESet; + } + + /** + * + * + * @generated + */ + public boolean isDataType() + { + return dataType; + } + + /** + * + * + * @generated + */ + public void setDataType(boolean newDataType) + { + boolean oldDataType = dataType; + dataType = newDataType; + boolean oldDataTypeESet = dataTypeESet; + dataTypeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.TYPE__DATA_TYPE, oldDataType, dataType, !oldDataTypeESet)); + } + + /** + * + * + * @generated + */ + public void unsetDataType() + { + boolean oldDataType = dataType; + boolean oldDataTypeESet = dataTypeESet; + dataType = DATA_TYPE_EDEFAULT; + dataTypeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.TYPE__DATA_TYPE, oldDataType, DATA_TYPE_EDEFAULT, oldDataTypeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetDataType() + { + return dataTypeESet; + } + + /** + * + * + * @generated + */ + public String getName() + { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) + { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.TYPE__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public boolean isOpen() + { + return open; + } + + /** + * + * + * @generated + */ + public void setOpen(boolean newOpen) + { + boolean oldOpen = open; + open = newOpen; + boolean oldOpenESet = openESet; + openESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.TYPE__OPEN, oldOpen, open, !oldOpenESet)); + } + + /** + * + * + * @generated + */ + public void unsetOpen() + { + boolean oldOpen = open; + boolean oldOpenESet = openESet; + open = OPEN_EDEFAULT; + openESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.TYPE__OPEN, oldOpen, OPEN_EDEFAULT, oldOpenESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetOpen() + { + return openESet; + } + + /** + * + * + * @generated + */ + public boolean isSequenced() + { + return sequenced; + } + + /** + * + * + * @generated + */ + public void setSequenced(boolean newSequenced) + { + boolean oldSequenced = sequenced; + sequenced = newSequenced; + boolean oldSequencedESet = sequencedESet; + sequencedESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.TYPE__SEQUENCED, oldSequenced, sequenced, !oldSequencedESet)); + } + + /** + * + * + * @generated + */ + public void unsetSequenced() + { + boolean oldSequenced = sequenced; + boolean oldSequencedESet = sequencedESet; + sequenced = SEQUENCED_EDEFAULT; + sequencedESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, ModelPackageImpl.TYPE__SEQUENCED, oldSequenced, SEQUENCED_EDEFAULT, oldSequencedESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSequenced() + { + return sequencedESet; + } + + /** + * + * + * @generated + */ + public String getUri() + { + return uri; + } + + /** + * + * + * @generated + */ + public void setUri(String newUri) + { + String oldUri = uri; + uri = newUri; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ModelPackageImpl.TYPE__URI, oldUri, uri)); + } + + /** + * + * + * @generated + */ + public Sequence getAnyAttribute() + { + if (anyAttribute == null) + { + anyAttribute = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.TYPE__ANY_ATTRIBUTE)); + } + return anyAttribute; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case ModelPackageImpl.TYPE__PROPERTY: + return ((InternalEList)getProperty()).basicRemove(otherEnd, msgs); + case ModelPackageImpl.TYPE__ANY: + return ((InternalEList)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).basicRemove(otherEnd, msgs); + case ModelPackageImpl.TYPE__ANY_ATTRIBUTE: + return ((InternalEList)((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case ModelPackageImpl.TYPE__BASE_TYPE: + return getBaseType(); + case ModelPackageImpl.TYPE__PROPERTY: + return getProperty(); + case ModelPackageImpl.TYPE__ALIAS_NAME: + return getAliasName(); + case ModelPackageImpl.TYPE__ANY: + if (coreType) return ((FeatureMap.Internal.Wrapper)getAny()).featureMap(); + return getAny(); + case ModelPackageImpl.TYPE__ABSTRACT: + return isAbstract() ? Boolean.TRUE : Boolean.FALSE; + case ModelPackageImpl.TYPE__DATA_TYPE: + return isDataType() ? Boolean.TRUE : Boolean.FALSE; + case ModelPackageImpl.TYPE__NAME: + return getName(); + case ModelPackageImpl.TYPE__OPEN: + return isOpen() ? Boolean.TRUE : Boolean.FALSE; + case ModelPackageImpl.TYPE__SEQUENCED: + return isSequenced() ? Boolean.TRUE : Boolean.FALSE; + case ModelPackageImpl.TYPE__URI: + return getUri(); + case ModelPackageImpl.TYPE__ANY_ATTRIBUTE: + if (coreType) return ((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap(); + return getAnyAttribute(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case ModelPackageImpl.TYPE__BASE_TYPE: + getBaseType().clear(); + getBaseType().addAll((Collection)newValue); + return; + case ModelPackageImpl.TYPE__PROPERTY: + getProperty().clear(); + getProperty().addAll((Collection)newValue); + return; + case ModelPackageImpl.TYPE__ALIAS_NAME: + getAliasName().clear(); + getAliasName().addAll((Collection)newValue); + return; + case ModelPackageImpl.TYPE__ANY: + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).set(newValue); + return; + case ModelPackageImpl.TYPE__ABSTRACT: + setAbstract(((Boolean)newValue).booleanValue()); + return; + case ModelPackageImpl.TYPE__DATA_TYPE: + setDataType(((Boolean)newValue).booleanValue()); + return; + case ModelPackageImpl.TYPE__NAME: + setName((String)newValue); + return; + case ModelPackageImpl.TYPE__OPEN: + setOpen(((Boolean)newValue).booleanValue()); + return; + case ModelPackageImpl.TYPE__SEQUENCED: + setSequenced(((Boolean)newValue).booleanValue()); + return; + case ModelPackageImpl.TYPE__URI: + setUri((String)newValue); + return; + case ModelPackageImpl.TYPE__ANY_ATTRIBUTE: + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap()).set(newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.TYPE__BASE_TYPE: + getBaseType().clear(); + return; + case ModelPackageImpl.TYPE__PROPERTY: + getProperty().clear(); + return; + case ModelPackageImpl.TYPE__ALIAS_NAME: + getAliasName().clear(); + return; + case ModelPackageImpl.TYPE__ANY: + ((FeatureMap.Internal.Wrapper)getAny()).featureMap().clear(); + return; + case ModelPackageImpl.TYPE__ABSTRACT: + unsetAbstract(); + return; + case ModelPackageImpl.TYPE__DATA_TYPE: + unsetDataType(); + return; + case ModelPackageImpl.TYPE__NAME: + setName(NAME_EDEFAULT); + return; + case ModelPackageImpl.TYPE__OPEN: + unsetOpen(); + return; + case ModelPackageImpl.TYPE__SEQUENCED: + unsetSequenced(); + return; + case ModelPackageImpl.TYPE__URI: + setUri(URI_EDEFAULT); + return; + case ModelPackageImpl.TYPE__ANY_ATTRIBUTE: + ((FeatureMap.Internal.Wrapper)getAnyAttribute()).featureMap().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.TYPE__BASE_TYPE: + return baseType != null && !baseType.isEmpty(); + case ModelPackageImpl.TYPE__PROPERTY: + return property != null && !property.isEmpty(); + case ModelPackageImpl.TYPE__ALIAS_NAME: + return aliasName != null && !aliasName.isEmpty(); + case ModelPackageImpl.TYPE__ANY: + return any != null && !any.featureMap().isEmpty(); + case ModelPackageImpl.TYPE__ABSTRACT: + return isSetAbstract(); + case ModelPackageImpl.TYPE__DATA_TYPE: + return isSetDataType(); + case ModelPackageImpl.TYPE__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case ModelPackageImpl.TYPE__OPEN: + return isSetOpen(); + case ModelPackageImpl.TYPE__SEQUENCED: + return isSetSequenced(); + case ModelPackageImpl.TYPE__URI: + return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri); + case ModelPackageImpl.TYPE__ANY_ATTRIBUTE: + return anyAttribute != null && !anyAttribute.featureMap().isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (aliasName: "); + result.append(aliasName); + result.append(", any: "); + result.append(any); + result.append(", abstract: "); + if (abstractESet) result.append(abstract_); else result.append(""); + result.append(", dataType: "); + if (dataTypeESet) result.append(dataType); else result.append(""); + result.append(", name: "); + result.append(name); + result.append(", open: "); + if (openESet) result.append(open); else result.append(""); + result.append(", sequenced: "); + if (sequencedESet) result.append(sequenced); else result.append(""); + result.append(", uri: "); + result.append(uri); + result.append(", anyAttribute: "); + result.append(anyAttribute); + result.append(')'); + return result.toString(); + } + + public String getInstanceClassName() + { + EStructuralFeature javaClassFeature = JavaPackageImpl.eINSTANCE.getDocumentRoot_JavaClass(); + Sequence anyAttribute = getAnyAttribute(); + int count = anyAttribute.size(); + for (int i = 0; i < count; i++) + { + EStructuralFeature eFeature = (EStructuralFeature)anyAttribute.getProperty(i); + if (eFeature == javaClassFeature) + { + return (String)anyAttribute.getValue(i); + } + } + return null; + } + +} //TypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TypesImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TypesImpl.java new file mode 100644 index 0000000000..bfd673f0d2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/TypesImpl.java @@ -0,0 +1,179 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import java.util.Collection; +import java.util.List; + + +import org.apache.tuscany.sdo.impl.DataObjectImpl; +import org.apache.tuscany.sdo.model.Type; +import org.apache.tuscany.sdo.model.Types; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Types'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.model.impl.TypesImpl#getType Type}
  • + *
+ *

+ * + * @generated + */ +public class TypesImpl extends DataObjectImpl implements Types +{ + /** + * The cached value of the '{@link #getType() Type}' containment reference list. + * + * + * @see #getType() + * @generated + * @ordered + */ + protected EList type = null; + + /** + * + * + * @generated + */ + protected TypesImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return ModelPackageImpl.Literals.TYPES; + } + + /** + * + * + * @generated + */ + public List getType_() + { + if (type == null) + { + type = new EObjectContainmentEList(Type.class, this, ModelPackageImpl.TYPES__TYPE); + } + return type; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case ModelPackageImpl.TYPES__TYPE: + return ((InternalEList)getType()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case ModelPackageImpl.TYPES__TYPE: + return getType(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case ModelPackageImpl.TYPES__TYPE: + getType_().clear(); + getType_().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.TYPES__TYPE: + getType_().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.TYPES__TYPE: + return type != null && !type.isEmpty(); + } + return super.eIsSet(featureID); + } + + public List getTypeList() + { + return getType_(); + } + +} //TypesImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/XSDTypeImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/XSDTypeImpl.java new file mode 100644 index 0000000000..74b60af0ae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/impl/XSDTypeImpl.java @@ -0,0 +1,189 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.impl; + +import commonj.sdo.Sequence; + + +import org.apache.tuscany.sdo.impl.DataObjectImpl; +import org.apache.tuscany.sdo.model.XSDType; + +import org.apache.tuscany.sdo.util.BasicSequence; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.util.BasicFeatureMap; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'XSD Type'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.model.impl.XSDTypeImpl#getAny Any}
  • + *
+ *

+ * + * @generated + */ +public class XSDTypeImpl extends DataObjectImpl implements XSDType +{ + /** + * The cached value of the '{@link #getAny() Any}' attribute list. + * + * + * @see #getAny() + * @generated + * @ordered + */ + protected BasicSequence any = null; + + /** + * + * + * @generated + */ + protected XSDTypeImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return ModelPackageImpl.Literals.XSD_TYPE; + } + + /** + * + * + * @generated + */ + public Sequence getAny() + { + if (any == null) + { + any = new BasicSequence(new BasicFeatureMap(this, ModelPackageImpl.XSD_TYPE__ANY)); + } + return any; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case ModelPackageImpl.XSD_TYPE__ANY: + return ((InternalEList)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case ModelPackageImpl.XSD_TYPE__ANY: + if (coreType) return ((FeatureMap.Internal.Wrapper)getAny()).featureMap(); + return getAny(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case ModelPackageImpl.XSD_TYPE__ANY: + ((FeatureMap.Internal)((FeatureMap.Internal.Wrapper)getAny()).featureMap()).set(newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.XSD_TYPE__ANY: + ((FeatureMap.Internal.Wrapper)getAny()).featureMap().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case ModelPackageImpl.XSD_TYPE__ANY: + return any != null && !any.featureMap().isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (any: "); + result.append(any); + result.append(')'); + return result.toString(); + } + +} //XSDTypeImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/JavaFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/JavaFactory.java new file mode 100644 index 0000000000..7ca6ee818f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/JavaFactory.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.java; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface JavaFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + JavaFactory INSTANCE = org.apache.tuscany.sdo.model.java.impl.JavaFactoryImpl.eINSTANCE; + + /** + * Returns a new object of class 'Info'. + * + * + * @return a new object of class 'Info'. + * @generated + */ + JavaInfo createJavaInfo(); + +} //JavaFactory diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/JavaInfo.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/JavaInfo.java new file mode 100644 index 0000000000..555be8de4f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/JavaInfo.java @@ -0,0 +1,60 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.java; + + +/** + * + * A representation of the model object 'Info'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.apache.tuscany.sdo.model.java.JavaInfo#getJavaClass Java Class}
  • + *
+ *

+ * + * @generated + */ +public interface JavaInfo +{ + /** + * Returns the value of the 'Java Class' attribute. + * + *

+ * If the meaning of the 'Java Class' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Java Class' attribute. + * @see #setJavaClass(String) + * @generated + */ + String getJavaClass(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.model.java.JavaInfo#getJavaClass Java Class}' attribute. + * + * + * @param value the new value of the 'Java Class' attribute. + * @see #getJavaClass() + * @generated + */ + void setJavaClass(String value); + +} // JavaInfo diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaFactoryImpl.java new file mode 100644 index 0000000000..6e76337615 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaFactoryImpl.java @@ -0,0 +1,361 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.java.impl; + +import org.apache.tuscany.sdo.model.java.*; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.emf.ecore.xml.type.XMLTypeFactory; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class JavaFactoryImpl extends EFactoryImpl implements JavaFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + public static final JavaFactoryImpl eINSTANCE = init(); + + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static JavaFactoryImpl init() + { + try + { + JavaFactoryImpl theJavaFactory = (JavaFactoryImpl)EPackage.Registry.INSTANCE.getEFactory("commonj.sdo/java"); + if (theJavaFactory != null) + { + return theJavaFactory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new JavaFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public JavaFactoryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public EObject create(EClass eClass) + { + switch (eClass.getClassifierID()) + { + case JavaPackageImpl.DOCUMENT_ROOT: return (EObject)createDocumentRoot(); + case JavaPackageImpl.JAVA_INFO: return (EObject)createJavaInfo(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public Object createFromString(EDataType eDataType, String initialValue) + { + switch (eDataType.getClassifierID()) + { + case JavaPackageImpl.BOOLEAN_OBJECT: + return createBooleanObjectFromString(eDataType, initialValue); + case JavaPackageImpl.BYTE_OBJECT: + return createByteObjectFromString(eDataType, initialValue); + case JavaPackageImpl.CHARACTER_OBJECT: + return createCharacterObjectFromString(eDataType, initialValue); + case JavaPackageImpl.DOUBLE_OBJECT: + return createDoubleObjectFromString(eDataType, initialValue); + case JavaPackageImpl.FLOAT_OBJECT: + return createFloatObjectFromString(eDataType, initialValue); + case JavaPackageImpl.INT_OBJECT: + return createIntObjectFromString(eDataType, initialValue); + case JavaPackageImpl.LONG_OBJECT: + return createLongObjectFromString(eDataType, initialValue); + case JavaPackageImpl.SHORT_OBJECT: + return createShortObjectFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public String convertToString(EDataType eDataType, Object instanceValue) + { + switch (eDataType.getClassifierID()) + { + case JavaPackageImpl.BOOLEAN_OBJECT: + return convertBooleanObjectToString(eDataType, instanceValue); + case JavaPackageImpl.BYTE_OBJECT: + return convertByteObjectToString(eDataType, instanceValue); + case JavaPackageImpl.CHARACTER_OBJECT: + return convertCharacterObjectToString(eDataType, instanceValue); + case JavaPackageImpl.DOUBLE_OBJECT: + return convertDoubleObjectToString(eDataType, instanceValue); + case JavaPackageImpl.FLOAT_OBJECT: + return convertFloatObjectToString(eDataType, instanceValue); + case JavaPackageImpl.INT_OBJECT: + return convertIntObjectToString(eDataType, instanceValue); + case JavaPackageImpl.LONG_OBJECT: + return convertLongObjectToString(eDataType, instanceValue); + case JavaPackageImpl.SHORT_OBJECT: + return convertShortObjectToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public EObject createDocumentRoot() + { + EObject documentRoot = super.create(JavaPackageImpl.Literals.DOCUMENT_ROOT); + return documentRoot; + } + + /** + * + * + * @generated + */ + public JavaInfo createJavaInfo() + { + JavaInfoImpl javaInfo = new JavaInfoImpl(); + return javaInfo; + } + + /** + * + * + * @generated NOT + */ + public Boolean createBooleanObjectFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createBooleanObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertBooleanObjectToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertBooleanObject((Boolean)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Byte createByteObjectFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createByteObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertByteObjectToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertByteObject((Byte)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Character createCharacterObjectFromString(EDataType eDataType, String initialValue) + { + return (initialValue == null && initialValue.length() > 0) + ? null : (new Character(collapseWhiteSpace(initialValue).charAt(0))); + } + + /** + * + * + * @generated NOT + */ + public String convertCharacterObjectToString(EDataType eDataType, Object instanceValue) + { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated NOT + */ + public Double createDoubleObjectFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createDoubleObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertDoubleObjectToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertDoubleObject((Double)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Float createFloatObjectFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createFloatObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertFloatObjectToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertFloatObject((Float)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Integer createIntObjectFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createIntObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertIntObjectToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertIntObject((Integer)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Long createLongObjectFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createLongObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertLongObjectToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertLongObject((Long)instanceValue); + } + + /** + * + * + * @generated NOT + */ + public Short createShortObjectFromString(EDataType eDataType, String initialValue) + { + return XMLTypeFactory.eINSTANCE.createShortObject(initialValue); + } + + /** + * + * + * @generated NOT + */ + public String convertShortObjectToString(EDataType eDataType, Object instanceValue) + { + return XMLTypeFactory.eINSTANCE.convertShortObject((Short)instanceValue); + } + + /** + * + * + * @generated + */ + public JavaPackageImpl getJavaPackageImpl() + { + return (JavaPackageImpl)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + public static JavaPackageImpl getPackage() + { + return JavaPackageImpl.eINSTANCE; + } + +} //JavaFactoryImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaInfoImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaInfoImpl.java new file mode 100644 index 0000000000..db395f9632 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaInfoImpl.java @@ -0,0 +1,185 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.java.impl; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.apache.tuscany.sdo.model.java.JavaInfo; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +/** + * + * An implementation of the model object 'Info'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.apache.tuscany.sdo.model.java.impl.JavaInfoImpl#getJavaClass Java Class}
  • + *
+ *

+ * + * @generated + */ +public class JavaInfoImpl extends DataObjectImpl implements JavaInfo +{ + /** + * The default value of the '{@link #getJavaClass() Java Class}' attribute. + * + * + * @see #getJavaClass() + * @generated + * @ordered + */ + protected static final String JAVA_CLASS_EDEFAULT = null; + + /** + * The cached value of the '{@link #getJavaClass() Java Class}' attribute. + * + * + * @see #getJavaClass() + * @generated + * @ordered + */ + protected String javaClass = JAVA_CLASS_EDEFAULT; + + /** + * + * + * @generated + */ + protected JavaInfoImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return JavaPackageImpl.Literals.JAVA_INFO; + } + + /** + * + * + * @generated + */ + public String getJavaClass() + { + return javaClass; + } + + /** + * + * + * @generated + */ + public void setJavaClass(String newJavaClass) + { + String oldJavaClass = javaClass; + javaClass = newJavaClass; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, JavaPackageImpl.JAVA_INFO__JAVA_CLASS, oldJavaClass, javaClass)); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case JavaPackageImpl.JAVA_INFO__JAVA_CLASS: + return getJavaClass(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case JavaPackageImpl.JAVA_INFO__JAVA_CLASS: + setJavaClass((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case JavaPackageImpl.JAVA_INFO__JAVA_CLASS: + setJavaClass(JAVA_CLASS_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case JavaPackageImpl.JAVA_INFO__JAVA_CLASS: + return JAVA_CLASS_EDEFAULT == null ? javaClass != null : !JAVA_CLASS_EDEFAULT.equals(javaClass); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (javaClass: "); + result.append(javaClass); + result.append(')'); + return result.toString(); + } + +} //JavaInfoImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaPackageImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaPackageImpl.java new file mode 100644 index 0000000000..de32f55141 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/model/java/impl/JavaPackageImpl.java @@ -0,0 +1,1149 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.model.java.impl; + +import org.apache.tuscany.sdo.impl.SDOPackageImpl; + +import org.apache.tuscany.sdo.model.impl.ModelPackageImpl; + +import org.apache.tuscany.sdo.model.java.JavaFactory; +import org.apache.tuscany.sdo.model.java.JavaInfo; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.apache.tuscany.sdo.model.java.JavaFactory + * @generated + */ +public class JavaPackageImpl extends EPackageImpl +{ + /** + * The package name. + * + * + * @generated + */ + public static final String eNAME = "java"; + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String eNS_URI = "commonj.sdo/java"; + + /** + * The package namespace name. + * + * + * @generated + */ + public static final String eNS_PREFIX = "java"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + public static final JavaPackageImpl eINSTANCE = org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl.init(); + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.java.impl.DocumentRootImpl Document Root}' class. + * + * + * @see org.apache.tuscany.sdo.model.java.impl.DocumentRootImpl + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getDocumentRoot() + * @generated + */ + public static final int DOCUMENT_ROOT = 0; + + /** + * The feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__MIXED = 0; + + /** + * The feature id for the 'XMLNS Prefix Map' map. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__XMLNS_PREFIX_MAP = 1; + + /** + * The feature id for the 'XSI Schema Location' map. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = 2; + + /** + * The feature id for the 'Extended Instance Class' attribute. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__EXTENDED_INSTANCE_CLASS = 3; + + /** + * The feature id for the 'Instance Class' attribute. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__INSTANCE_CLASS = 4; + + /** + * The feature id for the 'Java Class' attribute. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__JAVA_CLASS = 5; + + /** + * The feature id for the 'Nested Interfaces' attribute. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__NESTED_INTERFACES = 6; + + /** + * The feature id for the 'Package' attribute. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__PACKAGE = 7; + + /** + * The number of structural features of the 'Document Root' class. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT_FEATURE_COUNT = 8; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.model.java.impl.JavaInfoImpl Info}' class. + * + * + * @see org.apache.tuscany.sdo.model.java.impl.JavaInfoImpl + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getJavaInfo() + * @generated + */ + public static final int JAVA_INFO = 1; + + /** + * The feature id for the 'Java Class' attribute. + * + * + * @generated + * @ordered + */ + public static final int JAVA_INFO__JAVA_CLASS = 0; + + /** + * The number of structural features of the 'Info' class. + * + * + * @generated + * @ordered + */ + public static final int JAVA_INFO_FEATURE_COUNT = 1; + + /** + * The meta object id for the 'Boolean Object' data type. + * + * + * @see java.lang.Boolean + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getBooleanObject() + * @generated + */ + public static final int BOOLEAN_OBJECT = 2; + + /** + * The meta object id for the 'Byte Object' data type. + * + * + * @see java.lang.Byte + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getByteObject() + * @generated + */ + public static final int BYTE_OBJECT = 3; + + /** + * The meta object id for the 'Character Object' data type. + * + * + * @see java.lang.Character + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getCharacterObject() + * @generated + */ + public static final int CHARACTER_OBJECT = 4; + + /** + * The meta object id for the 'Double Object' data type. + * + * + * @see java.lang.Double + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getDoubleObject() + * @generated + */ + public static final int DOUBLE_OBJECT = 5; + + /** + * The meta object id for the 'Float Object' data type. + * + * + * @see java.lang.Float + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getFloatObject() + * @generated + */ + public static final int FLOAT_OBJECT = 6; + + /** + * The meta object id for the 'Int Object' data type. + * + * + * @see java.lang.Integer + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getIntObject() + * @generated + */ + public static final int INT_OBJECT = 7; + + /** + * The meta object id for the 'Long Object' data type. + * + * + * @see java.lang.Long + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getLongObject() + * @generated + */ + public static final int LONG_OBJECT = 8; + + /** + * The meta object id for the 'Short Object' data type. + * + * + * @see java.lang.Short + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getShortObject() + * @generated + */ + public static final int SHORT_OBJECT = 9; + + /** + * + * + * @generated + */ + private EClass documentRootEClass = null; + + /** + * + * + * @generated + */ + private EClass javaInfoEClass = null; + + /** + * + * + * @generated + */ + private EDataType booleanObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType byteObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType characterObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType doubleObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType floatObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType intObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType longObjectEDataType = null; + + /** + * + * + * @generated + */ + private EDataType shortObjectEDataType = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#eNS_URI + * @see #init() + * @generated + */ + private JavaPackageImpl() + { + super(eNS_URI, ((EFactory)JavaFactory.INSTANCE)); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + *

Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + *

Invocation of this method will not affect any packages that have + * already been initialized. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static JavaPackageImpl init() + { + if (isInited) return (JavaPackageImpl)EPackage.Registry.INSTANCE.getEPackage(JavaPackageImpl.eNS_URI); + + // Obtain or create and register package + JavaPackageImpl theJavaPackageImpl = (JavaPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof JavaPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new JavaPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + SDOPackageImpl.eINSTANCE.eClass(); + ModelPackageImpl.eINSTANCE.eClass(); + + // Create package meta-data objects + theJavaPackageImpl.createPackageContents(); + + // Initialize created meta-data + theJavaPackageImpl.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theJavaPackageImpl.freeze(); + + return theJavaPackageImpl; + } + + + /** + * Returns the meta object for class '{@link org.eclipse.emf.ecore.EObject Document Root}'. + * + * + * @return the meta object for class 'Document Root'. + * @see org.eclipse.emf.ecore.EObject + * @generated + */ + public EClass getDocumentRoot() + { + return documentRootEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.eclipse.emf.ecore.EObject#getMixed Mixed}'. + * + * + * @return the meta object for the attribute list 'Mixed'. + * @see org.eclipse.emf.ecore.EObject#getMixed() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_Mixed() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap XMLNS Prefix Map}'. + * + * + * @return the meta object for the map 'XMLNS Prefix Map'. + * @see org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_XMLNSPrefixMap() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXSISchemaLocation XSI Schema Location}'. + * + * + * @return the meta object for the map 'XSI Schema Location'. + * @see org.eclipse.emf.ecore.EObject#getXSISchemaLocation() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_XSISchemaLocation() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.ecore.EObject#getExtendedInstanceClass Extended Instance Class}'. + * + * + * @return the meta object for the attribute 'Extended Instance Class'. + * @see org.eclipse.emf.ecore.EObject#getExtendedInstanceClass() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_ExtendedInstanceClass() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.ecore.EObject#getInstanceClass Instance Class}'. + * + * + * @return the meta object for the attribute 'Instance Class'. + * @see org.eclipse.emf.ecore.EObject#getInstanceClass() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_InstanceClass() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(4); + } + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.ecore.EObject#getJavaClass Java Class}'. + * + * + * @return the meta object for the attribute 'Java Class'. + * @see org.eclipse.emf.ecore.EObject#getJavaClass() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_JavaClass() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(5); + } + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.ecore.EObject#isNestedInterfaces Nested Interfaces}'. + * + * + * @return the meta object for the attribute 'Nested Interfaces'. + * @see org.eclipse.emf.ecore.EObject#isNestedInterfaces() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_NestedInterfaces() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(6); + } + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.ecore.EObject#getPackage Package}'. + * + * + * @return the meta object for the attribute 'Package'. + * @see org.eclipse.emf.ecore.EObject#getPackage() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_Package() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(7); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.model.java.JavaInfo Info}'. + * + * + * @return the meta object for class 'Info'. + * @see org.apache.tuscany.sdo.model.java.JavaInfo + * @generated + */ + public EClass getJavaInfo() + { + return javaInfoEClass; + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.model.java.JavaInfo#getJavaClass Java Class}'. + * + * + * @return the meta object for the attribute 'Java Class'. + * @see org.apache.tuscany.sdo.model.java.JavaInfo#getJavaClass() + * @see #getJavaInfo() + * @generated + */ + public EAttribute getJavaInfo_JavaClass() + { + return (EAttribute)javaInfoEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for data type '{@link java.lang.Boolean Boolean Object}'. + * + * + * @return the meta object for data type 'Boolean Object'. + * @see java.lang.Boolean + * @generated + */ + public EDataType getBooleanObject() + { + return booleanObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Byte Byte Object}'. + * + * + * @return the meta object for data type 'Byte Object'. + * @see java.lang.Byte + * @generated + */ + public EDataType getByteObject() + { + return byteObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Character Character Object}'. + * + * + * @return the meta object for data type 'Character Object'. + * @see java.lang.Character + * @generated + */ + public EDataType getCharacterObject() + { + return characterObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Double Double Object}'. + * + * + * @return the meta object for data type 'Double Object'. + * @see java.lang.Double + * @generated + */ + public EDataType getDoubleObject() + { + return doubleObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Float Float Object}'. + * + * + * @return the meta object for data type 'Float Object'. + * @see java.lang.Float + * @generated + */ + public EDataType getFloatObject() + { + return floatObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Integer Int Object}'. + * + * + * @return the meta object for data type 'Int Object'. + * @see java.lang.Integer + * @generated + */ + public EDataType getIntObject() + { + return intObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Long Long Object}'. + * + * + * @return the meta object for data type 'Long Object'. + * @see java.lang.Long + * @generated + */ + public EDataType getLongObject() + { + return longObjectEDataType; + } + + /** + * Returns the meta object for data type '{@link java.lang.Short Short Object}'. + * + * + * @return the meta object for data type 'Short Object'. + * @see java.lang.Short + * @generated + */ + public EDataType getShortObject() + { + return shortObjectEDataType; + } + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + public JavaFactory getJavaFactory() + { + return (JavaFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + documentRootEClass = createEClass(DOCUMENT_ROOT); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__MIXED); + createEReference(documentRootEClass, DOCUMENT_ROOT__XMLNS_PREFIX_MAP); + createEReference(documentRootEClass, DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__EXTENDED_INSTANCE_CLASS); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__INSTANCE_CLASS); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__JAVA_CLASS); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__NESTED_INTERFACES); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__PACKAGE); + + javaInfoEClass = createEClass(JAVA_INFO); + createEAttribute(javaInfoEClass, JAVA_INFO__JAVA_CLASS); + + // Create data types + booleanObjectEDataType = createEDataType(BOOLEAN_OBJECT); + byteObjectEDataType = createEDataType(BYTE_OBJECT); + characterObjectEDataType = createEDataType(CHARACTER_OBJECT); + doubleObjectEDataType = createEDataType(DOUBLE_OBJECT); + floatObjectEDataType = createEDataType(FLOAT_OBJECT); + intObjectEDataType = createEDataType(INT_OBJECT); + longObjectEDataType = createEDataType(LONG_OBJECT); + shortObjectEDataType = createEDataType(SHORT_OBJECT); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + ModelPackageImpl theModelPackageImpl = (ModelPackageImpl)EPackage.Registry.INSTANCE.getEPackage(ModelPackageImpl.eNS_URI); + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(documentRootEClass, null, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDocumentRoot_ExtendedInstanceClass(), theModelPackageImpl.getString(), "extendedInstanceClass", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDocumentRoot_InstanceClass(), theModelPackageImpl.getString(), "instanceClass", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDocumentRoot_JavaClass(), theModelPackageImpl.getString(), "javaClass", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDocumentRoot_NestedInterfaces(), theModelPackageImpl.getBoolean(), "nestedInterfaces", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDocumentRoot_Package(), theModelPackageImpl.getString(), "package", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(javaInfoEClass, JavaInfo.class, "JavaInfo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getJavaInfo_JavaClass(), theModelPackageImpl.getString(), "javaClass", null, 0, 1, JavaInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Initialize data types + initEDataType(booleanObjectEDataType, Boolean.class, "BooleanObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(byteObjectEDataType, Byte.class, "ByteObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(characterObjectEDataType, Character.class, "CharacterObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(doubleObjectEDataType, Double.class, "DoubleObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(floatObjectEDataType, Float.class, "FloatObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(intObjectEDataType, Integer.class, "IntObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(longObjectEDataType, Long.class, "LongObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + initEDataType(shortObjectEDataType, Short.class, "ShortObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http:///org/eclipse/emf/ecore/util/ExtendedMetaData + createExtendedMetaDataAnnotations(); + } + + /** + * Initializes the annotations for http:///org/eclipse/emf/ecore/util/ExtendedMetaData. + * + * + * @generated + */ + protected void createExtendedMetaDataAnnotations() + { + String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; + addAnnotation + (booleanObjectEDataType, + source, + new String[] + { + "name", "BooleanObject" + }); + addAnnotation + (byteObjectEDataType, + source, + new String[] + { + "name", "ByteObject" + }); + addAnnotation + (characterObjectEDataType, + source, + new String[] + { + "name", "CharacterObject" + }); + addAnnotation + (documentRootEClass, + source, + new String[] + { + "name", "", + "kind", "mixed" + }); + addAnnotation + (getDocumentRoot_Mixed(), + source, + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + addAnnotation + (getDocumentRoot_XMLNSPrefixMap(), + source, + new String[] + { + "kind", "attribute", + "name", "xmlns:prefix" + }); + addAnnotation + (getDocumentRoot_XSISchemaLocation(), + source, + new String[] + { + "kind", "attribute", + "name", "xsi:schemaLocation" + }); + addAnnotation + (getDocumentRoot_ExtendedInstanceClass(), + source, + new String[] + { + "kind", "attribute", + "name", "extendedInstanceClass", + "namespace", "##targetNamespace" + }); + addAnnotation + (getDocumentRoot_InstanceClass(), + source, + new String[] + { + "kind", "attribute", + "name", "instanceClass", + "namespace", "##targetNamespace" + }); + addAnnotation + (getDocumentRoot_JavaClass(), + source, + new String[] + { + "kind", "attribute", + "name", "javaClass", + "namespace", "##targetNamespace" + }); + addAnnotation + (getDocumentRoot_NestedInterfaces(), + source, + new String[] + { + "kind", "attribute", + "name", "nestedInterfaces", + "namespace", "##targetNamespace" + }); + addAnnotation + (getDocumentRoot_Package(), + source, + new String[] + { + "kind", "attribute", + "name", "package", + "namespace", "##targetNamespace" + }); + addAnnotation + (doubleObjectEDataType, + source, + new String[] + { + "name", "DoubleObject" + }); + addAnnotation + (floatObjectEDataType, + source, + new String[] + { + "name", "FloatObject" + }); + addAnnotation + (intObjectEDataType, + source, + new String[] + { + "name", "IntObject" + }); + addAnnotation + (javaInfoEClass, + source, + new String[] + { + "name", "JavaInfo", + "kind", "empty" + }); + addAnnotation + (getJavaInfo_JavaClass(), + source, + new String[] + { + "kind", "attribute", + "name", "javaClass", + "namespace", "##targetNamespace" + }); + addAnnotation + (longObjectEDataType, + source, + new String[] + { + "name", "LongObject" + }); + addAnnotation + (shortObjectEDataType, + source, + new String[] + { + "name", "ShortObject" + }); + } + + /** + * + * Defines literals for the meta objects that represent + *

    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + public interface Literals + { + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.java.impl.DocumentRootImpl Document Root}' class. + * + * + * @see org.apache.tuscany.sdo.model.java.impl.DocumentRootImpl + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getDocumentRoot() + * @generated + */ + public static final EClass DOCUMENT_ROOT = eINSTANCE.getDocumentRoot(); + + /** + * The meta object literal for the 'Mixed' attribute list feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__MIXED = eINSTANCE.getDocumentRoot_Mixed(); + + /** + * The meta object literal for the 'XMLNS Prefix Map' map feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__XMLNS_PREFIX_MAP = eINSTANCE.getDocumentRoot_XMLNSPrefixMap(); + + /** + * The meta object literal for the 'XSI Schema Location' map feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = eINSTANCE.getDocumentRoot_XSISchemaLocation(); + + /** + * The meta object literal for the 'Extended Instance Class' attribute feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__EXTENDED_INSTANCE_CLASS = eINSTANCE.getDocumentRoot_ExtendedInstanceClass(); + + /** + * The meta object literal for the 'Instance Class' attribute feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__INSTANCE_CLASS = eINSTANCE.getDocumentRoot_InstanceClass(); + + /** + * The meta object literal for the 'Java Class' attribute feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__JAVA_CLASS = eINSTANCE.getDocumentRoot_JavaClass(); + + /** + * The meta object literal for the 'Nested Interfaces' attribute feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__NESTED_INTERFACES = eINSTANCE.getDocumentRoot_NestedInterfaces(); + + /** + * The meta object literal for the 'Package' attribute feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__PACKAGE = eINSTANCE.getDocumentRoot_Package(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.model.java.impl.JavaInfoImpl Info}' class. + * + * + * @see org.apache.tuscany.sdo.model.java.impl.JavaInfoImpl + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getJavaInfo() + * @generated + */ + public static final EClass JAVA_INFO = eINSTANCE.getJavaInfo(); + + /** + * The meta object literal for the 'Java Class' attribute feature. + * + * + * @generated + */ + public static final EAttribute JAVA_INFO__JAVA_CLASS = eINSTANCE.getJavaInfo_JavaClass(); + + /** + * The meta object literal for the 'Boolean Object' data type. + * + * + * @see java.lang.Boolean + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getBooleanObject() + * @generated + */ + public static final EDataType BOOLEAN_OBJECT = eINSTANCE.getBooleanObject(); + + /** + * The meta object literal for the 'Byte Object' data type. + * + * + * @see java.lang.Byte + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getByteObject() + * @generated + */ + public static final EDataType BYTE_OBJECT = eINSTANCE.getByteObject(); + + /** + * The meta object literal for the 'Character Object' data type. + * + * + * @see java.lang.Character + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getCharacterObject() + * @generated + */ + public static final EDataType CHARACTER_OBJECT = eINSTANCE.getCharacterObject(); + + /** + * The meta object literal for the 'Double Object' data type. + * + * + * @see java.lang.Double + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getDoubleObject() + * @generated + */ + public static final EDataType DOUBLE_OBJECT = eINSTANCE.getDoubleObject(); + + /** + * The meta object literal for the 'Float Object' data type. + * + * + * @see java.lang.Float + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getFloatObject() + * @generated + */ + public static final EDataType FLOAT_OBJECT = eINSTANCE.getFloatObject(); + + /** + * The meta object literal for the 'Int Object' data type. + * + * + * @see java.lang.Integer + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getIntObject() + * @generated + */ + public static final EDataType INT_OBJECT = eINSTANCE.getIntObject(); + + /** + * The meta object literal for the 'Long Object' data type. + * + * + * @see java.lang.Long + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getLongObject() + * @generated + */ + public static final EDataType LONG_OBJECT = eINSTANCE.getLongObject(); + + /** + * The meta object literal for the 'Short Object' data type. + * + * + * @see java.lang.Short + * @see org.apache.tuscany.sdo.model.java.impl.JavaPackageImpl#getShortObject() + * @generated + */ + public static final EDataType SHORT_OBJECT = eINSTANCE.getShortObject(); + + } + +} //JavaPackageImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/BasicSequence.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/BasicSequence.java new file mode 100644 index 0000000000..5a631dde77 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/BasicSequence.java @@ -0,0 +1,134 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util; + +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.FeatureMapUtil; +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; + +import commonj.sdo.Property; +import commonj.sdo.Sequence; + +/** + * SDO Sequance implementation which delegates to a feature map. + */ +public class BasicSequence implements Sequence, FeatureMap.Internal.Wrapper +{ + protected FeatureMap.Internal featureMap; + + public BasicSequence(FeatureMap.Internal featureMap) + { + this.featureMap = featureMap; + featureMap.setWrapper(this); + } + + public FeatureMap featureMap() + { + return featureMap; + } + + public int size() + { + return featureMap.size(); + } + + public Property getProperty(int index) + { + EStructuralFeature feature = featureMap.getEStructuralFeature(index); + boolean isText = + feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT || + feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA || + feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT; + return isText ? null : (Property)feature; + } + + public Object getValue(int index) + { + return featureMap.getValue(index); + } + + public Object setValue(int index, Object value) + { + return featureMap.setValue(index, value); + } + + protected EStructuralFeature getEStructuralFeature(String propertyName) + { + return featureMap.getEObject().eClass().getEStructuralFeature(propertyName); + } + + protected EStructuralFeature getEStructuralFeature(int propertyIndex) + { + return featureMap.getEObject().eClass().getEStructuralFeature(propertyIndex); + } + + public boolean add(String propertyName, Object value) + { + return featureMap.add(getEStructuralFeature(propertyName), value); + } + + public boolean add(int propertyIndex, Object value) + { + return featureMap.add(getEStructuralFeature(propertyIndex), value); + } + + public boolean add(Property property, Object value) + { + return featureMap.add((EStructuralFeature)property, value); + } + + public void add(int index, String propertyName, Object value) + { + featureMap.add(index, getEStructuralFeature(propertyName), value); + } + + public void add(int index, int propertyIndex, Object value) + { + featureMap.add(index, getEStructuralFeature(propertyIndex), value); + } + + public void add(int index, Property property, Object value) + { + featureMap.add(index, (EStructuralFeature)property, value); + } + + public void add(String text) + { + FeatureMapUtil.addText(featureMap, text); + } + + public void add(int index, String text) + { + FeatureMapUtil.addText(featureMap, index, text); + } + + public void remove(int index) + { + featureMap.remove(index); + } + + public void move(int toIndex, int fromIndex) + { + featureMap.move(toIndex, fromIndex); + } + + public String toString() + { + return featureMap.toString(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataGraphResourceFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataGraphResourceFactoryImpl.java new file mode 100644 index 0000000000..8f10b7f198 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataGraphResourceFactoryImpl.java @@ -0,0 +1,644 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util; + + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sdo.SDOFactory; +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.impl.ChangeSummaryImpl; +import org.apache.tuscany.sdo.impl.DataGraphImpl; +import org.apache.tuscany.sdo.impl.DynamicDataObjectImpl; +import org.eclipse.emf.common.util.EMap; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.ExtendedMetaData; +import org.eclipse.emf.ecore.xmi.EcoreBuilder; +import org.eclipse.emf.ecore.xmi.NameInfo; +import org.eclipse.emf.ecore.xmi.XMLHelper; +import org.eclipse.emf.ecore.xmi.XMLLoad; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.emf.ecore.xmi.XMLSave; +import org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler; +import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl; +import org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl; +import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; +import org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl; +import org.eclipse.emf.ecore.xmi.util.DefaultEcoreBuilder; +import org.w3c.dom.Element; +import org.xml.sax.helpers.DefaultHandler; + +import commonj.sdo.ChangeSummary; + + +public class DataGraphResourceFactoryImpl extends ResourceFactoryImpl +{ + /** + * Constructor for DataGraphResourceFactoryImpl. + */ + public DataGraphResourceFactoryImpl() + { + super(); + } + + public Resource createResource(URI uri) + { + XMLResourceImpl result = new DataGraphResourceImpl(uri); + + result.setEncoding("UTF-8"); + + result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE); + + result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); + result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); + + result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); + result.getDefaultSaveOptions().put(XMLResource.OPTION_LINE_WIDTH, new Integer(80)); + + result.getDefaultLoadOptions().put(XMLResource.OPTION_ANY_TYPE, SDOPackage.eINSTANCE.getAnyTypeDataObject()); + result.getDefaultSaveOptions().put(XMLResource.OPTION_ANY_TYPE, SDOPackage.eINSTANCE.getAnyTypeDataObject()); + + result.getDefaultLoadOptions().put(XMLResource.OPTION_ANY_SIMPLE_TYPE, SDOPackage.eINSTANCE.getSimpleAnyTypeDataObject()); + result.getDefaultSaveOptions().put(XMLResource.OPTION_ANY_SIMPLE_TYPE, SDOPackage.eINSTANCE.getSimpleAnyTypeDataObject()); + + return result; + } + + public static class DataGraphResourceImpl extends XMLResourceImpl + { + public DataGraphResourceImpl(URI uri) + { + super(uri); + } + + public static class HelperImpl extends XMLHelperImpl + { + protected DataGraphImpl eDataGraph; + + protected List resources; + protected List uris; + + public HelperImpl(XMLResource xmlResource) + { + super(xmlResource); + } + + public void setResource(XMLResource resource) + { + super.setResource(resource); + if (!resource.getContents().isEmpty()) + { + eDataGraph = (DataGraphImpl)resource.getContents().get(0); + + resources = new ArrayList(); + uris = new ArrayList(); + + resources.add(eDataGraph.getRootResource()); + uris.add("#" + resource.getURIFragment(eDataGraph) + "/@eRootObject"); + + if (eDataGraph.getEChangeSummary() != null) + { + // Ensure that resource exists. + // + resources.add(((EObject)eDataGraph.getChangeSummary()).eResource()); + uris.add("#" + resource.getURIFragment(eDataGraph) + "/@eChangeSummary"); + } + + if (eDataGraph.eResource() != null && eDataGraph.eResource().getResourceSet() != null) + { + int count = 0; + for (Iterator i = eDataGraph.eResource().getResourceSet().getResources().iterator(); i.hasNext();) + { + Resource ePackageResource = (Resource)i.next(); + List resourceContents = ePackageResource.getContents(); + if (resourceContents.size() == 1 && resourceContents.get(0) instanceof EPackage) + { + resources.add(ePackageResource); + uris.add("#" + resource.getURIFragment(eDataGraph) + "/@models." + count++); + } + } + } + } + } + + public String getID(EObject eObject) + { + return super.getID(eObject); + } + + public String getIDREF(EObject eObject) + { + return super.getIDREF(eObject); + } + + public String getHREF(EObject eObject) + { + return super.getHREF(eObject); + } + + protected URI getHREF(Resource otherResource, EObject obj) + { + int index = resources.indexOf(otherResource); + if (index == -1) + { + return super.getHREF(otherResource, obj); + } + else + { + return createHREF((String)uris.get(index), otherResource.getURIFragment(obj)); + } + } + + protected URI createHREF(String baseURI, String fragment) + { + if (fragment.startsWith("/")) + { + return URI.createURI(baseURI + fragment.substring(1)); + } + else + { + return URI.createURI("#" + fragment); + } + } + + public void populateNameInfo(NameInfo nameInfo, EClass c) + { + if (c == SDOPackage.eINSTANCE.getDataGraph()) + { + if (extendedMetaData != null) + { + extendedMetaData.demandPackage("commonj.sdo").setNsPrefix("sdo"); + } + nameInfo.setQualifiedName(getQName("commonj.sdo", "datagraph")); + nameInfo.setNamespaceURI("commonj.sdo"); + nameInfo.setLocalPart("datagraph"); + } + else if (c == SDOPackage.eINSTANCE.getChangeSummary()) + { + if (extendedMetaData != null) + { + extendedMetaData.demandPackage("commonj.sdo").setNsPrefix("sdo"); + } + nameInfo.setQualifiedName("changeSummary"); + nameInfo.setNamespaceURI(null); + nameInfo.setLocalPart("changeSummary"); + } + else + { + super.populateNameInfo(nameInfo, c); + } + } + + public String getQName(EClass c) + { + if (c == SDOPackage.eINSTANCE.getDataGraph()) + { + if (extendedMetaData != null) + { + extendedMetaData.demandPackage("commonj.sdo").setNsPrefix("sdo"); + } + return getQName("commonj.sdo", "datagraph"); + } + else if (c == SDOPackage.eINSTANCE.getChangeSummary()) + { + if (extendedMetaData != null) + { + extendedMetaData.demandPackage("commonj.sdo").setNsPrefix("sdo"); + } + return getQName((String)null, "changeSummary"); + } + else + { + return super.getQName(c); + } + } + } + + protected XMLHelper createXMLHelper() + { + return new HelperImpl(this); + } + + protected EObject getEObjectByID(String id) + { + List contents = getContents(); + if (contents.size() >= 1) + { + Object rootObject = contents.get(0); + if (rootObject instanceof DataGraphImpl) + { + DataGraphImpl eDataGraph = (DataGraphImpl)rootObject; + EObject result = eDataGraph.getRootResource().getEObject(id); + if (result != null) + { + return result; + } + else + { + ChangeSummary eChangeSummary = eDataGraph.getEChangeSummary(); + if (eChangeSummary != null) + { + result = ((EObject)eDataGraph.getChangeSummary()).eResource().getEObject(id); + if (result != null) + { + return result; + } + } + } + } + } + return super.getEObjectByID(id); + } + + public static class SaveImpl extends XMLSaveImpl + { + protected DataGraphImpl eDataGraph; + + public SaveImpl(XMLHelper xmlHelper) + { + super(xmlHelper); + } + + public void traverse(List contents) + { + if (contents.size() >= 1 && contents.get(0) instanceof DataGraphImpl) + { + eDataGraph = (DataGraphImpl)contents.get(0); + + Object datagraphMark = null; + if (!toDOM) + { + if (declareXML) + { + doc.add(""); + doc.addLine(); + } + String elementName = helper.getQName(eDataGraph.eClass()); + doc.startElement(elementName); + datagraphMark = doc.mark(); + } + else + { + helper.populateNameInfo(nameInfo, eDataGraph.eClass()); + currentNode = document.createElementNS(nameInfo.getNamespaceURI(), nameInfo.getQualifiedName()); + document.appendChild(currentNode); + // not calling handler since there is no corresponding EObject + } + + if (eDataGraph.eResource() != null && eDataGraph.eResource().getResourceSet() != null) + { + List ePackages = new ArrayList(); + for (Iterator i = eDataGraph.eResource().getResourceSet().getResources().iterator(); i.hasNext();) + { + List resourceContents = ((Resource)i.next()).getContents(); + if (resourceContents.size() == 1 && resourceContents.get(0) instanceof EPackage) + { + ePackages.add(resourceContents.get(0)); + } + } + if (!ePackages.isEmpty()) + { + if (!toDOM) + { + doc.startElement("models"); + doc.addAttribute("xmlns", ""); + } + else + { + currentNode = currentNode.appendChild(document.createElementNS(null, "models")); + ((Element)currentNode).setAttributeNS(ExtendedMetaData.XMLNS_URI, ExtendedMetaData.XMLNS_PREFIX, ""); + // not calling handler since there is no corresponding EObject + } + for (Iterator i = ePackages.iterator(); i.hasNext();) + { + writeTopObject((EPackage)i.next()); + } + if (!toDOM) + { + doc.endElement(); + } + else + { + currentNode = currentNode.getParentNode(); + } + } + } + + // use namespace declarations defined in the document (if any) + EObject eRootObject = eDataGraph.getERootObject(); + EReference xmlnsPrefixMapFeature = extendedMetaData.getXMLNSPrefixMapFeature(eRootObject.eClass()); + if (xmlnsPrefixMapFeature != null) + { + EMap xmlnsPrefixMap = (EMap)eRootObject.eGet(xmlnsPrefixMapFeature); + helper.setPrefixToNamespaceMap(xmlnsPrefixMap); + } + ChangeSummary changeSummary = eDataGraph.getEChangeSummary(); + + if (changeSummary != null) + { + helper.setMustHavePrefix(true); + if (changeSummary.isLogging()) + { + ((ChangeSummaryImpl)changeSummary).summarize(); + writeTopObject((EObject)changeSummary); + } + else + { + writeTopObject((EObject)changeSummary); + } + helper.setMustHavePrefix(false); + } + + if (eRootObject != null && writeTopObject(eRootObject) == null && !toDOM) + { + doc.addLine(); + doc.setMixed(false); + } + if (!toDOM) + { + doc.endElement(); + // reset to add namespace declarations + // + doc.resetToMark(datagraphMark); + } + else + { + currentNode = document.getFirstChild(); + } + addNamespaceDeclarations(); + } + else + { + super.traverse(contents); + } + } + + protected void writeTopAttributes(EObject top) + { + if (top == eDataGraph.getEChangeSummary()) + { + if (!toDOM) + { + doc.addAttribute("xmlns", ""); + } + else + { + ((Element)currentNode).setAttributeNS(ExtendedMetaData.XMLNS_URI, ExtendedMetaData.XMLNS_PREFIX, ""); + } + } + } + + protected EObject getSchemaLocationRoot(EObject eObject) + { + return eDataGraph.getERootObject(); + } + } + + protected XMLSave createXMLSave() + { + return new SaveImpl(createXMLHelper()); + } + + public static class LoadImpl extends XMLLoadImpl + { + public LoadImpl(XMLHelper xmlHelper) + { + super(xmlHelper); + } + + protected DefaultHandler makeDefaultHandler() + { + return new SAXXMLHandler(resource, helper, options) + { + protected DataGraphImpl eDataGraph; + + protected boolean isInModels; + + protected List ePackages = new ArrayList(); + + protected EMap recordNamespacesSchemaLocations(EObject root) + { + EObject dgroot = eDataGraph.getERootObject(); + if (dgroot == null) + { + return null; + } + EMap prefixToNamespaceMap = super.recordNamespacesSchemaLocations(dgroot); + if (prefixToNamespaceMap != null) + { + for (Iterator i = prefixToNamespaceMap.iterator(); i.hasNext();) + { + Map.Entry entry = (Map.Entry)i.next(); + String prefix = (String)entry.getKey(); + String namespace = (String)entry.getValue(); + if (namespace.equals("commonj.sdo")) + { + prefixToNamespaceMap.removeKey(prefix); + break; + } + } + } + return prefixToNamespaceMap; + } + + protected void handleFeature(String prefix, String name) + { + if (isInModels && objects.size() == 2) + { + EObject modelObject = createObjectByType(prefix, name, false); + processObject(modelObject); + ePackages.add(modelObject); + } + else if (objects.size() == 1) + { + eDataGraph = (DataGraphImpl)objects.peek(); + eDataGraph.getResourceSet(); + if ("".equals(prefix) && "changeSummary".equals(name)) + { + ChangeSummary eChangeSummary = (ChangeSummary)createObjectFromFactory(SDOFactory.eINSTANCE, "EChangeSummary"); + eDataGraph.setEChangeSummary(eChangeSummary); + processObject((EObject)eChangeSummary); + } + else if ("".equals(prefix) && "models".equals(name)) + { + isInModels = true; + types.push(OBJECT_TYPE); + objects.push(eDataGraph); + mixedTargets.push(null); + } + else if (eDataGraph.getERootObject() == null) + { + if (processAnyXML) + { + // Ensure that anything can be handled, even if it's not recognized. + // + String namespaceURI = helper.getURI(prefix); + if (extendedMetaData.getPackage(namespaceURI) == null) + { + EStructuralFeature rootFeature = extendedMetaData.demandFeature(namespaceURI, name, true); + rootFeature.getEContainingClass().getEPackage().setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl()); + } + } + + EObject rootObject = createObjectByType(prefix, name, false); + eDataGraph.setERootObject(rootObject); + processObject(rootObject); + if (rootObject != null + && rootObject.eClass() == ExtendedMetaData.INSTANCE.getDocumentRoot(rootObject.eClass().getEPackage())) + { + super.handleFeature(prefix, name); + + // Remove the document root from the stack. + // + Object mixedTarget = mixedTargets.pop(); + Object object = objects.pop(); + mixedTargets.pop(); + objects.pop(); + mixedTargets.push(mixedTarget); + objects.push(object); + } + } + } + else + { + super.handleFeature(prefix, name); + } + } + + public void endElement(String uri, String localName, String name) + { + if (isInModels && objects.size() == 2) + { + if (!ePackages.isEmpty()) + { + for (Iterator i = ePackages.iterator(); i.hasNext();) + { + EPackage ePackage = (EPackage)i.next(); + ePackage.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl()); + Resource resource = resourceSet.createResource(URI.createURI("*.ecore")); + resource.getContents().add(ePackage); + if (ePackage.getNsURI() != null) + { + resource.setURI(URI.createURI(ePackage.getNsURI())); + } + + if (extendedMetaData != null) + { + extendedMetaData.putPackage(extendedMetaData.getNamespace(ePackage), ePackage); + } + else + { + packageRegistry.put(ePackage.getNsURI(), ePackage); + } + } + handleForwardReferences(); + } + isInModels = false; + } + super.endElement(uri, localName, name); + } + + protected EPackage getPackageForURI(String uriString) + { + if ("commonj.sdo".equals(uriString)) + { + return SDOPackage.eINSTANCE; + } + else + { + return super.getPackageForURI(uriString); + } + } + + protected EObject createObjectFromFactory(EFactory factory, String typeName) + { + if (factory == SDOFactory.eINSTANCE) + { + if ("datagraph".equals(typeName)) + { + return super.createObjectFromFactory(factory, "EDataGraph"); + } + } + return super.createObjectFromFactory(factory, typeName); + } + + protected EcoreBuilder createEcoreBuilder(Map options, ExtendedMetaData extendedMetaData) + { + return new DefaultEcoreBuilder(extendedMetaData) + { + public Collection generate(Map urisToLocations) throws Exception + { + Collection result = super.generate(urisToLocations); + return updateDynamicFactory(result); + } + + public Collection generate(Collection urisToLocations) throws Exception + { + Collection result = super.generate(urisToLocations); + return updateDynamicFactory(result); + } + + protected Collection updateDynamicFactory(Collection result) + { + for (Iterator i = result.iterator(); i.hasNext();) + { + Resource resource = (Resource)i.next(); + for (Iterator j = EcoreUtil.getObjectsByType(resource.getContents(), EcorePackage.eINSTANCE.getEPackage()).iterator(); j.hasNext();) + { + EPackage ePackage = (EPackage)j.next(); + ePackage.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl()); + } + } + return result; + } + + }; + } + + protected EPackage handleMissingPackage(String uriString) + { + EPackage result = super.handleMissingPackage(uriString); + if (processAnyXML && objects.size() == 1) + { + result = extendedMetaData.demandPackage(uriString); + } + return result; + } + }; + } + } + + protected XMLLoad createXMLLoad() + { + return new LoadImpl(createXMLHelper()); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java new file mode 100644 index 0000000000..23df894b32 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/DataObjectUtil.java @@ -0,0 +1,2564 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util; + + +import java.io.InvalidObjectException; +import java.io.ObjectStreamException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.tuscany.sdo.SDOExtendedMetaData; +import org.apache.tuscany.sdo.impl.DataGraphImpl; +import org.apache.tuscany.sdo.impl.SDOFactoryImpl; +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.common.util.UniqueEList; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EcoreFactory; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.ExtendedMetaData; +import org.eclipse.emf.ecore.util.FeatureMap; +import org.eclipse.emf.ecore.util.FeatureMapUtil; +import org.eclipse.emf.ecore.xmi.impl.EMOFResourceFactoryImpl; +import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl; +import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl; +import org.eclipse.emf.ecore.xml.type.internal.XMLCalendar; +import org.eclipse.xsd.util.XSDResourceFactoryImpl; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Sequence; +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; + + +public final class DataObjectUtil +{ + public static Object writeReplace(DataObject dataObject) throws ObjectStreamException + { + DataGraph dataGraph = dataObject.getDataGraph(); + if (dataGraph != null) + { + return ((DataGraphImpl)dataGraph).getWriteReplacement((EObject)dataObject); + } + else + { + throw new InvalidObjectException("The object must be in a datagraph to be serialized " + dataObject); + } + } + + public static void setString(DataObject dataObject, Property property, String value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setShort(DataObject dataObject, Property property, short value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setLong(DataObject dataObject, Property property, long value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setList(DataObject dataObject, Property property, List value) { + dataObject.set(property, value); + } + + public static void setInt(DataObject dataObject, Property property, int value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setFloat(DataObject dataObject, Property property, float value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setDouble(DataObject dataObject, Property property, double value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setDate(DataObject dataObject, Property property, Date value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setDataObject(DataObject dataObject, Property property, DataObject value) { + dataObject.set(property, value); + } + + public static void setChar(DataObject dataObject, Property property, char value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setBytes(DataObject dataObject, Property property, byte[] value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setByte(DataObject dataObject, Property property, byte value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setBoolean(DataObject dataObject, Property property, boolean value) { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setBigInteger(DataObject dataObject, Property property, BigInteger value) + { + dataObject.set(property, getSetValue(property, value)); + } + + public static void setBigDecimal(DataObject dataObject, Property property, BigDecimal value) + { + dataObject.set(property, getSetValue(property, value)); + } + + public static String getString(DataObject dataObject, Property property) + { + return getString(dataObject.get(property)); + } + + public static short getShort(DataObject dataObject, Property property) + { + return getShort(dataObject.get(property)); + } + + public static Sequence getSequence(DataObject dataObject, Property property) + { + return (Sequence)dataObject.get(property); + } + + public static long getLong(DataObject dataObject, Property property) + { + return getLong(dataObject.get(property)); + } + + public static List getList(DataObject dataObject, Property property) + { + return (List)dataObject.get(property); + } + + public static int getInt(DataObject dataObject, Property property) + { + return getInt(dataObject.get(property)); + } + + public static float getFloat(DataObject dataObject, Property property) + { + return getFloat(dataObject.get(property)); + } + + public static double getDouble(DataObject dataObject, Property property) + { + return getDouble(dataObject.get(property)); + } + + public static Date getDate(DataObject dataObject, Property property) + { + return getDate(dataObject.get(property)); + } + + public static DataObject getDataObject(DataObject dataObject, Property property) + { + return (DataObject)dataObject.get(property); + } + + public static char getChar(DataObject dataObject, Property property) + { + return getChar(dataObject.get(property)); + } + + public static byte[] getBytes(DataObject dataObject, Property property) + { + return getBytes(dataObject.get(property)); + } + + public static byte getByte(DataObject dataObject, Property property) + { + return getByte(dataObject.get(property)); + } + + public static boolean getBoolean(DataObject dataObject, Property property) + { + return getBoolean(dataObject.get(property)); + } + + public static BigInteger getBigInteger(DataObject dataObject, Property property) + { + return getBigInteger(dataObject.get(property)); + } + + public static BigDecimal getBigDecimal(DataObject dataObject, Property property) + { + return getBigDecimal(dataObject.get(property)); + } + + + + private static Property getPropertyByIndex(DataObject dataObject, int propertyIndex) { + EObject eObject = (EObject) dataObject; + Property property = (Property)eObject.eClass().getEStructuralFeature(propertyIndex); + return property; + } + + public static void setString(DataObject dataObject, int propertyIndex, String value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setShort(DataObject dataObject, int propertyIndex, short value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setLong(DataObject dataObject, int propertyIndex, long value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setList(DataObject dataObject, int propertyIndex, List value) { + dataObject.set(propertyIndex, value); + } + + public static void setInt(DataObject dataObject, int propertyIndex, int value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setFloat(DataObject dataObject, int propertyIndex, float value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setDouble(DataObject dataObject, int propertyIndex, double value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setDate(DataObject dataObject, int propertyIndex, Date value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setDataObject(DataObject dataObject, int propertyIndex, DataObject value) { + dataObject.set(propertyIndex, value); + } + + public static void setChar(DataObject dataObject, int propertyIndex, char value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setBytes(DataObject dataObject, int propertyIndex, byte[] value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setByte(DataObject dataObject, int propertyIndex, byte value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setBoolean(DataObject dataObject, int propertyIndex, boolean value) { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setBigInteger(DataObject dataObject, int propertyIndex, BigInteger value) + { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static void setBigDecimal(DataObject dataObject, int propertyIndex, BigDecimal value) + { + dataObject.set(propertyIndex, getSetValue(getPropertyByIndex(dataObject, propertyIndex), value)); + } + + public static String getString(DataObject dataObject, int propertyIndex) + { + return getString(dataObject.get(propertyIndex)); + } + + public static short getShort(DataObject dataObject, int propertyIndex) + { + return getShort(dataObject.get(propertyIndex)); + } + + public static Sequence getSequence(DataObject dataObject, int propertyIndex) + { + return (Sequence)dataObject.get(propertyIndex); + } + + public static long getLong(DataObject dataObject, int propertyIndex) + { + return getLong(dataObject.get(propertyIndex)); + } + + public static List getList(DataObject dataObject, int propertyIndex) + { + return (List)dataObject.get(propertyIndex); + } + + public static int getInt(DataObject dataObject, int propertyIndex) + { + return getInt(dataObject.get(propertyIndex)); + } + + public static float getFloat(DataObject dataObject, int propertyIndex) + { + return getFloat(dataObject.get(propertyIndex)); + } + + public static double getDouble(DataObject dataObject, int propertyIndex) + { + return getDouble(dataObject.get(propertyIndex)); + } + + public static Date getDate(DataObject dataObject, int propertyIndex) + { + return getDate(dataObject.get(propertyIndex)); + } + + public static DataObject getDataObject(DataObject dataObject, int propertyIndex) + { + return (DataObject)dataObject.get(propertyIndex); + } + + public static char getChar(DataObject dataObject, int propertyIndex) + { + return getChar(dataObject.get(propertyIndex)); + } + + public static byte[] getBytes(DataObject dataObject, int propertyIndex) + { + return getBytes(dataObject.get(propertyIndex)); + } + + public static byte getByte(DataObject dataObject, int propertyIndex) + { + return getByte(dataObject.get(propertyIndex)); + } + + public static boolean getBoolean(DataObject dataObject, int propertyIndex) + { + return getBoolean(dataObject.get(propertyIndex)); + } + + public static BigInteger getBigInteger(DataObject dataObject, int propertyIndex) + { + return getBigInteger(dataObject.get(propertyIndex)); + } + + public static BigDecimal getBigDecimal(DataObject dataObject, int propertyIndex) + { + return getBigDecimal(dataObject.get(propertyIndex)); + } + + public static void detach(DataObject dataObject) { + EcoreUtil.remove((EObject)dataObject); + } + + public static DataObject getRootObject(DataObject dataObject) + { + return (DataObject)EcoreUtil.getRootContainer((EObject)dataObject); + } + + public static List getInstanceProperties(DataObject dataObject) + { + //TODO maybe optimize this to just return type.getProperties if type.isOpen (isOpen would need to be cached) + EObject eDataObject = (EObject) dataObject; + List result = new UniqueEList(eDataObject.eClass().getEAllStructuralFeatures()); + for (int i = 0, count = result.size(); i < count; ++i) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)result.get(i); + if (!eStructuralFeature.isDerived() && FeatureMapUtil.isFeatureMap(eStructuralFeature)) + { + List features = (List)eDataObject.eGet(eStructuralFeature); + for (int j = 0, size = features.size(); j < size; ++j) + { + FeatureMap.Entry entry = (FeatureMap.Entry)features.get(j); + EStructuralFeature entryFeature = entry.getEStructuralFeature(); + result.add(entryFeature); + } + } + } + return result; + } + + public static void delete(DataObject dataObject) + { + EObject eDataObject = (EObject)dataObject; + EcoreUtil.remove(eDataObject); + List contents = new ArrayList((eDataObject).eContents()); + for (int i = 0, size = contents.size(); i < size; ++i) + { + ((DataObject)contents.get(i)).delete(); + } + EClass eClass = eDataObject.eClass(); + for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i) + { + EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i); + if (eStructuralFeature.isChangeable() && !eStructuralFeature.isDerived() && !((Property)eStructuralFeature).isReadOnly()) + { + eDataObject.eUnset(eStructuralFeature); + } + } + } + + public static DataObject createDataObject(DataObject dataObject, Property property, Type type) + { + if (!property.isContainment()) + { + throw new IllegalArgumentException("The property '" + property.getName() + "' of '" + property.getContainingType().getName() + + "' isn't a containment"); + } + DataObject result = DataObjectUtil.create(type); + if (FeatureMapUtil.isMany((EObject)dataObject, (EStructuralFeature)property)) + { + ((List)dataObject.get(property)).add(result); + } + else + { + dataObject.set(property, result); + } + return result; + } + + public static DataObject createDataObject(DataObject dataObject, int propertyIndex, String namespaceURI, String typeName) + { + Property property = DataObjectUtil.getProperty(dataObject, propertyIndex); + Type type = DataObjectUtil.getType(dataObject, namespaceURI, typeName); + return createDataObject(dataObject, property, type); + } + + public static DataObject createDataObject(DataObject dataObject, String propertyName, String namespaceURI, String typeName) + { + Property property = getProperty(dataObject, propertyName); + Type type = DataObjectUtil.getType(dataObject, namespaceURI, typeName); + return createDataObject(dataObject, property, type); + } + + public static DataObject createDataObject(DataObject dataObject, Property property) + { + Type type = property.getType(); + return createDataObject(dataObject, property, type); + } + + public static DataObject createDataObject(DataObject dataObject, int propertyIndex) + { + Property property = getProperty(dataObject, propertyIndex); + Type type = property.getType(); + return createDataObject(dataObject,property, type); + } + + public static DataObject createDataObject(DataObject dataObject, String propertyName) + { + Property property = (Property)getProperty(dataObject, propertyName); + Type type = property.getType(); + return createDataObject(dataObject,property, type); + } + + public static void setString(DataObject dataObject, String path, String value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + + public static void setShort(DataObject dataObject, String path, short value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setLong(DataObject dataObject, String path, long value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setList(DataObject dataObject, String path, List value) + { + dataObject.set(path, value); + } + + public static void setInt(DataObject dataObject, String path, int value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setFloat(DataObject dataObject, String path, float value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setDouble(DataObject dataObject, String path, double value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setDate(DataObject dataObject, String path, Date value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setDataObject(DataObject dataObject, String path, DataObject value) + { + dataObject.set(path, value); + } + + public static void setChar(DataObject dataObject, String path, char value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setBytes(DataObject dataObject, String path, byte[] value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setByte(DataObject dataObject, String path, byte value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setBoolean(DataObject dataObject, String path, boolean value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setBigInteger(DataObject dataObject, String path, BigInteger value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static void setBigDecimal(DataObject dataObject, String path, BigDecimal value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, DataObjectUtil.getSetValue(property, value)); + } + else + { + DataObjectUtil.Accessor accessor = DataObjectUtil.Accessor.create((EObject)dataObject, path); + accessor.setAndRecyle(DataObjectUtil.getSetValue(accessor.getProperty(), value)); + } + } + + public static DataGraph getDataGraph(DataObject dataObject) + { + Resource resource = ((EObject)dataObject).eResource(); + if (resource != null) + { + ResourceSet resourceSet = resource.getResourceSet(); + if (resourceSet != null) + { + return (DataGraphImpl)EcoreUtil.getAdapter(resourceSet.eAdapters(), DataGraph.class); + } + } + return null; + } + + public static ChangeSummary getChangeSummary(DataObject dataObject) + { + DataGraph dataGraph = getDataGraph(dataObject); + if (dataGraph != null) + { + return dataGraph.getChangeSummary(); + } + // TODO: handle ChangeSummary-type property + return null; + } + + public static void unset(DataObject dataObject, String path) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.unset(property); + } + else + { + DataObjectUtil.Accessor.create((EObject)dataObject, path).unsetAndRecyle(); + } + } + + public static boolean isSet(DataObject dataObject, String path) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + return dataObject.isSet(property); + } + else + { + return DataObjectUtil.Accessor.create( + (EObject)dataObject, path).isSetAndRecyle(); + } + } + + public static void set(DataObject dataObject, String path, Object value) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) + { + dataObject.set(property, value); + } + else + { + DataObjectUtil.Accessor.create( + (EObject)dataObject, path).setAndRecyle(value); + } + } + + public static Object get(DataObject dataObject, String path) + { + Property property = dataObject.getType().getProperty(path); + if (property != null) { + return dataObject.get(property); + } else { + return Accessor.create((EObject)dataObject, path).getAndRecyle(); + } + } + + public static BigDecimal getBigDecimal(Object value) + { + if (value instanceof BigDecimal) + { + return (BigDecimal)value; + } + + if (value instanceof BigInteger) + { + return new BigDecimal((BigInteger)value); + } + + if (value instanceof Number) + { + return new BigDecimal(((Number)value).doubleValue()); + } + + if (value instanceof String) + { + return new BigDecimal((String)value); + } + + if (value == null) + { + return null; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to BigDecimal"); + } + + public static Object getSetValue(Property property, BigDecimal value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + EClassifier eType = eStructuralFeature.getEType(); + if (value == null) + { + return eType.getDefaultValue(); + } + + String name = eType.getInstanceClassName(); + if (name == "java.math.BigDecimal") + { + return value; + } + + if (name == "java.math.BigInteger") + { + return value.toBigInteger(); + } + + if (name == "java.lang.Byte" || name == "byte") + { + return new Byte(value.byteValue()); + } + + if (name == "java.lang.Double" || name == "double") + { + return new Double(value.doubleValue()); + } + + if (name == "java.lang.Float" || name == "float") + { + return new Float(value.floatValue()); + } + + if (name == "java.lang.Integer" || name == "int") + { + return new Integer(value.intValue()); + } + + if (name == "java.lang.Long" || name == "long") + { + return new Long(value.longValue()); + } + + if (name == "java.lang.Short" || name == "short") + { + return new Short(value.shortValue()); + } + + if (name == "java.lang.String") + { + return String.valueOf(value); + } + + //Instead of throwing an IllegalArgumentException we will pass the value to the property + return value; + } + + public static BigInteger getBigInteger(Object value) + { + if (value instanceof BigInteger) + { + return (BigInteger)value; + } + + if (value instanceof BigDecimal) + { + return ((BigDecimal)value).toBigInteger(); + } + + if (value instanceof Number) + { + return BigInteger.valueOf(((Number)value).longValue()); + } + + if (value instanceof String) + { + return new BigInteger((String)value); + } + + if (value instanceof byte[]) + { + return new BigInteger((byte[])value); + } + + if (value == null) + { + return null; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to BigInteger"); + } + + public static Object getSetValue(Property property, BigInteger value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + EClassifier eType = eStructuralFeature.getEType(); + if (value == null) + { + return eType.getDefaultValue(); + } + + String name = eType.getInstanceClassName(); + if (name == "java.math.BigInteger") + { + return value; + } + + if (name == "java.math.BigDecimal") + { + return new BigDecimal(value); + } + + if (name == "java.lang.Byte" || name == "byte") + { + return new Byte(value.byteValue()); + } + + if (name == "java.lang.Double" || name == "double") + { + return new Double(value.doubleValue()); + } + + if (name == "java.lang.Float" || name == "float") + { + return new Float(value.floatValue()); + } + + if (name == "java.lang.Integer" || name == "int") + { + return new Integer(value.intValue()); + } + + if (name == "java.lang.Long" || name == "long") + { + return new Long(value.longValue()); + } + + if (name == "java.lang.Short" || name == "short") + { + return new Short(value.shortValue()); + } + + if (name == "java.lang.String") + { + return String.valueOf(value); + } + + if (name == "byte[]") + { + return value.toByteArray(); + } + + //Instead of throwing an IllegalArgumentException we will pass the value to the property + return value; + } + + public static boolean getBoolean(Object value) + { + if (value instanceof Boolean) + { + return ((Boolean)value).booleanValue(); + } + + if (value instanceof String) + { + return Boolean.valueOf((String)value).booleanValue(); + } + + if (value == null) + { + return false; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to boolean"); + } + + public static Object getSetValue(Property property, boolean value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + String name = eStructuralFeature.getEType().getInstanceClassName(); + if (name == "java.lang.Boolean" || name == "boolean") + { + return value ? Boolean.TRUE : Boolean.FALSE; + } + + if (name == "java.lang.String") + { + return String.valueOf(value); + } + + //Instead of throwing an IllegalArgumentException we will pass the value to the property + return value ? Boolean.TRUE : Boolean.FALSE; + } + + public static byte getByte(Object value) + { + if (value instanceof Number) + { + return ((Number)value).byteValue(); + } + + if (value instanceof String) + { + return Byte.parseByte((String)value); + } + + if (value == null) + { + return 0; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to byte"); + } + + public static Object getSetValue(Property property, byte value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + String name = eStructuralFeature.getEType().getInstanceClassName(); + if (name == "java.lang.Byte" || name == "byte") + { + return new Byte(value); + } + + if (name == "java.lang.Double" || name == "double") + { + return new Double(value); + } + + if (name == "java.lang.Float" || name == "float") + { + return new Float(value); + } + + if (name == "java.lang.Integer" || name == "int") + { + return new Integer(value); + } + + if (name == "java.lang.Long" || name == "long") + { + return new Long(value); + } + + if (name == "java.lang.Short" || name == "short") + { + return new Short(value); + } + + if (name == "java.math.BigDecimal") + { + return getBigDecimal(new Byte(value)); + } + + if (name == "java.math.BigInteger") + { + return getBigInteger(new Byte(value)); + } + + if (name == "java.lang.String") + { + return String.valueOf(value); + } + + //Instead of throwing an IllegalArgumentException we will pass the value to the property + return new Byte(value); + } + + public static byte[] getBytes(Object value) + { + if (value instanceof byte[]) + { + return (byte[])value; + } + + if (value instanceof BigInteger) + { + return ((BigInteger)value).toByteArray(); + } + + if (value == null) + { + return null; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to byte array"); + } + + public static Object getSetValue(Property property, byte[] value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + EClassifier eType = eStructuralFeature.getEType(); + if (value == null) + { + return eType.getDefaultValue(); + } + + String name = eType.getInstanceClassName(); + if (name == "byte[]") + { + return value; + } + + if (name == "java.math.BigInteger") + { + return new BigInteger(value); + } + + //Instead of throwing an IllegalArgumentException we will pass the value to the property + return value; + } + + public static char getChar(Object value) + { + if (value instanceof Character) + { + return ((Character)value).charValue(); + } + + if (value instanceof String) + { + return ((String)value).charAt(0); + } + + if (value == null) + { + return 0; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to char"); + } + + public static Object getSetValue(Property property, char value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + String name = eStructuralFeature.getEType().getInstanceClassName(); + if (name == "java.lang.Character" || name == "char") + { + return new Character(value); + } + + if (name == "java.lang.String") + { + return String.valueOf(value); + } + + //Instead of throwing an IllegalArgumentException we will pass the value to the property + return new Character(value); + } + + public static Date getDate(Object value) + { + if (value instanceof XMLCalendar) + { + return ((XMLCalendar)value).getDate(); + } + + if (value instanceof Date) + { + return (Date)value; + } + + if (value instanceof Long) + { + return new Date(((Long)value).longValue()); + } + + if (value == null) + { + return null; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to Date"); + } + + public static Object getSetValue(Property property, Date value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + EClassifier eType = eStructuralFeature.getEType(); + if (value == null) + { + return eType.getDefaultValue(); + } + + String name = eType.getInstanceClassName(); + if (name == "java.lang.Object") + { + String typeName = getDateTypeName((EDataType)eType); + if ("Date".equals(typeName)) + { + return new XMLCalendar(value, XMLCalendar.DATE); + } + if ("DateTime".equals(typeName)) + { + return new XMLCalendar(value, XMLCalendar.DATETIME); + } + // Instead of throwing an IllegalArgumentException we will pass the value to the property + return value; + } + + if (name == "java.lang.Long" || name == "long") + { + return new Long(value.getTime()); + } + if (name == "java.lang.String") + { + return value.toString(); + } + + // Instead of throwing an IllegalArgumentException we will pass the value to the property + return value; + } + + protected static String getDateTypeName(EDataType eDataType) + { + String name = eDataType.getName(); + if (("DateTime".equals(name)) || ("Date".equals(name))) + { + return name; + } + + EDataType baseType = ExtendedMetaData.INSTANCE.getBaseType(eDataType); + if (baseType != null) + { + return getDateTypeName(baseType); + } + + List memberTypes = ExtendedMetaData.INSTANCE.getMemberTypes(eDataType); + if (!memberTypes.isEmpty()) + { + for (int i = 0, size = memberTypes.size(); i < size; ++i) + { + EDataType memberType = (EDataType)memberTypes.get(i); + String memberTypeName = getDateTypeName(memberType); + if (("DateTime".equals(memberTypeName)) || ("Date".equals(memberTypeName))) + { + return memberTypeName; + } + } + } + + return ""; + } + + public static double getDouble(Object value) + { + if (value instanceof Number) + { + return ((Number)value).doubleValue(); + } + + if (value instanceof String) + { + return Double.parseDouble((String)value); + } + + if (value == null) + { + return 0; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to double"); + } + + public static Object getSetValue(Property property, double value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + String name = eStructuralFeature.getEType().getInstanceClassName(); + if (name == "java.lang.Byte" || name == "byte") + { + return new Byte((byte)value); + } + + if (name == "java.lang.Double" || name == "double") + { + return new Double(value); + } + + if (name == "java.lang.Float" || name == "float") + { + return new Float(value); + } + + if (name == "java.lang.Integer" || name == "int") + { + return new Integer((int)value); + } + + if (name == "java.lang.Long" || name == "long") + { + return new Long((long)value); + } + + if (name == "java.lang.Short" || name == "short") + { + return new Short((short)value); + } + + if (name == "java.math.BigDecimal") + { + return getBigDecimal(new Double(value)); + } + + if (name == "java.math.BigInteger") + { + return getBigInteger(new Double(value)); + } + + if (name == "java.lang.String") + { + return String.valueOf(value); + } + + //Instead of throwing an IllegalArgumentException we will pass the value to the property + return new Double(value); + } + + public static float getFloat(Object value) + { + if (value instanceof Number) + { + return ((Number)value).floatValue(); + } + + if (value instanceof String) + { + return Float.parseFloat((String)value); + } + + if (value == null) + { + return 0; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to float"); + } + + public static Object getSetValue(Property property, float value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + String name = eStructuralFeature.getEType().getInstanceClassName(); + if (name == "java.lang.Byte" || name == "byte") + { + return new Byte((byte)value); + } + + if (name == "java.lang.Double" || name == "double") + { + return new Double(value); + } + + if (name == "java.lang.Float" || name == "float") + { + return new Float(value); + } + + if (name == "java.lang.Integer" || name == "int") + { + return new Integer((int)value); + } + + if (name == "java.lang.Long" || name == "long") + { + return new Long((long)value); + } + + if (name == "java.lang.Short" || name == "short") + { + return new Short((short)value); + } + + if (name == "java.math.BigDecimal") + { + return getBigDecimal(new Float(value)); + } + + if (name == "java.math.BigInteger") + { + return getBigInteger(new Float(value)); + } + + if (name == "java.lang.String") + { + return String.valueOf(value); + } + + // Instead of throwing an IllegalArgumentException we will pass the value to the property + return new Float(value); + } + + public static int getInt(Object value) + { + if (value instanceof Number) + { + return ((Number)value).intValue(); + } + + if (value instanceof String) + { + return Integer.parseInt((String)value); + } + + if (value == null) + { + return 0; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to int"); + } + + public static Object getSetValue(Property property, int value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + String name = eStructuralFeature.getEType().getInstanceClassName(); + if (name == "java.lang.Byte" || name == "byte") + { + return new Byte((byte)value); + } + + if (name == "java.lang.Double" || name == "double") + { + return new Double(value); + } + + if (name == "java.lang.Float" || name == "float") + { + return new Float(value); + } + + if (name == "java.lang.Integer" || name == "int") + { + return new Integer(value); + } + + if (name == "java.lang.Long" || name == "long") + { + return new Long(value); + } + + if (name == "java.lang.Short" || name == "short") + { + return new Short((short)value); + } + + if (name == "java.math.BigDecimal") + { + return getBigDecimal(new Integer(value)); + } + + if (name == "java.math.BigInteger") + { + return getBigInteger(new Integer(value)); + } + + if (name == "java.lang.String") + { + return String.valueOf(value); + } + + // Instead of throwing an IllegalArgumentException we will pass the value to the property + return new Integer(value); + } + + public static long getLong(Object value) + { + if (value instanceof Number) + { + return ((Number)value).longValue(); + } + + if (value instanceof String) + { + return Long.parseLong((String)value); + } + + if (value instanceof Date) + { + return ((Date)value).getTime(); + } + + if (value == null) + { + return 0; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to long"); + } + + public static Object getSetValue(Property property, long value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + String name = eStructuralFeature.getEType().getInstanceClassName(); + if (name == "java.lang.Byte" || name == "byte") + { + return new Byte((byte)value); + } + + if (name == "java.lang.Double" || name == "double") + { + return new Double(value); + } + + if (name == "java.lang.Float" || name == "float") + { + return new Float(value); + } + + if (name == "java.lang.Integer" || name == "int") + { + return new Integer((int)value); + } + + if (name == "java.lang.Long" || name == "long") + { + return new Long(value); + } + + if (name == "java.lang.Short" || name == "short") + { + return new Short((short)value); + } + + if (name == "java.math.BigDecimal") + { + return getBigDecimal(new Long(value)); + } + + if (name == "java.math.BigInteger") + { + return getBigInteger(new Long(value)); + } + + if (name == "java.lang.String") + { + return String.valueOf(value); + } + + if (name == "java.util.Date") + { + return new Date(value); + } + + // Instead of throwing an IllegalArgumentException we will pass the value to the property + return new Long(value); + } + + public static short getShort(Object value) + { + if (value instanceof Number) + { + return ((Number)value).shortValue(); + } + + if (value instanceof String) + { + return Short.parseShort((String)value); + } + + if (value == null) + { + return 0; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to short"); + } + + public static Object getSetValue(Property property, short value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + String name = eStructuralFeature.getEType().getInstanceClassName(); + if (name == "java.lang.Byte" || name == "byte") + { + return new Byte((byte)value); + } + + if (name == "java.lang.Double" || name == "double") + { + return new Double(value); + } + + if (name == "java.lang.Float" || name == "float") + { + return new Float(value); + } + + if (name == "java.lang.Integer" || name == "int") + { + return new Integer(value); + } + + if (name == "java.lang.Long" || name == "long") + { + return new Long(value); + } + + if (name == "java.lang.Short" || name == "short") + { + return new Short(value); + } + + if (name == "java.math.BigDecimal") + { + return getBigDecimal(new Short(value)); + } + + if (name == "java.math.BigInteger") + { + return getBigInteger(new Short(value)); + } + + if (name == "java.lang.String") + { + return String.valueOf(value); + } + + // Instead of throwing an IllegalArgumentException we will pass the value to the property + return new Short(value); + } + + public static String getString(Object value) + { + if (value instanceof String) + { + return (String)value; + } + + if (value instanceof Number || value instanceof Boolean || value instanceof Character) + { + return String.valueOf(value); + } + + if (value == null) + { + return null; + } + + throw new IllegalArgumentException("The value of type '" + value.getClass().getName() + "' cannot be converted to String"); + } + + public static Object getSetValue(Property property, String value) + { + EStructuralFeature eStructuralFeature = (EStructuralFeature)property; + EClassifier eType = eStructuralFeature.getEType(); + if (value == null) + { + return eType.getDefaultValue(); + } + + String name = eType.getInstanceClassName(); + if (name == "java.lang.String") + { + return value; + } + + if (name == "java.lang.Byte" || name == "byte") + { + return Byte.valueOf(value); + } + + if (name == "java.lang.Double" || name == "double" || name == "java.lang.Number") + { + return Double.valueOf(value); + } + + if (name == "java.lang.Float" || name == "float") + { + return new Float(value); + } + + if (name == "java.lang.Integer" || name == "int") + { + return Integer.valueOf(value); + } + + if (name == "java.lang.Long" || name == "long") + { + return Long.valueOf(value); + } + + if (name == "java.lang.Short" || name == "short") + { + return Short.valueOf(value); + } + + if (name == "java.lang.Character" || name == "char") + { + return new Character(value.charAt(0)); + } + + if (name == "java.math.BigDecimal") + { + return getBigDecimal(value); + } + + if (name == "java.math.BigInteger") + { + return getBigInteger(value); + } + + if (name == "java.lang.Boolean" || name == "boolean") + { + return Boolean.valueOf(value); + } + + // Instead of throwing an IllegalArgumentException we will pass the value to the property + return value; + } + + public static EStructuralFeature getOpenFeature(EObject eObject, int featureID) + { + EClass eClass = eObject.eClass(); + int openFeatureCount = featureID - eClass.getFeatureCount(); + Set openFeatureSet = new HashSet(); + for (int i = 0, count = eClass.getEAllStructuralFeatures().size(); i < count; ++i) + { + EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i); + if (!eStructuralFeature.isDerived() && FeatureMapUtil.isFeatureMap(eStructuralFeature)) + { + List features = (List)eObject.eGet(eStructuralFeature); + for (int j = 0, size = features.size(); j < size; ++j) + { + FeatureMap.Entry entry = (FeatureMap.Entry)features.get(j); + EStructuralFeature entryFeature = entry.getEStructuralFeature(); + if (openFeatureSet.add(entryFeature)) + { + if (--openFeatureCount < 0) return entryFeature; + } + } + } + } + throw new IndexOutOfBoundsException(); + } + + public static EStructuralFeature getOpenFeature(EObject eObject, String featureName) + { + EClass eClass = eObject.eClass(); + Set openFeatureSet = new HashSet(); + for (int i = 0, count = eClass.getEAllStructuralFeatures().size(); i < count; ++i) + { + EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i); + if (/*!eStructuralFeature.isDerived() && */FeatureMapUtil.isFeatureMap(eStructuralFeature)) + { + List features = (List)eObject.eGet(eStructuralFeature); + for (int j = 0, size = features.size(); j < size; ++j) + { + FeatureMap.Entry entry = (FeatureMap.Entry)features.get(j); + EStructuralFeature entryFeature = entry.getEStructuralFeature(); + if (openFeatureSet.add(entryFeature)) + { + Property property = (Property)entryFeature; + if (property.getName().equals(featureName)) return entryFeature; + + List aliasNames = property.getAliasNames(); + for (int aliasCount = aliasNames.size(); aliasCount > 0; ) + { + if (aliasNames.get(--aliasCount).equals(featureName)) return entryFeature; + } + } + } + } + } + throw new IllegalArgumentException("Class '" + eObject.eClass().getName() + "' does not have a feature named '" + featureName + "'"); + } + + public static List getAliasNames(EStructuralFeature eStructuralFeature) + { + List list = SDOExtendedMetaData.INSTANCE.getAliasNames(eStructuralFeature); + if (list == null) { + list = new ArrayList(); + } + return list; + } + + public static List getAliasNames(EClassifier eClassifier) + { + List list = SDOExtendedMetaData.INSTANCE.getAliasNames(eClassifier); + if (list == null) { + list = new ArrayList(); + } + return list; + } + + /** + * Process the default EMF path and minimal XPath syntax. + * This design is still under review and construction. + * + * Syntax: + * + *
+   * path = /? (step '/')* step
+   * step = feature
+   *      | feature '.' index_from_0 
+   *      | feature '[' index_from_1 ']'
+   *      | reference '[' attribute '=' value ']'
+   *      | ..
+   *      | '@' step
+   *
+ * + * feature = the name of an attribute or reference + * attribute = the name of an attribute + * reference = the name of a reference + * index = positive integer + * value = the string value of an attribute + * leading / begins at the root + * .. is containing object + * + * features must be multi-valued to use '.' and '[' operations. + * Only the last step may have an attribute as the feature. + */ + public static final class Accessor //TODO rewrite this using SDO APIs + { + /** + * Creates an accessor for the path of the object. + */ + public static Accessor create(EObject eObject, String path) + { + Accessor result = pool.get(); + result.init(eObject, path); + return result; + } + + /** + * Only the get and recycle methods should be call; they are the only synchronized methods. + */ + protected static class Pool extends BasicEList + { + protected Accessor[] accessors; + + public Pool() + { + super(10); + } + + protected Object[] newData(int capacity) + { + return accessors = new Accessor [capacity]; + } + + /** + * Returns a recyled instance or a new instance. + */ + public synchronized Accessor get() + { + if (size > 0) + { + return accessors[--size]; + } + else + { + return new Accessor(); + } + } + + /** Safely gives the accessor back for recycled use. + */ + public synchronized void recycle(Accessor accessor) + { + int minimumCapacity = size + 1; + if (minimumCapacity > data.length) + { + grow(minimumCapacity); + } + accessors[size++] = accessor; + } + } + + /** + * A static thread safe pool of Accessors. + */ + static final Pool pool = new Pool(); + + protected static final int NO_INDEX = -1; + + protected EObject eObject; + + protected EStructuralFeature feature; + + protected int index; + + protected Accessor() + { + } + + protected Accessor(EObject eObject, String path) + { + init(eObject, path); + } + + protected void init(EObject eObject, String path) + { + this.eObject = eObject; + + // This should only be called with a path right now. + // + //feature = getType(eObject).getProperty(path).getEStructuralFeature(); + //if (feature == null) + { + process(path); + } + //else + { + //index = NO_INDEX; + } + } + + public Object get() + { + if (feature == null) + { + return eObject; + } + else + { + Object value = eObject.eGet(feature, true); + if (index >= 0) + { + value = ((List)value).get(index); + if (value instanceof FeatureMap.Entry) + { + value = ((FeatureMap.Entry)value).getValue(); + } + } + else if (FeatureMapUtil.isFeatureMap(feature)) + { + value = new BasicSequence((FeatureMap.Internal)value); + } + return value; + } + } + + public Object getAndRecyle() + { + Object result = get(); + pool.recycle(this); + return result; + } + + public void set(Object newValue) + { + if (index >= 0) + { + List list = (List)eObject.eGet(feature, true); + list.set(index, newValue); + } + else + { + // EATM newValue = string2Enum(feature, newValue); + eObject.eSet(feature, newValue); + } + } + + public void setAndRecyle(Object newValue) + { + set(newValue); + pool.recycle(this); + } + + public boolean isSet() + { + return eObject.eIsSet(feature); + } + + public boolean isSetAndRecyle() + { + boolean result = isSet(); + pool.recycle(this); + return result; + } + + public void unset() + { + eObject.eUnset(feature); + } + + public void unsetAndRecyle() + { + unset(); + pool.recycle(this); + } + + public void recycle() + { + pool.recycle(this); + } + + public EObject getEObject() + { + return eObject; + } + + protected void setEObject(EObject eObject) + { + this.eObject = eObject; + feature = null; + index = NO_INDEX; + } + + public EStructuralFeature getEStructuralFeature() + { + return feature; + } + + public Property getProperty() + { + return (Property)feature; + } + + protected void setFeatureName(String name) + { + if (name != null) + { + feature = (EStructuralFeature)((DataObject)eObject).getProperty(name); + } + else + { + feature = null; + } + index = NO_INDEX; + } + + protected int getIndex() + { + return index; + } + + protected void setIndex(int index) + { + this.index = index; + if (!FeatureMapUtil.isMany(eObject, feature)) + { + throw new IndexOutOfBoundsException("Index applies only to multi-valued features."); + } + } + + protected void process(String pathString) + { + TokenList tokens = new TokenList(pathString.toCharArray()); + String token; + int size = tokens.size(); + int x = 0; + + if ("/".equals(tokens.peek(0))) + { + setEObject(EcoreUtil.getRootContainer(eObject)); + x++; + } + + for (; x < size; x++) + { + token = tokens.peek(x); + char c = token.charAt(0); + if ('/' == c) + { + setEObject((EObject)get()); + } + else if ("..".equals(token)) + { + EObject container = eObject.eContainer(); + if (container == null) + { + throw new IllegalArgumentException("No containing object for " + eObject); + } + setEObject(container); + } + else if ('.' == c) + { + x++; // skip . + token = tokens.peek(x); + int index = Integer.parseInt(token); + setIndex(index); + } + else if ('[' == c) + { + x++; // skip [ + token = tokens.peek(x); // name or index + char following = tokens.peek(x + 1).charAt(0); + if ('=' != following) + { + int index = Integer.parseInt(token) - 1; + setIndex(index); + x++; // skip ] + } + else + { + x++; // done name + x++; // skip = + String attributeValue = tokens.peek(x); // value + if ("\"".equals(attributeValue)) + { + x++; // skip " + attributeValue = tokens.peek(++x); + } + x++; // skip ] + int index = matchingIndex((List)get(), token, attributeValue); + if (index < 0) + { + setEObject(null); + } + else + { + setIndex(index); + } + } + } + else if ('@' == c) + { + x++; // skip @ + } + else + { + setFeatureName(token); + } + } + } + + protected static int matchingIndex(List eObjects, String attributeName, String attributeValue) + { + for (int i = 0, size = eObjects.size(); i < size; i++) + { + EObject eObject = (EObject)eObjects.get(i); + EStructuralFeature feature = (EStructuralFeature)((Type)eObject.eClass()).getProperty(attributeName); + if (feature != null) + { + Object test = eObject.eGet(feature, true); + if (test != null) + { + String testString = EcoreUtil.convertToString((EDataType)feature.getEType(), test); + if (attributeValue.equals(testString)) + { + return i; + } + } + } + } + return -1; + } + + protected static class TokenList extends BasicEList + { + public TokenList(char[] path) + { + super(4); + + int pathLength = path.length; + StringBuffer token = new StringBuffer(); + char cPrev; + char c = 0; + char cNext; + char stringConstant = 0; + for (int pos = 0; pos < pathLength; pos++) + { + cPrev = c; + c = path[pos]; + cNext = pos < pathLength - 1 ? path[pos + 1] : 0; + + if (stringConstant != 0) + { + if (c == stringConstant) + { + endToken(token, true); + stringConstant = 0; + } + else + { + token.append(c); + } + } + else + { + switch (c) + { + case ' ': + case 0xA: + case 0xD: + case 0x9: + if (cPrev != ' ') + { + endToken(token, false); + } + c = ' '; + break; + + case '"': + case '\'': + endToken(token, false); + stringConstant = c; + break; + + // double or single tokens + case '/': + case ':': + case '.': + if (cPrev != c) + { + endToken(token, false); + } + token.append(c); + if (cNext != c) + { + endToken(token, false); + } + break; + + // single tokens + case '*': + case '@': + case '[': + case ']': + case '(': + case ')': + case '|': + endToken(token, false); + add(String.valueOf(c)); + break; + + // TODO: < > <= >= + - != + case '!': + endToken(token, false); + token.append(c); + break; + + case '=': + endToken(token, false); + add(String.valueOf(c)); + break; + + default: + token.append(c); + } + } + } + endToken(token, false); + } + + public String peek() + { + return size > 0 ? (String)data[0] : " "; + } + + public String peek(int index) + { + return index < size ? (String)data[index] : " "; + } + + public TokenList pop() + { + remove(0); + return this; + } + + public TokenList pop(int count) + { + while (count-- > 0) + { + remove(count); + } + return this; + } + + protected void endToken(StringBuffer token, boolean includeEmpty) + { + if (includeEmpty || token.length() > 0) + { + add(token.toString()); + } + token.setLength(0); + } + + protected boolean canContainNull() + { + return false; + } + + protected Object[] newData(int capacity) + { + return new String [capacity]; + } + } + + public String toString() + { + StringBuffer result = new StringBuffer("Accessor (object:"); + result.append(eObject == null ? "null" : eObject.toString()); + result.append(", feature:"); + result.append(feature == null ? "null" : feature.getName()); + result.append(", index:"); + result.append(index); + result.append(")"); + return result.toString(); + } + } + + public static Type getType(DataObject dataObject, String namespaceURI, String typeName) + { + DataGraph dataGraph = dataObject.getDataGraph(); + if (dataGraph != null) + { + return dataGraph.getType(namespaceURI, typeName); + } + else + { + //TODO think about where else to find the type + return TypeHelper.INSTANCE.getType(namespaceURI, typeName); + } + } + + public static Property getProperty(DataObject dataObject, String propertyName) + { + Property property = dataObject.getType().getProperty(propertyName); + if (property == null) + { + property = (Property)DataObjectUtil.getOpenFeature((EObject)dataObject, propertyName); + //throw new IllegalArgumentException("Type '" + dataObject.getType().getName() + "' does not have a property named '" + propertyName + "'"); + } + + return property; + } + + public static Property getProperty(DataObject dataObject, int propertyIndex) + { + List typeProperties = dataObject.getType().getProperties(); + + Property property = propertyIndex < typeProperties.size() ? + (Property)typeProperties.get(propertyIndex) : + (Property)dataObject.getInstanceProperties().get(propertyIndex); + + //FB maybe should catch bad index exception and throw IllegalArgumentException? + return property; + } + + public static Property getContainmentProperty(Property property) + { + if (property.isContainment()) + { + return property; + } + throw new IllegalArgumentException("The property '" + property.getName() + "' of '" + property.getContainingType().getName() + + "' isn't a containment"); + } + + public static DataObject create(Type type) + { + return (DataObject)EcoreUtil.create((EClass)type); + } + + public static ResourceSet createResourceSet() + { + ResourceSet result = new ResourceSetImpl(); + configureResourceSet(result); + return result; + } + + protected static Map registrations; + + protected static Map getRegistrations() + { + if (registrations == null) + { + Map result = new HashMap(); + + if (!(Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.datagraph")) instanceof DataGraphResourceFactoryImpl)) + { + result.put("datagraph", new DataGraphResourceFactoryImpl()); + } + if (!(Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.ecore")) instanceof EcoreResourceFactoryImpl)) + { + result.put("ecore", new EcoreResourceFactoryImpl()); + } + + if (!(Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.emof")) instanceof EMOFResourceFactoryImpl)) + { + result.put("emof", new EMOFResourceFactoryImpl()); + } + + if (Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.xsd")) == null) + { + result.put("xsd", new XSDResourceFactoryImpl()); + } + + //FIXME ClassCastException in XSDHelper.define() if you give it a WSDL file + // Patch for JIRA TUSCANY-42 + if (Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.wsdl")) == null) + { + result.put("wsdl", new XSDResourceFactoryImpl()); + } + + if (Resource.Factory.Registry.INSTANCE.getFactory(URI.createURI("*.*")) == null) + { + result.put("*", new XMLResourceFactoryImpl()); + } + + registrations = result; + } + + return registrations; + } + + protected static void configureResourceSet(ResourceSet resourceSet) + { + resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().putAll(getRegistrations()); + } + + public static EClass createDocumentRoot() + { + EClass documentRootEClass = EcoreFactory.eINSTANCE.createEClass(); + ExtendedMetaData.INSTANCE.setName(documentRootEClass, ""); + ExtendedMetaData.INSTANCE.setContentKind(documentRootEClass, ExtendedMetaData.MIXED_CONTENT); + + EAttribute mixed = EcoreFactory.eINSTANCE.createEAttribute(); + mixed.setName("mixed"); + mixed.setEType(EcorePackage.eINSTANCE.getEFeatureMapEntry()); + mixed.setUpperBound(EStructuralFeature.UNBOUNDED_MULTIPLICITY); + ExtendedMetaData.INSTANCE.setName(mixed, ":mixed"); + ExtendedMetaData.INSTANCE.setFeatureKind(mixed, ExtendedMetaData.ELEMENT_WILDCARD_FEATURE); + documentRootEClass.getEStructuralFeatures().add(mixed); + + EReference xmlnsPrefixMap = EcoreFactory.eINSTANCE.createEReference(); + xmlnsPrefixMap.setName("xMLNSPrefixMap"); + xmlnsPrefixMap.setEType(EcorePackage.eINSTANCE.getEStringToStringMapEntry()); + xmlnsPrefixMap.setUpperBound(EStructuralFeature.UNBOUNDED_MULTIPLICITY); + xmlnsPrefixMap.setContainment(true); + xmlnsPrefixMap.setTransient(true); + ExtendedMetaData.INSTANCE.setName(xmlnsPrefixMap, "xmlns:prefix"); + ExtendedMetaData.INSTANCE.setFeatureKind(xmlnsPrefixMap, ExtendedMetaData.ATTRIBUTE_FEATURE); + documentRootEClass.getEStructuralFeatures().add(xmlnsPrefixMap); + + EReference xsiSchemaLocation = EcoreFactory.eINSTANCE.createEReference(); + xsiSchemaLocation.setName("xSISchemaLocation"); + xsiSchemaLocation.setEType(EcorePackage.eINSTANCE.getEStringToStringMapEntry()); + xsiSchemaLocation.setUpperBound(EStructuralFeature.UNBOUNDED_MULTIPLICITY); + xsiSchemaLocation.setContainment(true); + xsiSchemaLocation.setTransient(true); + ExtendedMetaData.INSTANCE.setName(xsiSchemaLocation, "xsi:schemaLocation"); + ExtendedMetaData.INSTANCE.setFeatureKind(xsiSchemaLocation, ExtendedMetaData.ATTRIBUTE_FEATURE); + documentRootEClass.getEStructuralFeatures().add(xsiSchemaLocation); + + return documentRootEClass; + } + + /** + * Configure EMF to support the SDO runtime by registering a specialized Ecore factory, SDOEcoreFactory. + * This static initializion must run before any SDO metadata is created or loaded. + * As long as SDO helper classes (e.g., TypeHelper, XMLHelper, etc.) are accessed though their + * corresponding INSTANCE fields (e.g., TypeHelper.INSTANCE), or using the SDOUtil methods (e.g., + * SDOUtil.createTypeHelper(), this will always be the case. + */ + static + { + EPackage.Registry.INSTANCE.put(EcorePackage.eNS_URI, new EPackage.Descriptor() + { + public EPackage getEPackage() + { + return EcorePackage.eINSTANCE; + } + + public EFactory getEFactory() + { + return new SDOFactoryImpl.SDOEcoreFactory(); + } + }); + } + + public static void initRuntime() + { + // NOOP since init is done during static initialization of this class. See above. + } + + /* + public static Object get(org.apache.tuscany.sdo.model.Property property, int propertyIndex) { + switch(propertyIndex) + { + case ModelPackageImpl.PROPERTY__ALIAS_NAME: + return property.getAliasName(); + case ModelPackageImpl.PROPERTY__ANY: + return property.getAny(); + case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE: + return property.getAnyAttribute(); + case ModelPackageImpl.PROPERTY__CONTAINMENT: + return Boolean.valueOf(property.isContainment()); + case ModelPackageImpl.PROPERTY__DEFAULT: + return property.getDefault_(); + case ModelPackageImpl.PROPERTY__MANY: + return Boolean.valueOf(property.isMany()); + case ModelPackageImpl.PROPERTY__NAME: + return property.getName(); + case ModelPackageImpl.PROPERTY__OPPOSITE: + return property.getOpposite_(); + case ModelPackageImpl.PROPERTY__READ_ONLY: + return Boolean.valueOf(property.isReadOnly()); + case ModelPackageImpl.PROPERTY__TYPE: + return property.getType_(); + } + return null; + } + + public static boolean isSet(org.apache.tuscany.sdo.model.Property property, int propertyIndex) { + switch(propertyIndex) + { + case ModelPackageImpl.PROPERTY__ALIAS_NAME: + return !property.getAliasName().isEmpty(); + case ModelPackageImpl.PROPERTY__ANY: + return false; + case ModelPackageImpl.PROPERTY__ANY_ATTRIBUTE: + return false; + case ModelPackageImpl.PROPERTY__CONTAINMENT: + return property.isSetContainment(); + case ModelPackageImpl.PROPERTY__DEFAULT: + return property.getDefault_() != null; + case ModelPackageImpl.PROPERTY__MANY: + return property.isSetMany(); + case ModelPackageImpl.PROPERTY__NAME: + return property.getName() != null; + case ModelPackageImpl.PROPERTY__OPPOSITE: + return property.getOpposite_() != null; + case ModelPackageImpl.PROPERTY__READ_ONLY: + return property.isSetReadOnly(); + case ModelPackageImpl.PROPERTY__TYPE: + return property.getType_() != null; + } + return false; + } + + public static Object get(org.apache.tuscany.sdo.model.Type type, int propertyIndex) { + switch (propertyIndex) + { + case ModelPackageImpl.TYPE__BASE_TYPE: + return type.getBaseType(); + case ModelPackageImpl.TYPE__PROPERTY: + return type.getProperty(); + case ModelPackageImpl.TYPE__ALIAS_NAME: + return type.getAliasName(); + case ModelPackageImpl.TYPE__ANY: + return type.getAny(); + case ModelPackageImpl.TYPE__ABSTRACT: + return Boolean.valueOf(type.isAbstract()); + case ModelPackageImpl.TYPE__DATA_TYPE: + return Boolean.valueOf(type.isDataType()); + case ModelPackageImpl.TYPE__NAME: + return type.getName(); + case ModelPackageImpl.TYPE__OPEN: + return Boolean.valueOf(type.isOpen()); + case ModelPackageImpl.TYPE__SEQUENCED: + return Boolean.valueOf(type.isSequenced()); + case ModelPackageImpl.TYPE__URI: + return type.getUri(); + case ModelPackageImpl.TYPE__ANY_ATTRIBUTE: + return type.getAnyAttribute(); + } + return null; + } + + public static boolean isSet(org.apache.tuscany.sdo.model.Type type, int propertyIndex) { + //FB Note that this implementation has the undesirable effect of invoking lazy creation of feature lists + switch (propertyIndex) + { + case ModelPackageImpl.TYPE__BASE_TYPE: + return !type.getBaseType().isEmpty(); + case ModelPackageImpl.TYPE__PROPERTY: + return !type.getProperty().isEmpty(); + case ModelPackageImpl.TYPE__ALIAS_NAME: + return !type.getAliasName().isEmpty(); + case ModelPackageImpl.TYPE__ANY: + return false; + case ModelPackageImpl.TYPE__ABSTRACT: + return type.isSetAbstract(); + case ModelPackageImpl.TYPE__DATA_TYPE: + return type.isSetDataType(); + case ModelPackageImpl.TYPE__NAME: + return type.getName() != null; + case ModelPackageImpl.TYPE__OPEN: + return type.isSetOpen(); + case ModelPackageImpl.TYPE__SEQUENCED: + return type.isSetSequenced(); + case ModelPackageImpl.TYPE__URI: + return type.getUri() != null; + case ModelPackageImpl.TYPE__ANY_ATTRIBUTE: + return false; + } + return false; + } + */ + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java new file mode 100644 index 0000000000..834176bfab --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/SDOUtil.java @@ -0,0 +1,543 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.security.AccessController; +import java.security.PrivilegedExceptionAction; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.apache.tuscany.sdo.SDOExtendedMetaData; +import org.apache.tuscany.sdo.SDOFactory; +import org.apache.tuscany.sdo.SDOPackage; +import org.apache.tuscany.sdo.SimpleAnyTypeDataObject; +import org.apache.tuscany.sdo.helper.DataFactoryImpl; +import org.apache.tuscany.sdo.helper.SDOExtendedMetaDataImpl; +import org.apache.tuscany.sdo.helper.TypeHelperImpl; +import org.apache.tuscany.sdo.helper.XMLHelperImpl; +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.impl.DataGraphImpl; +import org.apache.tuscany.sdo.impl.DynamicDataObjectImpl; +import org.apache.tuscany.sdo.model.impl.ModelPackageImpl; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.ETypedElement; +import org.eclipse.emf.ecore.EcoreFactory; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.ExtendedMetaData; +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; + +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; + +/** + * This class provides some useful static utility functions which are not specified in the SDO + * specification itself. Use of the functions in this class is recommended, instead of resorting + * to low-level implementation-specific APIs. + */ +public final class SDOUtil +{ + /** + * Create a DataObject wrapper for an instance of the specified dataType. + * This method is typically used to create a root object that can be passed to the XMLHelper.save() + * method when the root element to be serialized is an XMLSchema simpleType. + * @param dataType a Type for which isDataType() returns true. + * @param value the instance value. + * @return a DataObject wrapper for the specified value. + */ + public static DataObject createDataTypeWrapper(Type dataType, Object value) + { + SimpleAnyTypeDataObject simpleAnyType = SDOFactory.eINSTANCE.createSimpleAnyTypeDataObject(); + simpleAnyType.setInstanceType((EDataType)dataType); + simpleAnyType.setValue(value); + return simpleAnyType; + } + + /** + * Creates an instance of a data type from the specified string. + * @param dataType a Type, for which isDataType() returns true, to instantiate. + * @param literal the string value of the dataType. + * @return an instance of the dataType. + * @see #convertToString(Type, Object) + */ + public static Object createFromString(Type dataType, String literal) + { + return EcoreUtil.createFromString((EDataType)dataType, literal); + } + + /** + * Converts an instance of a data type to a string literal representation. + * @param dataType the Type, for which isDataType() returns true, of the value to convert. + * @param value a value of the dataType. + * @return the string literal representation of the value. + * @see #createFromString(Type, String) + */ + public static String convertToString(Type dataType, Object value) + { + return EcoreUtil.convertToString((EDataType)dataType, value); + } + + /** + * Get the SDO built-in type corresponding to the specified XSD type in the XML Schema + * namespace ("http://www.w3.org/2001/XMLSchema"). + * @param xsdType a type name in the XML Schema namespace. + * @return the SDO built-in Type corresponding to the specified XSD type. + */ + public static Type getXSDSDOType(String xsdType) + { + Type type = null; + if ("anyType".equals(xsdType)) { + type = (Type)SDOPackage.eINSTANCE.getDataObject(); + } else { + String name = (String)xsdToSdoMappings.get(xsdType); + if (name != null) { + type = (Type)ModelPackageImpl.eINSTANCE.getEClassifier(name); + } else { + type = (Type)SDOExtendedMetaData.INSTANCE.getType(XMLTypePackage.eINSTANCE, xsdType); + } + } + return type; + } + + /** + * Get the SDO built-in type corresponding to the specified Java instanceClass. + * @param javaClass the Java instanceClass of the type. + * @return the SDO built-in Type corresponding to the specified instanceClass. + */ + public static Type getJavaSDOType(Class javaClass) + { + String name = (String)javaToSdoMappings.get(javaClass); + if (name != null) + { + return (Type)ModelPackageImpl.eINSTANCE.getEClassifier(name); + } + return null; + } + + /** + * Create an empty data graph. + * @return the new data graph instance. + */ + public static DataGraph createDataGraph() + { + return SDOFactory.eINSTANCE.createDataGraph(); + } + + /** + * Load a serialized data graph from the specified insputStream. + * @param inputStream the inputStream of the data graph. + * @param options loader control options, or null. + * @return the de-serialized data graph. + * @throws IOException + */ + public static DataGraph loadDataGraph(InputStream inputStream, Map options) throws IOException + { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + Resource resource = resourceSet.createResource(URI.createURI("all.datagraph")); + resource.load(inputStream, options); + return (DataGraph)resource.getContents().get(0); + } + + /** + * Serialize the specified data graph to the specified outputStream. + * @param dataGraph the data graph to save. + * @param outputStream the outputStream for the data graph. + * @param options serializer control options, or null. + * @throws IOException + */ + public static void saveDataGraph(DataGraph dataGraph, OutputStream outputStream, Map options) throws IOException + { + ((DataGraphImpl)dataGraph).getDataGraphResource().save(outputStream, options); + } + + /** + * Create a new TypeHelper instance. The returned type helper will have visibility of types registered + * directly by calling a define method on it or by calling define on an associated XSDHelper. It will + * also have visibility of static types registered by calling SDOUtil.registerStaticTypes in the + * same classLoader scope. + * @return the new TypeHelper. + */ + public static TypeHelper createTypeHelper() + { + EPackage.Registry registry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new SDOExtendedMetaDataImpl(registry); //TODO create subclass that makes demand() methods synchronous + return new TypeHelperImpl(extendedMetaData); + } + + /** + * Create a new DataFactory, with visibility to types in the specified TypeHelper scope. + * @param scope the TypeHelper to use for locating types. + * @return the new DataFactory. + */ + public static DataFactory createDataFactory(TypeHelper scope) + { + return new DataFactoryImpl(scope); + } + + /** + * Create a new XMLHelper, with visibility to types in the specified TypeHelper scope. + * @param scope the TypeHelper to use for locating types. + * @return the new XMLHelper. + */ + public static XMLHelper createXMLHelper(TypeHelper scope) + { + return new XMLHelperImpl(scope); + } + + /** + * Create a new XSDHelper, with visibility to types in the specified TypeHelper scope. + * @param scope the TypeHelper to use for locating and populating types. + * @return the new XSDHelper. + */ + public static XSDHelper createXSDHelper(TypeHelper scope) + { + return new XSDHelperImpl(scope); + } + + public static Type createType(TypeHelper scope, String uri, String name, boolean isDataType) + { + ExtendedMetaData extendedMetaData = ((TypeHelperImpl)scope).getExtendedMetaData(); + + EPackage ePackage = extendedMetaData.getPackage(uri); + if (ePackage == null) + { + ePackage = EcoreFactory.eINSTANCE.createEPackage(); + ePackage.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl()); + ePackage.setNsURI(uri); + String packagePrefix = URI.createURI(uri).trimFileExtension().lastSegment(); + ePackage.setName(packagePrefix); + ePackage.setNsPrefix(packagePrefix); + extendedMetaData.putPackage(uri, ePackage); + } + + EClassifier eClassifier = ePackage.getEClassifier(name); + if (eClassifier != null) + throw new IllegalArgumentException(); // already defined + + if (name != null) + { + eClassifier = isDataType ? (EClassifier)SDOFactory.eINSTANCE.createDataType() : (EClassifier)SDOFactory.eINSTANCE.createClass(); + eClassifier.setName(name); + } + else + { + eClassifier = DataObjectUtil.createDocumentRoot(); + } + + ePackage.getEClassifiers().add(eClassifier); + + return (Type)eClassifier; + } + + public static void addBaseType(Type type, Type baseType) + { + ((EClass)type).getESuperTypes().add(baseType); + } + + public static void addAliasName(Type type, String aliasName) + { + throw new UnsupportedOperationException(); // TODO: implement this method properly + //type.getAliasNames().add(aliasName); + } + + public static void setOpen(Type type, boolean isOpen) + { + if (isOpen == type.isOpen()) return; + + if (isOpen) + { + EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute(); + ((EClass)type).getEStructuralFeatures().add(eAttribute); + + eAttribute.setName("any"); + eAttribute.setUnique(false); + eAttribute.setUpperBound(ETypedElement.UNBOUNDED_MULTIPLICITY); + eAttribute.setEType(EcorePackage.eINSTANCE.getEFeatureMapEntry()); + ExtendedMetaData.INSTANCE.setFeatureKind(eAttribute, ExtendedMetaData.ELEMENT_WILDCARD_FEATURE); + ExtendedMetaData.INSTANCE.setProcessingKind(eAttribute, ExtendedMetaData.LAX_PROCESSING); + ExtendedMetaData.INSTANCE.setWildcards(eAttribute, Collections.singletonList("##any")); + + if (type.isSequenced()) { + eAttribute.setDerived(true); + eAttribute.setTransient(true); + eAttribute.setVolatile(true); + } + } + else + { + EClass eClass = (EClass)type; + EAttribute any = (EAttribute)eClass.getEStructuralFeature("any"); + eClass.getEStructuralFeatures().remove(any); + } + } + + public static void setSequenced(Type type, boolean isSequenced) + { + if (isSequenced == type.isSequenced()) return; + + // currently, we require setSequenced to be called first, before anything else is added to the type. + if (type.isDataType() || !type.getProperties().isEmpty()) + { + if (type.getName() != null) // document root is a special case + throw new IllegalArgumentException(); + } + + if (isSequenced) { + EClass eClass = (EClass)type; + ExtendedMetaData.INSTANCE.setContentKind(eClass, ExtendedMetaData.MIXED_CONTENT); + EAttribute mixedFeature = EcoreFactory.eINSTANCE.createEAttribute(); + mixedFeature.setName("mixed"); + mixedFeature.setUnique(false); + mixedFeature.setEType(EcorePackage.eINSTANCE.getEFeatureMapEntry()); + mixedFeature.setLowerBound(0); + mixedFeature.setUpperBound(-1); + eClass.getEStructuralFeatures().add(mixedFeature); + ExtendedMetaData.INSTANCE.setFeatureKind(mixedFeature, ExtendedMetaData.ELEMENT_WILDCARD_FEATURE); + ExtendedMetaData.INSTANCE.setName(mixedFeature, ":mixed"); + } + else + { + // nothing to do, because of current restriction that setSequence must be called first. + } + } + + public static void setAbstract(Type type, boolean isAbstract) + { + ((EClass)type).setAbstract(isAbstract); + } + + public static void setJavaClassName(Type type, String javaClassName) + { + ((EClassifier)type).setInstanceClassName(javaClassName); + } + + public static Property createProperty(Type containingType, String name, Type propertyType) + { + EStructuralFeature eStructuralFeature = propertyType.isDataType() ? (EStructuralFeature)SDOFactory.eINSTANCE.createAttribute() : (EStructuralFeature)SDOFactory.eINSTANCE.createReference(); + eStructuralFeature.setName(name); + eStructuralFeature.setEType((EClassifier)propertyType); + if (containingType.getName() == null) + { + ExtendedMetaData.INSTANCE.setFeatureKind(eStructuralFeature, ExtendedMetaData.ELEMENT_FEATURE); + } + ((EClass)containingType).getEStructuralFeatures().add(eStructuralFeature); + + if (containingType.isSequenced()) { + eStructuralFeature.setDerived(true); + eStructuralFeature.setTransient(true); + eStructuralFeature.setVolatile(true); + } + + return (Property)eStructuralFeature; + } + + public static void addAliasName(Property property, String aliasName) + { + throw new UnsupportedOperationException(); // TODO: implement this method properly + //property.getAliasNames().add(aliasName); + } + + public static void setMany(Property property, boolean isMany) + { + ((EStructuralFeature)property).setUpperBound(isMany ? EStructuralFeature.UNBOUNDED_MULTIPLICITY : 1); + } + + public static void setContainment(Property property, boolean isContainment) + { + ((EReference)property).setContainment(isContainment); + } + + public static void setDefault(Property property, String defaultValue) + { + ((EStructuralFeature)property).setDefaultValueLiteral(defaultValue); + } + + public static void setReadOnly(Property property, boolean isReadOnly) + { + ((EStructuralFeature)property).setChangeable(!isReadOnly); + } + + public static void setOpposite(Property property, Property opposite) + { + ((EReference)property).setEOpposite((EReference)opposite); + } + + /** + * Register and initialize the SDO types supported by the specified generated factory class. + * This function must be called before instances of the generated types can be created/used. + * The registered types will be visible in all TypeHelper's created in the same classLoader + * scope as the call to this function. + * @param factoryClass the generated factory class. + */ + public static void registerStaticTypes(Class factoryClass) + { + //TODO this implementation is temporary, until the SDO generated factory pattern is decided + // + String temp = factoryClass.getName().replaceFirst("Factory$", "PackageImpl"); + int lastDot = temp.lastIndexOf('.'); + String packageName = temp.substring(0, lastDot) + ".impl" + temp.substring(lastDot); + try // this case handles the current default generator pattern + { + Class javaClass = getPackageClass(factoryClass, packageName); + Field field = javaClass.getField("eINSTANCE"); + field.get(null); + } + catch (Exception e1) + { + packageName = factoryClass.getName().replaceFirst("Factory$", "Package"); + try // this case handles the -noInterfaces generator pattern + { + Class javaClass = getPackageClass(factoryClass, packageName); + Field field = javaClass.getField("eINSTANCE"); + field.get(null); + } + catch (Exception e2) + { + try // this case handles the -noEMF generator pattern + { + Field field = factoryClass.getField("INSTANCE"); + field.get(null); + } + catch (Exception e3) + { + e3.printStackTrace(); + } + } + } + } + + private static Class getPackageClass(Class factoryClass, String packageName) throws Exception + { + final Class factoryClassTemp = factoryClass; + final String packageNameTemp = packageName; + return (Class)AccessController.doPrivileged(new PrivilegedExceptionAction() { + public Object run() throws Exception { + return factoryClassTemp.getClassLoader().loadClass(packageNameTemp); + } + }); + } + + //Java instance class to SDO mappings (p.69 - p.71 of the SDO spec) + private static Map javaToSdoMappings = new HashMap(); + static { + javaToSdoMappings.put(boolean.class, "Boolean"); + javaToSdoMappings.put(byte.class, "Byte"); + javaToSdoMappings.put(char.class, "Character"); + javaToSdoMappings.put(Date.class, "Date"); + javaToSdoMappings.put(BigDecimal.class, "Decimal"); + javaToSdoMappings.put(double.class, "Double"); + javaToSdoMappings.put(float.class, "Float"); + javaToSdoMappings.put(int.class, "Int"); + javaToSdoMappings.put(BigInteger.class, "Integer"); + javaToSdoMappings.put(long.class, "Long"); + javaToSdoMappings.put(Object.class, "Object"); + javaToSdoMappings.put(short.class, "Short"); + javaToSdoMappings.put(String.class, "String"); + javaToSdoMappings.put(Boolean.class, "BooleanObject"); + javaToSdoMappings.put(Byte.class, "ByteObject"); + javaToSdoMappings.put(Character.class, "CharacterObject"); + javaToSdoMappings.put(Double.class, "DoubleObject"); + javaToSdoMappings.put(Float.class, "FloatObject"); + javaToSdoMappings.put(Integer.class, "IntObject"); + javaToSdoMappings.put(Long.class, "LongObject"); + javaToSdoMappings.put(Short.class, "ShortObject"); + } + + //XSD to SDO mappings (p.95 of the SDO spec) + private static Map xsdToSdoMappings = new HashMap(); + static { + xsdToSdoMappings.put("anySimpleType", "Object"); + xsdToSdoMappings.put("anyType", "DataObject"); + xsdToSdoMappings.put("anyURI", "URI"); + xsdToSdoMappings.put("base64Binary", "Bytes"); + xsdToSdoMappings.put("boolean", "Boolean"); + xsdToSdoMappings.put("byte", "Byte"); + xsdToSdoMappings.put("date", "YearMonthDay"); + xsdToSdoMappings.put("dateTime", "DateTime"); + xsdToSdoMappings.put("decimal", "Decimal"); + xsdToSdoMappings.put("double", "Double"); + xsdToSdoMappings.put("duration", "Duration"); + xsdToSdoMappings.put("ENTITIES", "Strings"); + xsdToSdoMappings.put("ENTITY", "String"); + xsdToSdoMappings.put("float", "Float"); + xsdToSdoMappings.put("gDay", "Day"); + xsdToSdoMappings.put("gMonth", "Month"); + xsdToSdoMappings.put("gMonthDay", "MonthDay"); + xsdToSdoMappings.put("gYear", "Year"); + xsdToSdoMappings.put("gYearMonth", "YearMonth"); + xsdToSdoMappings.put("hexBinary", "Bytes"); + xsdToSdoMappings.put("ID","String"); + xsdToSdoMappings.put("IDREF","String"); + xsdToSdoMappings.put("IDREFS","Strings"); + xsdToSdoMappings.put("int","Int"); + xsdToSdoMappings.put("integer","Integer"); + xsdToSdoMappings.put("language","String"); + xsdToSdoMappings.put("long","Long"); + xsdToSdoMappings.put("Name","String"); + xsdToSdoMappings.put("NCName","String"); + xsdToSdoMappings.put("negativeInteger","Integer"); + xsdToSdoMappings.put("NMTOKEN","String"); + xsdToSdoMappings.put("NMTOKENS","Strings"); + xsdToSdoMappings.put("nonNegativeInteger","Integer"); + xsdToSdoMappings.put("nonPositiveInteger","Integer"); + xsdToSdoMappings.put("normalizedString","String"); + xsdToSdoMappings.put("NOTATION","String"); + xsdToSdoMappings.put("positiveInteger","Integer"); + xsdToSdoMappings.put("QName","URI"); + xsdToSdoMappings.put("short","Short"); + xsdToSdoMappings.put("string","String"); + xsdToSdoMappings.put("time","Time"); + xsdToSdoMappings.put("token","String"); + xsdToSdoMappings.put("unsignedByte","Short"); + xsdToSdoMappings.put("unsignedInt","Long"); + xsdToSdoMappings.put("unsignedLong","Integer"); + xsdToSdoMappings.put("unsignedShort","Int"); + } + + /** + * Initialize SDO runtime. + */ + static + { + DataObjectUtil.initRuntime(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/StAX2SAXAdapter.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/StAX2SAXAdapter.java new file mode 100644 index 0000000000..858d445640 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/StAX2SAXAdapter.java @@ -0,0 +1,242 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util; + +import javax.xml.namespace.QName; +import javax.xml.stream.Location; +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.AttributesImpl; + +/** + * Adapter that converts from StAX to SAX event streams. + * Currently the following SAX events are not generated: + *
    + *
  • ignorableWhitespace
  • + *
  • skippedEntity
  • + *
      + * Also the following StAX events are not mapped: + *
        + *
      • CDATA
      • + *
      • COMMENT
      • + *
      • DTD
      • + *
      • ENTITY_DECLARATION
      • + *
      • ENTITY_REFERENCE
      • + *
      • NOTATION_DECLARATION
      • + *
      • SPACE
      • + *
      + * StAX ATTRIBUTE events are ignored but the equivalent attributes (derived from the START_ELEMENT event) + * are supplied in the SAX startElement event's Attributes parameter. If the adaptor is configured to + * pass namespace prefixes then namespace information will also be included in the Attributes; + * StAX NAMESPACE events are ignored. + * + * @version $Rev$ $Date$ + */ +public class StAX2SAXAdapter { + private final boolean namespacePrefixes; + + /** + * Construct a new StAX to SAX adapter that will convert a StAX event stream into a SAX event stream. + * + * @param namespacePrefixes whether xmlns attributes should be included in startElement events; + */ + public StAX2SAXAdapter(boolean namespacePrefixes) { + this.namespacePrefixes = namespacePrefixes; + } + + /** + * Pull events from the StAX stream and dispatch to the SAX ContentHandler. + * The StAX stream would typically be located on a START_DOCUMENT or START_ELEMENT event + * and when this method returns it will be located on the associated END_DOCUMENT or + * END_ELEMENT event. Behaviour with other start events is undefined. + * + * @param reader StAX event source to read + * @param handler SAX ContentHandler for processing events + * @throws XMLStreamException if there was a problem reading the stream + * @throws SAXException passed through from the ContentHandler + */ + public void parse(XMLStreamReader reader, ContentHandler handler) throws XMLStreamException, SAXException { + handler.setDocumentLocator(new LocatorAdaptor(reader.getLocation())); + + // remembers the nest level of elements to know when we are done + int level = 0; + int event = reader.getEventType(); + while (true) { + switch (event) { + case XMLStreamConstants.START_DOCUMENT: + level++; + handler.startDocument(); + break; + case XMLStreamConstants.START_ELEMENT: + level++; + handleStartElement(reader, handler); + break; + case XMLStreamConstants.PROCESSING_INSTRUCTION: + handler.processingInstruction(reader.getPITarget(), reader.getPIData()); + break; + case XMLStreamConstants.CHARACTERS: + char[] chars = reader.getTextCharacters(); + handler.characters(chars, 0, chars.length); + break; + case XMLStreamConstants.END_ELEMENT: + handleEndElement(reader, handler); + level--; + if (level == 0) { + return; + } + break; + case XMLStreamConstants.END_DOCUMENT: + handler.endDocument(); + return; +/* uncomment to handle all events rather than just mapped ones + // StAX events that are not mapped to SAX + case XMLStreamConstants.COMMENT: + case XMLStreamConstants.SPACE: + case XMLStreamConstants.ENTITY_REFERENCE: + case XMLStreamConstants.DTD: + case XMLStreamConstants.CDATA: + case XMLStreamConstants.NOTATION_DECLARATION: + case XMLStreamConstants.ENTITY_DECLARATION: + break; + // StAX events handled in START_ELEMENT + case XMLStreamConstants.ATTRIBUTE: + case XMLStreamConstants.NAMESPACE: + break; + default: + throw new AssertionError("Unknown StAX event: " + event); +*/ + } + event = reader.next(); + } + } + + private void handleStartElement(XMLStreamReader reader, ContentHandler handler) throws SAXException { + // send startPrefixMapping events immediately before startElement event + int nsCount = reader.getNamespaceCount(); + for (int i = 0; i < nsCount; i++) { + String prefix = reader.getNamespacePrefix(i); + if (prefix == null) { // true for default namespace + prefix = ""; + } + handler.startPrefixMapping(prefix, reader.getNamespaceURI(i)); + } + + // fire startElement + QName qname = reader.getName(); + String prefix = qname.getPrefix(); + String rawname; + if (prefix == null || prefix.length() == 0) { + rawname = qname.getLocalPart(); + } else { + rawname = prefix + ':' + qname.getLocalPart(); + } + Attributes attrs = getAttributes(reader); + handler.startElement(qname.getNamespaceURI(), qname.getLocalPart(), rawname, attrs); + } + + private static void handleEndElement(XMLStreamReader reader, ContentHandler handler) throws SAXException { + // fire endElement + QName qname = reader.getName(); + handler.endElement(qname.getNamespaceURI(), qname.getLocalPart(), qname.toString()); + + // send endPrefixMapping events immediately after endElement event + // we send them in the opposite order to that returned but this is not actually required by SAX + int nsCount = reader.getNamespaceCount(); + for (int i = nsCount - 1; i >= 0; i--) { + String prefix = reader.getNamespacePrefix(i); + if (prefix == null) { // true for default namespace + prefix = ""; + } + handler.endPrefixMapping(prefix); + } + } + + /** + * Get the attributes associated with the current START_ELEMENT event. + * + * @return the StAX attributes converted to org.xml.sax.Attributes + */ + private Attributes getAttributes(XMLStreamReader reader) { + assert reader.getEventType() == XMLStreamConstants.START_ELEMENT; + + AttributesImpl attrs = new AttributesImpl(); + + // add namespace declarations if required + if (namespacePrefixes) { + for (int i = 0; i < reader.getNamespaceCount(); i++) { + String prefix = reader.getNamespacePrefix(i); + String uri = reader.getNamespaceURI(i); + attrs.addAttribute(null, prefix, "xmlns:" + prefix, "CDATA", uri); + } + } + + // Regular attributes + for (int i = 0; i < reader.getAttributeCount(); i++) { + String uri = reader.getAttributeNamespace(i); + if (uri == null) { + uri = ""; + } + String localName = reader.getAttributeLocalName(i); + String prefix = reader.getAttributePrefix(i); + String qname; + if (prefix == null || prefix.length() == 0) { + qname = localName; + } else { + qname = prefix + ':' + localName; + } + String type = reader.getAttributeType(i); + String value = reader.getAttributeValue(i); + + attrs.addAttribute(uri, localName, qname, type, value); + } + + return attrs; + } + + /** + * Adaptor for mapping Locator information. + */ + private static class LocatorAdaptor implements Locator { + private final Location location; + + private LocatorAdaptor(Location location) { + this.location = location; + } + + public int getColumnNumber() { + return location.getColumnNumber(); + } + + public int getLineNumber() { + return location.getLineNumber(); + } + + public String getPublicId() { + return location.getPublicId(); + } + + public String getSystemId() { + return location.getSystemId(); + } + } +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/JavaMetaData.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/JavaMetaData.java new file mode 100644 index 0000000000..4dd00c075d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/JavaMetaData.java @@ -0,0 +1,85 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata; + + +/** + * + * A representation of the model object 'Java Meta Data'. + * + * + *

      + * The following features are supported: + *

        + *
      • {@link org.apache.tuscany.sdo.util.metadata.JavaMetaData#getFactoryInterface Factory Interface}
      • + *
      • {@link org.apache.tuscany.sdo.util.metadata.JavaMetaData#getTypeInterface Type Interface}
      • + *
      + *

      + * + * @generated + */ +public interface JavaMetaData +{ + /** + * Returns the value of the 'Factory Interface' attribute. + * + *

      + * If the meaning of the 'Factory Interface' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Factory Interface' attribute. + * @see #setFactoryInterface(String) + * @generated + */ + String getFactoryInterface(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.util.metadata.JavaMetaData#getFactoryInterface Factory Interface}' attribute. + * + * + * @param value the new value of the 'Factory Interface' attribute. + * @see #getFactoryInterface() + * @generated + */ + void setFactoryInterface(String value); + + /** + * Returns the value of the 'Type Interface' attribute. + * + *

      + * If the meaning of the 'Type Interface' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Type Interface' attribute. + * @see #setTypeInterface(String) + * @generated + */ + String getTypeInterface(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.util.metadata.JavaMetaData#getTypeInterface Type Interface}' attribute. + * + * + * @param value the new value of the 'Type Interface' attribute. + * @see #getTypeInterface() + * @generated + */ + void setTypeInterface(String value); + +} // JavaMetaData \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/MetadataFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/MetadataFactory.java new file mode 100644 index 0000000000..e2c33713d3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/MetadataFactory.java @@ -0,0 +1,73 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface MetadataFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + MetadataFactory INSTANCE = org.apache.tuscany.sdo.util.metadata.impl.MetadataFactoryImpl.eINSTANCE; + + /** + * Returns a new object of class 'Java Meta Data'. + * + * + * @return a new object of class 'Java Meta Data'. + * @generated + */ + JavaMetaData createJavaMetaData(); + + /** + * Returns a new object of class 'SDO Meta Data Group'. + * + * + * @return a new object of class 'SDO Meta Data Group'. + * @generated + */ + SDOMetaDataGroup createSDOMetaDataGroup(); + + /** + * Returns a new object of class 'Type Meta Data'. + * + * + * @return a new object of class 'Type Meta Data'. + * @generated + */ + TypeMetaData createTypeMetaData(); + + /** + * Returns a new object of class 'XSD Meta Data'. + * + * + * @return a new object of class 'XSD Meta Data'. + * @generated + */ + XSDMetaData createXSDMetaData(); + +} //MetadataFactory diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/SDOMetaDataGroup.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/SDOMetaDataGroup.java new file mode 100644 index 0000000000..7cbeeda682 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/SDOMetaDataGroup.java @@ -0,0 +1,86 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata; + +import java.util.List; + +import commonj.sdo.helper.TypeHelper; + +/** + * + * A representation of the model object 'SDO Meta Data Group'. + * + * + *

      + * The following features are supported: + *

        + *
      • {@link org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup#getJavaMetaData Java Meta Data}
      • + *
      • {@link org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup#getXsdMetaData Xsd Meta Data}
      • + *
      • {@link org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup#getTypeMetaData Type Meta Data}
      • + *
      + *

      + * + * @generated + */ +public interface SDOMetaDataGroup +{ + /** + * Returns the value of the 'Java Meta Data' containment reference list. + * The list contents are of type {@link org.apache.tuscany.sdo.util.metadata.JavaMetaData}. + * + *

      + * If the meaning of the 'Java Meta Data' containment reference list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Java Meta Data' containment reference list. + * @generated + */ + List getJavaMetaData(); + + /** + * Returns the value of the 'Xsd Meta Data' containment reference list. + * The list contents are of type {@link org.apache.tuscany.sdo.util.metadata.XSDMetaData}. + * + *

      + * If the meaning of the 'Xsd Meta Data' containment reference list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Xsd Meta Data' containment reference list. + * @generated + */ + List getXsdMetaData(); + + /** + * Returns the value of the 'Type Meta Data' containment reference list. + * The list contents are of type {@link org.apache.tuscany.sdo.util.metadata.TypeMetaData}. + * + *

      + * If the meaning of the 'Type Meta Data' containment reference list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Type Meta Data' containment reference list. + * @generated + */ + List getTypeMetaData(); + + void register(TypeHelper scope); + void register(TypeHelper scope, ClassLoader classLoader); + +} // SDOMetaDataGroup \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/TypeMetaData.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/TypeMetaData.java new file mode 100644 index 0000000000..bc311015ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/TypeMetaData.java @@ -0,0 +1,60 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata; + + +/** + * + * A representation of the model object 'Type Meta Data'. + * + * + *

      + * The following features are supported: + *

        + *
      • {@link org.apache.tuscany.sdo.util.metadata.TypeMetaData#getLocation Location}
      • + *
      + *

      + * + * @generated + */ +public interface TypeMetaData +{ + /** + * Returns the value of the 'Location' attribute. + * + *

      + * If the meaning of the 'Location' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Location' attribute. + * @see #setLocation(String) + * @generated + */ + String getLocation(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.util.metadata.TypeMetaData#getLocation Location}' attribute. + * + * + * @param value the new value of the 'Location' attribute. + * @see #getLocation() + * @generated + */ + void setLocation(String value); + +} // TypeMetaData \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/XSDMetaData.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/XSDMetaData.java new file mode 100644 index 0000000000..dc004a8f5e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/XSDMetaData.java @@ -0,0 +1,60 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata; + + +/** + * + * A representation of the model object 'XSD Meta Data'. + * + * + *

      + * The following features are supported: + *

        + *
      • {@link org.apache.tuscany.sdo.util.metadata.XSDMetaData#getLocation Location}
      • + *
      + *

      + * + * @generated + */ +public interface XSDMetaData +{ + /** + * Returns the value of the 'Location' attribute. + * + *

      + * If the meaning of the 'Location' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Location' attribute. + * @see #setLocation(String) + * @generated + */ + String getLocation(); + + /** + * Sets the value of the '{@link org.apache.tuscany.sdo.util.metadata.XSDMetaData#getLocation Location}' attribute. + * + * + * @param value the new value of the 'Location' attribute. + * @see #getLocation() + * @generated + */ + void setLocation(String value); + +} // XSDMetaData \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/JavaMetaDataImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/JavaMetaDataImpl.java new file mode 100644 index 0000000000..b36d7fa8f9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/JavaMetaDataImpl.java @@ -0,0 +1,241 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata.impl; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.apache.tuscany.sdo.util.metadata.JavaMetaData; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +/** + * + * An implementation of the model object 'Java Meta Data'. + * + *

      + * The following features are implemented: + *

        + *
      • {@link org.apache.tuscany.sdo.util.metadata.impl.JavaMetaDataImpl#getFactoryInterface Factory Interface}
      • + *
      • {@link org.apache.tuscany.sdo.util.metadata.impl.JavaMetaDataImpl#getTypeInterface Type Interface}
      • + *
      + *

      + * + * @generated + */ +public class JavaMetaDataImpl extends DataObjectImpl implements JavaMetaData +{ + /** + * The default value of the '{@link #getFactoryInterface() Factory Interface}' attribute. + * + * + * @see #getFactoryInterface() + * @generated + * @ordered + */ + protected static final String FACTORY_INTERFACE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getFactoryInterface() Factory Interface}' attribute. + * + * + * @see #getFactoryInterface() + * @generated + * @ordered + */ + protected String factoryInterface = FACTORY_INTERFACE_EDEFAULT; + + /** + * The default value of the '{@link #getTypeInterface() Type Interface}' attribute. + * + * + * @see #getTypeInterface() + * @generated + * @ordered + */ + protected static final String TYPE_INTERFACE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getTypeInterface() Type Interface}' attribute. + * + * + * @see #getTypeInterface() + * @generated + * @ordered + */ + protected String typeInterface = TYPE_INTERFACE_EDEFAULT; + + /** + * + * + * @generated + */ + protected JavaMetaDataImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return MetadataPackageImpl.Literals.JAVA_META_DATA; + } + + /** + * + * + * @generated + */ + public String getFactoryInterface() + { + return factoryInterface; + } + + /** + * + * + * @generated + */ + public void setFactoryInterface(String newFactoryInterface) + { + String oldFactoryInterface = factoryInterface; + factoryInterface = newFactoryInterface; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackageImpl.JAVA_META_DATA__FACTORY_INTERFACE, oldFactoryInterface, factoryInterface)); + } + + /** + * + * + * @generated + */ + public String getTypeInterface() + { + return typeInterface; + } + + /** + * + * + * @generated + */ + public void setTypeInterface(String newTypeInterface) + { + String oldTypeInterface = typeInterface; + typeInterface = newTypeInterface; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackageImpl.JAVA_META_DATA__TYPE_INTERFACE, oldTypeInterface, typeInterface)); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case MetadataPackageImpl.JAVA_META_DATA__FACTORY_INTERFACE: + return getFactoryInterface(); + case MetadataPackageImpl.JAVA_META_DATA__TYPE_INTERFACE: + return getTypeInterface(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case MetadataPackageImpl.JAVA_META_DATA__FACTORY_INTERFACE: + setFactoryInterface((String)newValue); + return; + case MetadataPackageImpl.JAVA_META_DATA__TYPE_INTERFACE: + setTypeInterface((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case MetadataPackageImpl.JAVA_META_DATA__FACTORY_INTERFACE: + setFactoryInterface(FACTORY_INTERFACE_EDEFAULT); + return; + case MetadataPackageImpl.JAVA_META_DATA__TYPE_INTERFACE: + setTypeInterface(TYPE_INTERFACE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case MetadataPackageImpl.JAVA_META_DATA__FACTORY_INTERFACE: + return FACTORY_INTERFACE_EDEFAULT == null ? factoryInterface != null : !FACTORY_INTERFACE_EDEFAULT.equals(factoryInterface); + case MetadataPackageImpl.JAVA_META_DATA__TYPE_INTERFACE: + return TYPE_INTERFACE_EDEFAULT == null ? typeInterface != null : !TYPE_INTERFACE_EDEFAULT.equals(typeInterface); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (factoryInterface: "); + result.append(factoryInterface); + result.append(", typeInterface: "); + result.append(typeInterface); + result.append(')'); + return result.toString(); + } + +} //JavaMetaDataImpl \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/MetadataFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/MetadataFactoryImpl.java new file mode 100644 index 0000000000..e0e24fc9c2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/MetadataFactoryImpl.java @@ -0,0 +1,174 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata.impl; + +import org.apache.tuscany.sdo.util.metadata.*; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class MetadataFactoryImpl extends EFactoryImpl implements MetadataFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + public static final MetadataFactoryImpl eINSTANCE = init(); + + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static MetadataFactoryImpl init() + { + try + { + MetadataFactoryImpl theMetadataFactory = (MetadataFactoryImpl)EPackage.Registry.INSTANCE.getEFactory("org.apache.tuscany.sdo/metadata"); + if (theMetadataFactory != null) + { + return theMetadataFactory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new MetadataFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public MetadataFactoryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public EObject create(EClass eClass) + { + switch (eClass.getClassifierID()) + { + case MetadataPackageImpl.DOCUMENT_ROOT: return (EObject)createDocumentRoot(); + case MetadataPackageImpl.JAVA_META_DATA: return (EObject)createJavaMetaData(); + case MetadataPackageImpl.SDO_META_DATA_GROUP: return (EObject)createSDOMetaDataGroup(); + case MetadataPackageImpl.TYPE_META_DATA: return (EObject)createTypeMetaData(); + case MetadataPackageImpl.XSD_META_DATA: return (EObject)createXSDMetaData(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public EObject createDocumentRoot() + { + EObject documentRoot = super.create(MetadataPackageImpl.Literals.DOCUMENT_ROOT); + return documentRoot; + } + + /** + * + * + * @generated + */ + public JavaMetaData createJavaMetaData() + { + JavaMetaDataImpl javaMetaData = new JavaMetaDataImpl(); + return javaMetaData; + } + + /** + * + * + * @generated + */ + public SDOMetaDataGroup createSDOMetaDataGroup() + { + SDOMetaDataGroupImpl sdoMetaDataGroup = new SDOMetaDataGroupImpl(); + return sdoMetaDataGroup; + } + + /** + * + * + * @generated + */ + public TypeMetaData createTypeMetaData() + { + TypeMetaDataImpl typeMetaData = new TypeMetaDataImpl(); + return typeMetaData; + } + + /** + * + * + * @generated + */ + public XSDMetaData createXSDMetaData() + { + XSDMetaDataImpl xsdMetaData = new XSDMetaDataImpl(); + return xsdMetaData; + } + + /** + * + * + * @generated + */ + public MetadataPackageImpl getMetadataPackageImpl() + { + return (MetadataPackageImpl)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + public static MetadataPackageImpl getPackage() + { + return MetadataPackageImpl.eINSTANCE; + } + +} //MetadataFactoryImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/MetadataPackageImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/MetadataPackageImpl.java new file mode 100644 index 0000000000..df1404ddd9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/MetadataPackageImpl.java @@ -0,0 +1,1015 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata.impl; + +import org.apache.tuscany.sdo.impl.SDOPackageImpl; + +import org.apache.tuscany.sdo.model.impl.ModelPackageImpl; + +import org.apache.tuscany.sdo.util.metadata.JavaMetaData; +import org.apache.tuscany.sdo.util.metadata.MetadataFactory; +import org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup; +import org.apache.tuscany.sdo.util.metadata.TypeMetaData; +import org.apache.tuscany.sdo.util.metadata.XSDMetaData; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
        + *
      • each class,
      • + *
      • each feature of each class,
      • + *
      • each enum,
      • + *
      • and each data type
      • + *
      + * + * @see org.apache.tuscany.sdo.util.metadata.MetadataFactory + * @generated + */ +public class MetadataPackageImpl extends EPackageImpl +{ + /** + * The package name. + * + * + * @generated + */ + public static final String eNAME = "metadata"; + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String eNS_URI = "org.apache.tuscany.sdo/metadata"; + + /** + * The package namespace name. + * + * + * @generated + */ + public static final String eNS_PREFIX = "metadata"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + public static final MetadataPackageImpl eINSTANCE = org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl.init(); + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.util.metadata.impl.DocumentRootImpl Document Root}' class. + * + * + * @see org.apache.tuscany.sdo.util.metadata.impl.DocumentRootImpl + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#getDocumentRoot() + * @generated + */ + public static final int DOCUMENT_ROOT = 0; + + /** + * The feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__MIXED = 0; + + /** + * The feature id for the 'XMLNS Prefix Map' map. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__XMLNS_PREFIX_MAP = 1; + + /** + * The feature id for the 'XSI Schema Location' map. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = 2; + + /** + * The feature id for the 'Sdo Meta Data Group' containment reference. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__SDO_META_DATA_GROUP = 3; + + /** + * The number of structural features of the 'Document Root' class. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.util.metadata.impl.JavaMetaDataImpl Java Meta Data}' class. + * + * + * @see org.apache.tuscany.sdo.util.metadata.impl.JavaMetaDataImpl + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#getJavaMetaData() + * @generated + */ + public static final int JAVA_META_DATA = 1; + + /** + * The feature id for the 'Factory Interface' attribute. + * + * + * @generated + * @ordered + */ + public static final int JAVA_META_DATA__FACTORY_INTERFACE = 0; + + /** + * The feature id for the 'Type Interface' attribute. + * + * + * @generated + * @ordered + */ + public static final int JAVA_META_DATA__TYPE_INTERFACE = 1; + + /** + * The number of structural features of the 'Java Meta Data' class. + * + * + * @generated + * @ordered + */ + public static final int JAVA_META_DATA_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.util.metadata.impl.SDOMetaDataGroupImpl SDO Meta Data Group}' class. + * + * + * @see org.apache.tuscany.sdo.util.metadata.impl.SDOMetaDataGroupImpl + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#getSDOMetaDataGroup() + * @generated + */ + public static final int SDO_META_DATA_GROUP = 2; + + /** + * The feature id for the 'Java Meta Data' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int SDO_META_DATA_GROUP__JAVA_META_DATA = 0; + + /** + * The feature id for the 'Xsd Meta Data' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int SDO_META_DATA_GROUP__XSD_META_DATA = 1; + + /** + * The feature id for the 'Type Meta Data' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int SDO_META_DATA_GROUP__TYPE_META_DATA = 2; + + /** + * The number of structural features of the 'SDO Meta Data Group' class. + * + * + * @generated + * @ordered + */ + public static final int SDO_META_DATA_GROUP_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.util.metadata.impl.TypeMetaDataImpl Type Meta Data}' class. + * + * + * @see org.apache.tuscany.sdo.util.metadata.impl.TypeMetaDataImpl + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#getTypeMetaData() + * @generated + */ + public static final int TYPE_META_DATA = 3; + + /** + * The feature id for the 'Location' attribute. + * + * + * @generated + * @ordered + */ + public static final int TYPE_META_DATA__LOCATION = 0; + + /** + * The number of structural features of the 'Type Meta Data' class. + * + * + * @generated + * @ordered + */ + public static final int TYPE_META_DATA_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.apache.tuscany.sdo.util.metadata.impl.XSDMetaDataImpl XSD Meta Data}' class. + * + * + * @see org.apache.tuscany.sdo.util.metadata.impl.XSDMetaDataImpl + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#getXSDMetaData() + * @generated + */ + public static final int XSD_META_DATA = 4; + + /** + * The feature id for the 'Location' attribute. + * + * + * @generated + * @ordered + */ + public static final int XSD_META_DATA__LOCATION = 0; + + /** + * The number of structural features of the 'XSD Meta Data' class. + * + * + * @generated + * @ordered + */ + public static final int XSD_META_DATA_FEATURE_COUNT = 1; + + /** + * + * + * @generated + */ + private EClass documentRootEClass = null; + + /** + * + * + * @generated + */ + private EClass javaMetaDataEClass = null; + + /** + * + * + * @generated + */ + private EClass sdoMetaDataGroupEClass = null; + + /** + * + * + * @generated + */ + private EClass typeMetaDataEClass = null; + + /** + * + * + * @generated + */ + private EClass xsdMetaDataEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

      Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#eNS_URI + * @see #init() + * @generated + */ + private MetadataPackageImpl() + { + super(eNS_URI, ((EFactory)MetadataFactory.INSTANCE)); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + *

      Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + *

      Invocation of this method will not affect any packages that have + * already been initialized. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static MetadataPackageImpl init() + { + if (isInited) return (MetadataPackageImpl)EPackage.Registry.INSTANCE.getEPackage(MetadataPackageImpl.eNS_URI); + + // Obtain or create and register package + MetadataPackageImpl theMetadataPackageImpl = (MetadataPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof MetadataPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new MetadataPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + SDOPackageImpl.eINSTANCE.eClass(); + ModelPackageImpl.eINSTANCE.eClass(); + + // Create package meta-data objects + theMetadataPackageImpl.createPackageContents(); + + // Initialize created meta-data + theMetadataPackageImpl.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theMetadataPackageImpl.freeze(); + + return theMetadataPackageImpl; + } + + + /** + * Returns the meta object for class '{@link org.eclipse.emf.ecore.EObject Document Root}'. + * + * + * @return the meta object for class 'Document Root'. + * @see org.eclipse.emf.ecore.EObject + * @generated + */ + public EClass getDocumentRoot() + { + return documentRootEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.eclipse.emf.ecore.EObject#getMixed Mixed}'. + * + * + * @return the meta object for the attribute list 'Mixed'. + * @see org.eclipse.emf.ecore.EObject#getMixed() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_Mixed() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap XMLNS Prefix Map}'. + * + * + * @return the meta object for the map 'XMLNS Prefix Map'. + * @see org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_XMLNSPrefixMap() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXSISchemaLocation XSI Schema Location}'. + * + * + * @return the meta object for the map 'XSI Schema Location'. + * @see org.eclipse.emf.ecore.EObject#getXSISchemaLocation() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_XSISchemaLocation() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.emf.ecore.EObject#getSdoMetaDataGroup Sdo Meta Data Group}'. + * + * + * @return the meta object for the containment reference 'Sdo Meta Data Group'. + * @see org.eclipse.emf.ecore.EObject#getSdoMetaDataGroup() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_SdoMetaDataGroup() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.util.metadata.JavaMetaData Java Meta Data}'. + * + * + * @return the meta object for class 'Java Meta Data'. + * @see org.apache.tuscany.sdo.util.metadata.JavaMetaData + * @generated + */ + public EClass getJavaMetaData() + { + return javaMetaDataEClass; + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.util.metadata.JavaMetaData#getFactoryInterface Factory Interface}'. + * + * + * @return the meta object for the attribute 'Factory Interface'. + * @see org.apache.tuscany.sdo.util.metadata.JavaMetaData#getFactoryInterface() + * @see #getJavaMetaData() + * @generated + */ + public EAttribute getJavaMetaData_FactoryInterface() + { + return (EAttribute)javaMetaDataEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.util.metadata.JavaMetaData#getTypeInterface Type Interface}'. + * + * + * @return the meta object for the attribute 'Type Interface'. + * @see org.apache.tuscany.sdo.util.metadata.JavaMetaData#getTypeInterface() + * @see #getJavaMetaData() + * @generated + */ + public EAttribute getJavaMetaData_TypeInterface() + { + return (EAttribute)javaMetaDataEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup SDO Meta Data Group}'. + * + * + * @return the meta object for class 'SDO Meta Data Group'. + * @see org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup + * @generated + */ + public EClass getSDOMetaDataGroup() + { + return sdoMetaDataGroupEClass; + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup#getJavaMetaData Java Meta Data}'. + * + * + * @return the meta object for the containment reference list 'Java Meta Data'. + * @see org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup#getJavaMetaData() + * @see #getSDOMetaDataGroup() + * @generated + */ + public EReference getSDOMetaDataGroup_JavaMetaData() + { + return (EReference)sdoMetaDataGroupEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup#getXsdMetaData Xsd Meta Data}'. + * + * + * @return the meta object for the containment reference list 'Xsd Meta Data'. + * @see org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup#getXsdMetaData() + * @see #getSDOMetaDataGroup() + * @generated + */ + public EReference getSDOMetaDataGroup_XsdMetaData() + { + return (EReference)sdoMetaDataGroupEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the containment reference list '{@link org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup#getTypeMetaData Type Meta Data}'. + * + * + * @return the meta object for the containment reference list 'Type Meta Data'. + * @see org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup#getTypeMetaData() + * @see #getSDOMetaDataGroup() + * @generated + */ + public EReference getSDOMetaDataGroup_TypeMetaData() + { + return (EReference)sdoMetaDataGroupEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.util.metadata.TypeMetaData Type Meta Data}'. + * + * + * @return the meta object for class 'Type Meta Data'. + * @see org.apache.tuscany.sdo.util.metadata.TypeMetaData + * @generated + */ + public EClass getTypeMetaData() + { + return typeMetaDataEClass; + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.util.metadata.TypeMetaData#getLocation Location}'. + * + * + * @return the meta object for the attribute 'Location'. + * @see org.apache.tuscany.sdo.util.metadata.TypeMetaData#getLocation() + * @see #getTypeMetaData() + * @generated + */ + public EAttribute getTypeMetaData_Location() + { + return (EAttribute)typeMetaDataEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for class '{@link org.apache.tuscany.sdo.util.metadata.XSDMetaData XSD Meta Data}'. + * + * + * @return the meta object for class 'XSD Meta Data'. + * @see org.apache.tuscany.sdo.util.metadata.XSDMetaData + * @generated + */ + public EClass getXSDMetaData() + { + return xsdMetaDataEClass; + } + + /** + * Returns the meta object for the attribute '{@link org.apache.tuscany.sdo.util.metadata.XSDMetaData#getLocation Location}'. + * + * + * @return the meta object for the attribute 'Location'. + * @see org.apache.tuscany.sdo.util.metadata.XSDMetaData#getLocation() + * @see #getXSDMetaData() + * @generated + */ + public EAttribute getXSDMetaData_Location() + { + return (EAttribute)xsdMetaDataEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + public MetadataFactory getMetadataFactory() + { + return (MetadataFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + documentRootEClass = createEClass(DOCUMENT_ROOT); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__MIXED); + createEReference(documentRootEClass, DOCUMENT_ROOT__XMLNS_PREFIX_MAP); + createEReference(documentRootEClass, DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); + createEReference(documentRootEClass, DOCUMENT_ROOT__SDO_META_DATA_GROUP); + + javaMetaDataEClass = createEClass(JAVA_META_DATA); + createEAttribute(javaMetaDataEClass, JAVA_META_DATA__FACTORY_INTERFACE); + createEAttribute(javaMetaDataEClass, JAVA_META_DATA__TYPE_INTERFACE); + + sdoMetaDataGroupEClass = createEClass(SDO_META_DATA_GROUP); + createEReference(sdoMetaDataGroupEClass, SDO_META_DATA_GROUP__JAVA_META_DATA); + createEReference(sdoMetaDataGroupEClass, SDO_META_DATA_GROUP__XSD_META_DATA); + createEReference(sdoMetaDataGroupEClass, SDO_META_DATA_GROUP__TYPE_META_DATA); + + typeMetaDataEClass = createEClass(TYPE_META_DATA); + createEAttribute(typeMetaDataEClass, TYPE_META_DATA__LOCATION); + + xsdMetaDataEClass = createEClass(XSD_META_DATA); + createEAttribute(xsdMetaDataEClass, XSD_META_DATA__LOCATION); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + ModelPackageImpl theModelPackageImpl = (ModelPackageImpl)EPackage.Registry.INSTANCE.getEPackage(ModelPackageImpl.eNS_URI); + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(documentRootEClass, null, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_SdoMetaDataGroup(), this.getSDOMetaDataGroup(), null, "sdoMetaDataGroup", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + + initEClass(javaMetaDataEClass, JavaMetaData.class, "JavaMetaData", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getJavaMetaData_FactoryInterface(), theModelPackageImpl.getString(), "factoryInterface", null, 0, 1, JavaMetaData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getJavaMetaData_TypeInterface(), theModelPackageImpl.getString(), "typeInterface", null, 0, 1, JavaMetaData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(sdoMetaDataGroupEClass, SDOMetaDataGroup.class, "SDOMetaDataGroup", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getSDOMetaDataGroup_JavaMetaData(), this.getJavaMetaData(), null, "javaMetaData", null, 0, -1, SDOMetaDataGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getSDOMetaDataGroup_XsdMetaData(), this.getXSDMetaData(), null, "xsdMetaData", null, 0, -1, SDOMetaDataGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getSDOMetaDataGroup_TypeMetaData(), this.getTypeMetaData(), null, "typeMetaData", null, 0, -1, SDOMetaDataGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(typeMetaDataEClass, TypeMetaData.class, "TypeMetaData", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getTypeMetaData_Location(), theModelPackageImpl.getString(), "location", null, 1, 1, TypeMetaData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(xsdMetaDataEClass, XSDMetaData.class, "XSDMetaData", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getXSDMetaData_Location(), theModelPackageImpl.getString(), "location", null, 1, 1, XSDMetaData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http:///org/eclipse/emf/ecore/util/ExtendedMetaData + createExtendedMetaDataAnnotations(); + } + + /** + * Initializes the annotations for http:///org/eclipse/emf/ecore/util/ExtendedMetaData. + * + * + * @generated + */ + protected void createExtendedMetaDataAnnotations() + { + String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; + addAnnotation + (documentRootEClass, + source, + new String[] + { + "name", "", + "kind", "mixed" + }); + addAnnotation + (getDocumentRoot_Mixed(), + source, + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + addAnnotation + (getDocumentRoot_XMLNSPrefixMap(), + source, + new String[] + { + "kind", "attribute", + "name", "xmlns:prefix" + }); + addAnnotation + (getDocumentRoot_XSISchemaLocation(), + source, + new String[] + { + "kind", "attribute", + "name", "xsi:schemaLocation" + }); + addAnnotation + (getDocumentRoot_SdoMetaDataGroup(), + source, + new String[] + { + "kind", "element", + "name", "sdoMetaDataGroup", + "namespace", "##targetNamespace" + }); + addAnnotation + (javaMetaDataEClass, + source, + new String[] + { + "name", "JavaMetaData", + "kind", "empty" + }); + addAnnotation + (getJavaMetaData_FactoryInterface(), + source, + new String[] + { + "kind", "attribute", + "name", "factoryInterface" + }); + addAnnotation + (getJavaMetaData_TypeInterface(), + source, + new String[] + { + "kind", "attribute", + "name", "typeInterface" + }); + addAnnotation + (sdoMetaDataGroupEClass, + source, + new String[] + { + "name", "SDOMetaDataGroup", + "kind", "elementOnly" + }); + addAnnotation + (getSDOMetaDataGroup_JavaMetaData(), + source, + new String[] + { + "kind", "element", + "name", "javaMetaData" + }); + addAnnotation + (getSDOMetaDataGroup_XsdMetaData(), + source, + new String[] + { + "kind", "element", + "name", "xsdMetaData" + }); + addAnnotation + (getSDOMetaDataGroup_TypeMetaData(), + source, + new String[] + { + "kind", "element", + "name", "typeMetaData" + }); + addAnnotation + (typeMetaDataEClass, + source, + new String[] + { + "name", "TypeMetaData", + "kind", "empty" + }); + addAnnotation + (getTypeMetaData_Location(), + source, + new String[] + { + "kind", "attribute", + "name", "location" + }); + addAnnotation + (xsdMetaDataEClass, + source, + new String[] + { + "name", "XSDMetaData", + "kind", "empty" + }); + addAnnotation + (getXSDMetaData_Location(), + source, + new String[] + { + "kind", "attribute", + "name", "location" + }); + } + + /** + * + * Defines literals for the meta objects that represent + *

        + *
      • each class,
      • + *
      • each feature of each class,
      • + *
      • each enum,
      • + *
      • and each data type
      • + *
      + * + * @generated + */ + public interface Literals + { + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.util.metadata.impl.DocumentRootImpl Document Root}' class. + * + * + * @see org.apache.tuscany.sdo.util.metadata.impl.DocumentRootImpl + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#getDocumentRoot() + * @generated + */ + public static final EClass DOCUMENT_ROOT = eINSTANCE.getDocumentRoot(); + + /** + * The meta object literal for the 'Mixed' attribute list feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__MIXED = eINSTANCE.getDocumentRoot_Mixed(); + + /** + * The meta object literal for the 'XMLNS Prefix Map' map feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__XMLNS_PREFIX_MAP = eINSTANCE.getDocumentRoot_XMLNSPrefixMap(); + + /** + * The meta object literal for the 'XSI Schema Location' map feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = eINSTANCE.getDocumentRoot_XSISchemaLocation(); + + /** + * The meta object literal for the 'Sdo Meta Data Group' containment reference feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__SDO_META_DATA_GROUP = eINSTANCE.getDocumentRoot_SdoMetaDataGroup(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.util.metadata.impl.JavaMetaDataImpl Java Meta Data}' class. + * + * + * @see org.apache.tuscany.sdo.util.metadata.impl.JavaMetaDataImpl + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#getJavaMetaData() + * @generated + */ + public static final EClass JAVA_META_DATA = eINSTANCE.getJavaMetaData(); + + /** + * The meta object literal for the 'Factory Interface' attribute feature. + * + * + * @generated + */ + public static final EAttribute JAVA_META_DATA__FACTORY_INTERFACE = eINSTANCE.getJavaMetaData_FactoryInterface(); + + /** + * The meta object literal for the 'Type Interface' attribute feature. + * + * + * @generated + */ + public static final EAttribute JAVA_META_DATA__TYPE_INTERFACE = eINSTANCE.getJavaMetaData_TypeInterface(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.util.metadata.impl.SDOMetaDataGroupImpl SDO Meta Data Group}' class. + * + * + * @see org.apache.tuscany.sdo.util.metadata.impl.SDOMetaDataGroupImpl + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#getSDOMetaDataGroup() + * @generated + */ + public static final EClass SDO_META_DATA_GROUP = eINSTANCE.getSDOMetaDataGroup(); + + /** + * The meta object literal for the 'Java Meta Data' containment reference list feature. + * + * + * @generated + */ + public static final EReference SDO_META_DATA_GROUP__JAVA_META_DATA = eINSTANCE.getSDOMetaDataGroup_JavaMetaData(); + + /** + * The meta object literal for the 'Xsd Meta Data' containment reference list feature. + * + * + * @generated + */ + public static final EReference SDO_META_DATA_GROUP__XSD_META_DATA = eINSTANCE.getSDOMetaDataGroup_XsdMetaData(); + + /** + * The meta object literal for the 'Type Meta Data' containment reference list feature. + * + * + * @generated + */ + public static final EReference SDO_META_DATA_GROUP__TYPE_META_DATA = eINSTANCE.getSDOMetaDataGroup_TypeMetaData(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.util.metadata.impl.TypeMetaDataImpl Type Meta Data}' class. + * + * + * @see org.apache.tuscany.sdo.util.metadata.impl.TypeMetaDataImpl + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#getTypeMetaData() + * @generated + */ + public static final EClass TYPE_META_DATA = eINSTANCE.getTypeMetaData(); + + /** + * The meta object literal for the 'Location' attribute feature. + * + * + * @generated + */ + public static final EAttribute TYPE_META_DATA__LOCATION = eINSTANCE.getTypeMetaData_Location(); + + /** + * The meta object literal for the '{@link org.apache.tuscany.sdo.util.metadata.impl.XSDMetaDataImpl XSD Meta Data}' class. + * + * + * @see org.apache.tuscany.sdo.util.metadata.impl.XSDMetaDataImpl + * @see org.apache.tuscany.sdo.util.metadata.impl.MetadataPackageImpl#getXSDMetaData() + * @generated + */ + public static final EClass XSD_META_DATA = eINSTANCE.getXSDMetaData(); + + /** + * The meta object literal for the 'Location' attribute feature. + * + * + * @generated + */ + public static final EAttribute XSD_META_DATA__LOCATION = eINSTANCE.getXSDMetaData_Location(); + + } + +} //MetadataPackageImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/SDOMetaDataGroupImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/SDOMetaDataGroupImpl.java new file mode 100644 index 0000000000..5a668bb306 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/SDOMetaDataGroupImpl.java @@ -0,0 +1,323 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata.impl; + +import java.io.InputStream; +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; +import org.apache.tuscany.sdo.model.Types; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.apache.tuscany.sdo.util.metadata.JavaMetaData; +import org.apache.tuscany.sdo.util.metadata.SDOMetaDataGroup; +import org.apache.tuscany.sdo.util.metadata.TypeMetaData; +import org.apache.tuscany.sdo.util.metadata.XSDMetaData; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLDocument; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; + +/** + * + * An implementation of the model object 'SDO Meta Data Group'. + * + *

      + * The following features are implemented: + *

        + *
      • {@link org.apache.tuscany.sdo.util.metadata.impl.SDOMetaDataGroupImpl#getJavaMetaData Java Meta Data}
      • + *
      • {@link org.apache.tuscany.sdo.util.metadata.impl.SDOMetaDataGroupImpl#getXsdMetaData Xsd Meta Data}
      • + *
      • {@link org.apache.tuscany.sdo.util.metadata.impl.SDOMetaDataGroupImpl#getTypeMetaData Type Meta Data}
      • + *
      + *

      + * + * @generated + */ +public class SDOMetaDataGroupImpl extends DataObjectImpl implements SDOMetaDataGroup +{ + public void register(TypeHelper typeHelper) + { + try + { + ClassLoader classLoader = (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() + { + public Object run() + { + return Thread.currentThread().getContextClassLoader(); + } + }); + register(typeHelper, classLoader); + } + catch (SecurityException e) + { + } + } + + public void register(TypeHelper typeHelper, ClassLoader classLoader) + { + try + { + for (Iterator iter = getJavaMetaData().iterator(); iter.hasNext();) + { + JavaMetaData metadata = (JavaMetaData)iter.next(); + String factoryInterface = metadata.getFactoryInterface(); + if (factoryInterface != null) + { + Class factoryInterfaceClass = classLoader.loadClass(factoryInterface); + SDOUtil.registerStaticTypes(factoryInterfaceClass); + } + else + { + String typeInterface = metadata.getTypeInterface(); + Class typeInterfaceClass = classLoader.loadClass(typeInterface); + // TODO: introspect and register the type + } + } + + XSDHelper xsdHelper = SDOUtil.createXSDHelper(typeHelper); + for (Iterator iter = getXsdMetaData().iterator(); iter.hasNext();) + { + XSDMetaData metadata = (XSDMetaData)iter.next(); + URL url = getClass().getResource(metadata.getLocation()); + InputStream inputStream = url.openStream(); + xsdHelper.define(inputStream, url.toString()); + } + + XMLHelper xmlHelper = SDOUtil.createXMLHelper(typeHelper); + for (Iterator iter = getTypeMetaData().iterator(); iter.hasNext();) + { + TypeMetaData metadata = (TypeMetaData)iter.next(); + URL url = getClass().getResource(metadata.getLocation()); + InputStream inputStream = url.openStream(); + XMLDocument xmlDocument = xmlHelper.load(inputStream); + Types types = (Types)xmlDocument.getRootObject(); + typeHelper.define(types.getTypeList()); + } + } + catch (Exception e) + { + } + } + + /** + * The cached value of the '{@link #getJavaMetaData() Java Meta Data}' containment reference list. + * + * + * @see #getJavaMetaData() + * @generated + * @ordered + */ + protected EList javaMetaData = null; + + /** + * The cached value of the '{@link #getXsdMetaData() Xsd Meta Data}' containment reference list. + * + * + * @see #getXsdMetaData() + * @generated + * @ordered + */ + protected EList xsdMetaData = null; + + /** + * The cached value of the '{@link #getTypeMetaData() Type Meta Data}' containment reference list. + * + * + * @see #getTypeMetaData() + * @generated + * @ordered + */ + protected EList typeMetaData = null; + + /** + * + * + * @generated + */ + protected SDOMetaDataGroupImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return MetadataPackageImpl.Literals.SDO_META_DATA_GROUP; + } + + /** + * + * + * @generated + */ + public List getJavaMetaData() + { + if (javaMetaData == null) + { + javaMetaData = new EObjectContainmentEList(JavaMetaData.class, this, MetadataPackageImpl.SDO_META_DATA_GROUP__JAVA_META_DATA); + } + return javaMetaData; + } + + /** + * + * + * @generated + */ + public List getXsdMetaData() + { + if (xsdMetaData == null) + { + xsdMetaData = new EObjectContainmentEList(XSDMetaData.class, this, MetadataPackageImpl.SDO_META_DATA_GROUP__XSD_META_DATA); + } + return xsdMetaData; + } + + /** + * + * + * @generated + */ + public List getTypeMetaData() + { + if (typeMetaData == null) + { + typeMetaData = new EObjectContainmentEList(TypeMetaData.class, this, MetadataPackageImpl.SDO_META_DATA_GROUP__TYPE_META_DATA); + } + return typeMetaData; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case MetadataPackageImpl.SDO_META_DATA_GROUP__JAVA_META_DATA: + return ((InternalEList)getJavaMetaData()).basicRemove(otherEnd, msgs); + case MetadataPackageImpl.SDO_META_DATA_GROUP__XSD_META_DATA: + return ((InternalEList)getXsdMetaData()).basicRemove(otherEnd, msgs); + case MetadataPackageImpl.SDO_META_DATA_GROUP__TYPE_META_DATA: + return ((InternalEList)getTypeMetaData()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case MetadataPackageImpl.SDO_META_DATA_GROUP__JAVA_META_DATA: + return getJavaMetaData(); + case MetadataPackageImpl.SDO_META_DATA_GROUP__XSD_META_DATA: + return getXsdMetaData(); + case MetadataPackageImpl.SDO_META_DATA_GROUP__TYPE_META_DATA: + return getTypeMetaData(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case MetadataPackageImpl.SDO_META_DATA_GROUP__JAVA_META_DATA: + getJavaMetaData().clear(); + getJavaMetaData().addAll((Collection)newValue); + return; + case MetadataPackageImpl.SDO_META_DATA_GROUP__XSD_META_DATA: + getXsdMetaData().clear(); + getXsdMetaData().addAll((Collection)newValue); + return; + case MetadataPackageImpl.SDO_META_DATA_GROUP__TYPE_META_DATA: + getTypeMetaData().clear(); + getTypeMetaData().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case MetadataPackageImpl.SDO_META_DATA_GROUP__JAVA_META_DATA: + getJavaMetaData().clear(); + return; + case MetadataPackageImpl.SDO_META_DATA_GROUP__XSD_META_DATA: + getXsdMetaData().clear(); + return; + case MetadataPackageImpl.SDO_META_DATA_GROUP__TYPE_META_DATA: + getTypeMetaData().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case MetadataPackageImpl.SDO_META_DATA_GROUP__JAVA_META_DATA: + return javaMetaData != null && !javaMetaData.isEmpty(); + case MetadataPackageImpl.SDO_META_DATA_GROUP__XSD_META_DATA: + return xsdMetaData != null && !xsdMetaData.isEmpty(); + case MetadataPackageImpl.SDO_META_DATA_GROUP__TYPE_META_DATA: + return typeMetaData != null && !typeMetaData.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //SDOMetaDataGroupImpl \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/TypeMetaDataImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/TypeMetaDataImpl.java new file mode 100644 index 0000000000..a147b12053 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/TypeMetaDataImpl.java @@ -0,0 +1,185 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata.impl; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.apache.tuscany.sdo.util.metadata.TypeMetaData; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +/** + * + * An implementation of the model object 'Type Meta Data'. + * + *

      + * The following features are implemented: + *

        + *
      • {@link org.apache.tuscany.sdo.util.metadata.impl.TypeMetaDataImpl#getLocation Location}
      • + *
      + *

      + * + * @generated + */ +public class TypeMetaDataImpl extends DataObjectImpl implements TypeMetaData +{ + /** + * The default value of the '{@link #getLocation() Location}' attribute. + * + * + * @see #getLocation() + * @generated + * @ordered + */ + protected static final String LOCATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLocation() Location}' attribute. + * + * + * @see #getLocation() + * @generated + * @ordered + */ + protected String location = LOCATION_EDEFAULT; + + /** + * + * + * @generated + */ + protected TypeMetaDataImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return MetadataPackageImpl.Literals.TYPE_META_DATA; + } + + /** + * + * + * @generated + */ + public String getLocation() + { + return location; + } + + /** + * + * + * @generated + */ + public void setLocation(String newLocation) + { + String oldLocation = location; + location = newLocation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackageImpl.TYPE_META_DATA__LOCATION, oldLocation, location)); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case MetadataPackageImpl.TYPE_META_DATA__LOCATION: + return getLocation(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case MetadataPackageImpl.TYPE_META_DATA__LOCATION: + setLocation((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case MetadataPackageImpl.TYPE_META_DATA__LOCATION: + setLocation(LOCATION_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case MetadataPackageImpl.TYPE_META_DATA__LOCATION: + return LOCATION_EDEFAULT == null ? location != null : !LOCATION_EDEFAULT.equals(location); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (location: "); + result.append(location); + result.append(')'); + return result.toString(); + } + +} //TypeMetaDataImpl \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/XSDMetaDataImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/XSDMetaDataImpl.java new file mode 100644 index 0000000000..1bfdc9d465 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/util/metadata/impl/XSDMetaDataImpl.java @@ -0,0 +1,185 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.util.metadata.impl; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.apache.tuscany.sdo.util.metadata.XSDMetaData; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +/** + * + * An implementation of the model object 'XSD Meta Data'. + * + *

      + * The following features are implemented: + *

        + *
      • {@link org.apache.tuscany.sdo.util.metadata.impl.XSDMetaDataImpl#getLocation Location}
      • + *
      + *

      + * + * @generated + */ +public class XSDMetaDataImpl extends DataObjectImpl implements XSDMetaData +{ + /** + * The default value of the '{@link #getLocation() Location}' attribute. + * + * + * @see #getLocation() + * @generated + * @ordered + */ + protected static final String LOCATION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLocation() Location}' attribute. + * + * + * @see #getLocation() + * @generated + * @ordered + */ + protected String location = LOCATION_EDEFAULT; + + /** + * + * + * @generated + */ + protected XSDMetaDataImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return MetadataPackageImpl.Literals.XSD_META_DATA; + } + + /** + * + * + * @generated + */ + public String getLocation() + { + return location; + } + + /** + * + * + * @generated + */ + public void setLocation(String newLocation) + { + String oldLocation = location; + location = newLocation; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackageImpl.XSD_META_DATA__LOCATION, oldLocation, location)); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case MetadataPackageImpl.XSD_META_DATA__LOCATION: + return getLocation(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case MetadataPackageImpl.XSD_META_DATA__LOCATION: + setLocation((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case MetadataPackageImpl.XSD_META_DATA__LOCATION: + setLocation(LOCATION_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case MetadataPackageImpl.XSD_META_DATA__LOCATION: + return LOCATION_EDEFAULT == null ? location != null : !LOCATION_EDEFAULT.equals(location); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (location: "); + result.append(location); + result.append(')'); + return result.toString(); + } + +} //XSDMetaDataImpl \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/MANIFEST.MF b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..6abece6be5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Extension-Name: tuscany-sdo-impl +Specification-Title: Tuscany SDO Implementation +Specification-Vendor: Apache Software Foundation +Implementation-Vendor: Apache Software Foundation +Implementation-Vendor-Id: org.apache +Implementation-Title: tuscany-sdo-impl +Implementation-Version: incubating-M1 +Bundle-ManifestVersion: 2 +Bundle-Name: Tuscany SDO Implementation +Bundle-SymbolicName: org.apache.tuscany.sdo.impl +Bundle-Version: 1.0.0 +Bundle-Vendor: Apache Software Foundation +Require-Bundle: org.eclipse.emf.common, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore.change, + org.eclipse.emf.ecore.xmi, + org.eclipse.xsd, + org.apache.tuscany.sdo.spec;visibility:=reexport +Export-Package: commonj.sdo.impl, + org.apache.tuscany.sdo, + org.apache.tuscany.sdo.helper, + org.apache.tuscany.sdo.impl, + org.apache.tuscany.sdo.test, + org.apache.tuscany.sdo.util diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/services/commonj.sdo.impl.HelperProvider b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/services/commonj.sdo.impl.HelperProvider new file mode 100644 index 0000000000..73693d6556 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/META-INF/services/commonj.sdo.impl.HelperProvider @@ -0,0 +1 @@ +org.apache.tuscany.sdo.helper.HelperProviderImpl \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/sdo-metadata.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/sdo-metadata.xsd new file mode 100644 index 0000000000..b3daf2b894 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/main/resources/sdo-metadata.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar1.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar1.java new file mode 100644 index 0000000000..f862837715 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar1.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.codegen; + +/** + * @version $Rev$ $Date$ + */ +public interface Bar1 { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar2.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar2.java new file mode 100644 index 0000000000..35a878015f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Bar2.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.codegen; + +/** + * @version $Rev$ $Date$ + */ +public interface Bar2 { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGeneratorTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGeneratorTestCase.java new file mode 100644 index 0000000000..7c64a42ab3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/BytecodeInterfaceGeneratorTestCase.java @@ -0,0 +1,164 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.codegen; + +import java.lang.reflect.Method; +import java.util.List; + +import junit.framework.TestCase; + +/** + * @version $Rev$ $Date$ + */ +public class BytecodeInterfaceGeneratorTestCase extends TestCase { + private MockType foo; + private BytecodeInterfaceGenerator gen; + private TestClassLoader cl; + + public void testHeaderNoBaseClass() { + gen.visitType(foo); + gen.visitEnd(); + Class c = cl.addClass(gen.getClassData()); + assertEquals("Foo", c.getName()); + assertTrue(c.isInterface()); + assertEquals(0, c.getInterfaces().length); + assertEquals(0, c.getMethods().length); + } + + public void testHeaderWithPackage() { + gen.visitType(new MockType("org.apache.Foo", null)); + gen.visitEnd(); + Class c = cl.addClass(gen.getClassData()); + assertEquals("org.apache.Foo", c.getName()); + assertEquals(0, c.getInterfaces().length); + assertEquals(0, c.getMethods().length); + } + + public void testHeaderOneBaseClass() throws NoJavaImplementationException { + foo.addBaseType(new MockType("bar1", Bar1.class)); + gen.visitType(foo); + gen.visitEnd(); + Class c = cl.addClass(gen.getClassData()); + assertEquals("Foo", c.getName()); + assertEquals(1, c.getInterfaces().length); + assertEquals(Bar1.class, c.getInterfaces()[0]); + assertEquals(0, c.getMethods().length); + } + + public void testHeaderMultipleBaseClass() throws NoJavaImplementationException { + foo.addBaseType(new MockType("bar1", Bar1.class)); + foo.addBaseType(new MockType("bar2", Bar2.class)); + gen.visitType(foo); + gen.visitEnd(); + Class c = cl.addClass(gen.getClassData()); + assertEquals("Foo", c.getName()); + assertEquals(2, c.getInterfaces().length); + assertEquals(Bar1.class, c.getInterfaces()[0]); + assertEquals(Bar2.class, c.getInterfaces()[1]); + assertEquals(0, c.getMethods().length); + } + + public void testBooleanProperty() throws NoJavaImplementationException, NoSuchMethodException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("true", Boolean.TYPE, false, false)); + gen.visitEnd(); + Class c = cl.addClass(gen.getClassData()); + assertEquals(2, c.getMethods().length); + Method getter = c.getMethod("isTrue", new Class[0]); + assertEquals(boolean.class, getter.getReturnType()); + Method setter = c.getMethod("setTrue", new Class[] {boolean.class}); + assertEquals(void.class, setter.getReturnType()); + } + + public void testByteArrayProperty() throws NoJavaImplementationException, NoSuchMethodException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("bytes", byte[].class, false, false)); + gen.visitEnd(); + Class c = cl.addClass(gen.getClassData()); + assertEquals(2, c.getMethods().length); + Method getter = c.getMethod("getBytes", new Class[0]); + assertEquals(byte[].class, getter.getReturnType()); + Method setter = c.getMethod("setBytes", new Class[] {byte[].class}); + assertEquals(void.class, setter.getReturnType()); + } + + public void testObjectProperty() throws NoJavaImplementationException, NoSuchMethodException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("bar", Bar1.class, false, false)); + gen.visitEnd(); + Class c = cl.addClass(gen.getClassData()); + assertEquals(2, c.getMethods().length); + Method getter = c.getMethod("getBar", new Class[0]); + assertEquals(Bar1.class, getter.getReturnType()); + Method setter = c.getMethod("setBar", new Class[] {Bar1.class}); + assertEquals(void.class, setter.getReturnType()); + } + + public void testReadOnlyProperty() throws NoJavaImplementationException, NoSuchMethodException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("int", Integer.TYPE, false, true)); + gen.visitEnd(); + Class c = cl.addClass(gen.getClassData()); + assertEquals(1, c.getMethods().length); + Method getter = c.getMethod("getInt", new Class[0]); + assertEquals(int.class, getter.getReturnType()); + } + + public void testManyProperty() throws NoJavaImplementationException, NoSuchMethodException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("list", Integer.TYPE, true, false)); + gen.visitEnd(); + Class c = cl.addClass(gen.getClassData()); + assertEquals(1, c.getMethods().length); + Method getter = c.getMethod("getList", new Class[0]); + assertEquals(List.class, getter.getReturnType()); + } + + public void testTwoProperties() throws NoJavaImplementationException, NoSuchMethodException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("true", Boolean.TYPE, false, false)); + gen.visitProperty(new MockProperty("int", Integer.TYPE, false, false)); + gen.visitEnd(); + Class c = cl.addClass(gen.getClassData()); + assertEquals(4, c.getMethods().length); + Method getter = c.getMethod("isTrue", new Class[0]); + assertEquals(boolean.class, getter.getReturnType()); + Method setter = c.getMethod("setTrue", new Class[] {boolean.class}); + assertEquals(void.class, setter.getReturnType()); + getter = c.getMethod("getInt", new Class[0]); + assertEquals(int.class, getter.getReturnType()); + setter = c.getMethod("setInt", new Class[] {int.class}); + assertEquals(void.class, setter.getReturnType()); + } + + protected void setUp() throws Exception { + super.setUp(); + foo = new MockType("foo", null); + gen = new BytecodeInterfaceGenerator(); + cl = new TestClassLoader(); + } + + private class TestClassLoader extends ClassLoader { + public TestClassLoader() { + super(TestClassLoader.class.getClassLoader()); + } + + Class addClass(byte[] bytes) { + return defineClass(null, bytes, 0, bytes.length); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Foo.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Foo.java new file mode 100644 index 0000000000..6a401d48bb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/Foo.java @@ -0,0 +1,23 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.codegen; + +/** + * @version $Rev$ $Date$ + */ +public interface Foo { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGeneratorTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGeneratorTestCase.java new file mode 100644 index 0000000000..9d67b61317 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/JavaInterfaceGeneratorTestCase.java @@ -0,0 +1,126 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.codegen; + +import java.io.PrintWriter; +import java.io.StringWriter; + +import junit.framework.TestCase; + +/** + * @version $Rev$ $Date$ + */ +public class JavaInterfaceGeneratorTestCase extends TestCase { + private static final String SEP = System.getProperty("line.separator"); + + private JavaInterfaceGenerator gen; + private StringWriter writer; + private MockType foo; + + public void testHeaderNoBaseClass() { + gen.visitType(foo); + gen.visitEnd(); + assertEquals(localize("public interface Foo {\n}\n"), writer.toString()); + } + + public void testHeaderWithPackage() { + gen.visitType(new MockType("org.apache.Foo", null)); + gen.visitEnd(); + assertEquals(localize("package org.apache;\n\npublic interface Foo {\n}\n"), writer.toString()); + } + + public void testHeaderOneBaseClass() throws NoJavaImplementationException { + foo.addBaseType(new MockType("bar1", Bar1.class)); + gen.visitType(foo); + gen.visitEnd(); + assertEquals(localize("public interface Foo extends org.apache.tuscany.sdo.codegen.Bar1 {\n}\n"), writer.toString()); + } + + public void testHeaderMultipleBaseClass() throws NoJavaImplementationException { + foo.addBaseType(new MockType("bar1", Bar1.class)); + foo.addBaseType(new MockType("bar2", Bar2.class)); + gen.visitType(foo); + gen.visitEnd(); + assertEquals(localize("public interface Foo extends org.apache.tuscany.sdo.codegen.Bar1, org.apache.tuscany.sdo.codegen.Bar2 {\n}\n"), writer.toString()); + } + + public void testBooleanProperty() throws NoJavaImplementationException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("true", Boolean.TYPE, false, false)); + gen.visitEnd(); + assertEquals(localize("public interface Foo {\n\tboolean isTrue();\n\tvoid setTrue(boolean value);\n}\n"), writer.toString()); + } + + public void testByteArrayProperty() throws NoJavaImplementationException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("bytes", byte[].class, false, false)); + gen.visitEnd(); + assertEquals(localize("public interface Foo {\n\tbyte[] getBytes();\n\tvoid setBytes(byte[] value);\n}\n"), writer.toString()); + } + + public void testObjectProperty() throws NoJavaImplementationException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("bar", Bar1.class, false, false)); + gen.visitEnd(); + assertEquals(localize("public interface Foo {\n\torg.apache.tuscany.sdo.codegen.Bar1 getBar();\n\tvoid setBar(org.apache.tuscany.sdo.codegen.Bar1 value);\n}\n"), writer.toString()); + } + + public void testReadOnlyProperty() throws NoJavaImplementationException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("int", Integer.TYPE, false, true)); + gen.visitEnd(); + assertEquals(localize("public interface Foo {\n\tint getInt();\n}\n"), writer.toString()); + } + + public void testManyProperty() throws NoJavaImplementationException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("list", Integer.TYPE, true, false)); + gen.visitEnd(); + assertEquals(localize("public interface Foo {\n\tjava.util.List getList();\n}\n"), writer.toString()); + } + + public void testTwoProperties() throws NoJavaImplementationException { + gen.visitType(foo); + gen.visitProperty(new MockProperty("true", Boolean.TYPE, false, false)); + gen.visitProperty(new MockProperty("int", Integer.TYPE, false, false)); + gen.visitEnd(); + assertEquals(localize("public interface Foo {\n\tboolean isTrue();\n\tvoid setTrue(boolean value);\n\tint getInt();\n\tvoid setInt(int value);\n}\n"), writer.toString()); + } + + protected void setUp() throws Exception { + super.setUp(); + writer = new StringWriter(); + gen = new JavaInterfaceGenerator(new PrintWriter(writer)); + foo = new MockType("foo", null); + } + + private String localize(String s) { + StringBuffer b = new StringBuffer(s.length() + s.length()/10); + for (int i = 0; i < s.length(); i++) { + char ch = s.charAt(i); + if (ch == '\t') { + b.append(" "); + } else if (ch == '\n') { + b.append(SEP); + } else { + b.append(ch); + } + } + return b.toString(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockProperty.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockProperty.java new file mode 100644 index 0000000000..5cee856217 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockProperty.java @@ -0,0 +1,75 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.codegen; + +import java.util.List; + +import commonj.sdo.Property; +import commonj.sdo.Type; + +/** + * @version $Rev$ $Date$ + */ +class MockProperty implements Property { + private final String name; + private final Type type; + private final boolean many; + private final boolean readOnly; + + public MockProperty(String name, Class type, boolean many, boolean readOnly) { + this.name = name; + this.type = new MockType(null, type); + this.many = many; + this.readOnly = readOnly; + } + + public String getName() { + return name; + } + + public Type getType() { + return type; + } + + public boolean isMany() { + return many; + } + + public boolean isContainment() { + throw new UnsupportedOperationException(); + } + + public Type getContainingType() { + throw new UnsupportedOperationException(); + } + + public Object getDefault() { + throw new UnsupportedOperationException(); + } + + public boolean isReadOnly() { + return readOnly; + } + + public Property getOpposite() { + throw new UnsupportedOperationException(); + } + + public List /*String*/ getAliasNames() { + throw new UnsupportedOperationException(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockType.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockType.java new file mode 100644 index 0000000000..209d7021c0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/codegen/MockType.java @@ -0,0 +1,93 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.codegen; + +import java.util.List; +import java.util.ArrayList; + +import commonj.sdo.Type; +import commonj.sdo.Property; + +/** + * @version $Rev$ $Date$ + */ +class MockType implements Type { + private final String name; + private final Class javaClass; + private final List baseTypes = new ArrayList(); + + public MockType(String name, Class javaClass) { + this.javaClass = javaClass; + this.name = name; + } + + public void addBaseType(Type baseType) { + baseTypes.add(baseType); + } + + public String getName() { + return name; + } + + public String getURI() { + throw new UnsupportedOperationException(); + } + + public Class getInstanceClass() { + return javaClass; + } + + public boolean isInstance(Object object) { + throw new UnsupportedOperationException(); + } + + public List /*Property*/ getProperties() { + throw new UnsupportedOperationException(); + } + + public Property getProperty(String propertyName) { + throw new UnsupportedOperationException(); + } + + public boolean isDataType() { + throw new UnsupportedOperationException(); + } + + public boolean isOpen() { + throw new UnsupportedOperationException(); + } + + public boolean isSequenced() { + throw new UnsupportedOperationException(); + } + + public boolean isAbstract() { + throw new UnsupportedOperationException(); + } + + public List /*Type*/ getBaseTypes() { + return baseTypes; + } + + public List /*Property*/ getDeclaredProperties() { + throw new UnsupportedOperationException(); + } + + public List /*String*/ getAliasNames() { + throw new UnsupportedOperationException(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryTestCase.java new file mode 100644 index 0000000000..4cc8c5e842 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryTestCase.java @@ -0,0 +1,89 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.net.URL; + +import junit.framework.TestCase; + +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.ChangeSummary; +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.helper.XSDHelper; + + +public class ChangeSummaryTestCase extends TestCase { + private final String TEST_MODEL = "/simple.xsd"; + private final String TEST_DATA = "/simplechangesummary.xml"; + + /** + * Simple ChangeSummary test. + */ + public void testChangeSummary() throws IOException { + // Create an empty data graph and add a root object, an instance of type Quote + // + + DataGraph dataGraph = SDOUtil.createDataGraph(); + DataObject quote = dataGraph.createRootObject("http://www.example.com/simple", "Quote"); + + // Begin logging changes + // + ChangeSummary changeSummary = dataGraph.getChangeSummary(); + changeSummary.beginLogging(); + + // Modify the data graph in various fun and interesting ways + // + quote.setString("symbol", "fbnt"); + quote.setString("companyName", "FlyByNightTechnology"); + quote.setBigDecimal("price", new BigDecimal("1000.0")); + quote.setBigDecimal("open1", new BigDecimal("1000.0")); + quote.setBigDecimal("high", new BigDecimal("1000.0")); + quote.setBigDecimal("low", new BigDecimal("1000.0")); + quote.setDouble("volume", 1000); + quote.setDouble("change1", 1000); + + DataObject child = quote.createDataObject("quotes"); + child.setBigDecimal("price", new BigDecimal("2000.0")); + + // Stop logging changes and print the resulting data graph to stdout + // + changeSummary.endLogging(); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SDOUtil.saveDataGraph(dataGraph, baos, null); + + assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA))); + } + + protected void setUp() throws Exception { + super.setUp(); + + // Populate the meta data for the test (Stock Quote) model + URL url = getClass().getResource(TEST_MODEL); + InputStream inputStream = url.openStream(); + XSDHelper.INSTANCE.define(inputStream, url.toString()); + inputStream.close(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DataTypeBaseTypeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DataTypeBaseTypeTestCase.java new file mode 100644 index 0000000000..faa8782a77 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DataTypeBaseTypeTestCase.java @@ -0,0 +1,65 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.List; + +import junit.framework.TestCase; + +import commonj.sdo.Type; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XSDHelper; + + +public class DataTypeBaseTypeTestCase extends TestCase { + private final String TEST_MODEL = "/datatype.xsd"; + private final String TEST_NAMESPACE = "http://www.example.com/datatype"; + + public void testSimpleSDOType() throws IOException + { + Type type = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "SimpleSDOType"); + List baseTypes = type.getBaseTypes(); + assertTrue(baseTypes.size() == 1); + } + + public void testSimpleSDOTypeInstanceClass() throws IOException + { + Type type = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "SimpleSDOTypeInstanceClass"); + List baseTypes = type.getBaseTypes(); + assertTrue(baseTypes.size() == 0); + } + + public void testSimpleSDOTypeExtendedInstanceClass() throws IOException + { + Type type = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "SimpleSDOTypeExtendedInstanceClass"); + List baseTypes = type.getBaseTypes(); + assertTrue(baseTypes.size() == 1); + } + + public void setUp() throws Exception + { + URL url = getClass().getResource(TEST_MODEL); + InputStream inputStream = url.openStream(); + XSDHelper.INSTANCE.define(inputStream, url.toString()); + inputStream.close(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java new file mode 100644 index 0000000000..b77b534be6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/DefineTypeTestCase.java @@ -0,0 +1,632 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.math.BigDecimal; + +import junit.framework.TestCase; + +import org.apache.tuscany.sdo.util.SDOUtil; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Sequence; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLDocument; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; + +public class DefineTypeTestCase extends TestCase +{ + private static final String CUSTOMER1_XML = "/customer1.xml"; + private static final String CUSTOMER2_XML = "/customer2.xml"; + private static final String OPEN_XML = "/open2.xml"; + private static final String MIXED_XML = "/mixed2.xml"; + private static final String MIXEDOPEN_XML = "/mixedopen.xml"; + + public void testDefineTypeRoundTrip() throws Exception { + TypeHelper types = SDOUtil.createTypeHelper(); + DataFactory factory = SDOUtil.createDataFactory(types); + XMLHelper xmlHelper = SDOUtil.createXMLHelper(types); + + Type intType = types.getType("commonj.sdo", "Int"); + Type stringType = types.getType("commonj.sdo", "String"); + + // create a new Type for Customers + DataObject customerType = factory.create("commonj.sdo", + "Type"); + customerType.set("uri", "http://example.com/customer"); + customerType.set("name", "Customer"); + + // create a customer number property + DataObject custNumProperty = customerType.createDataObject("property"); + custNumProperty.set("name", "custNum"); + custNumProperty.set("type", intType); + + // create a first name property + DataObject firstNameProperty = + customerType.createDataObject("property"); + firstNameProperty.set("name", "firstName"); + firstNameProperty.set("type", stringType); + + // create a last name property + DataObject lastNameProperty = customerType.createDataObject("property"); + lastNameProperty.set("name", "lastName"); + lastNameProperty.set("type", stringType); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + xmlHelper.save(customerType, "commonj.sdo", "type", baos); + + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + XMLDocument xdoc = xmlHelper.load(bais); + + customerType = xdoc.getRootObject(); + + // now define the Customer type so that customers can be made + types.define(customerType); + + DataObject customer1 = factory.create("http://example.com/customer", + "Customer"); + + customer1.setInt("custNum", 1); + customer1.set("firstName", "John"); + customer1.set("lastName", "Adams"); + DataObject customer2 = factory.create("http://example.com/customer", + "Customer"); + customer2.setInt("custNum", 2); + customer2.set("firstName", "Jeremy"); + customer2.set("lastName", "Pavick"); + + assertNotNull(customer1); + Type type = customer1.getType(); + assertNotNull(type.getProperty("custNum")); + assertNotNull(type.getProperty("firstName")); + assertNotNull(type.getProperty("lastName")); + assertEquals(type.getProperty("custNum").getType(), intType); + assertEquals(type.getProperty("firstName").getType(), stringType); + assertEquals(type.getProperty("lastName").getType(), stringType); + + assertNotNull(customer2); + type = customer2.getType(); + assertNotNull(type.getProperty("custNum")); + assertNotNull(type.getProperty("firstName")); + assertNotNull(type.getProperty("lastName")); + assertEquals(type.getProperty("custNum").getType(), intType); + assertEquals(type.getProperty("firstName").getType(), stringType); + assertEquals(type.getProperty("lastName").getType(), stringType); + + baos = new ByteArrayOutputStream(); + xmlHelper.save( + customer1, + "http://example.com/customer", + "Customer", baos); + assertTrue( + TestUtil.equalXmlFiles( + new ByteArrayInputStream(baos.toByteArray()), + getClass().getResource(CUSTOMER1_XML))); + + baos = new ByteArrayOutputStream(); + xmlHelper.save( + customer2, + "http://example.com/customer", + "Customer", baos); + assertTrue( + TestUtil.equalXmlFiles( + new ByteArrayInputStream(baos.toByteArray()), + getClass().getResource(CUSTOMER2_XML))); + } + + public void testDefineType() throws Exception + { + TypeHelper types = SDOUtil.createTypeHelper(); + DataFactory factory = SDOUtil.createDataFactory(types); + XMLHelper xmlHelper = SDOUtil.createXMLHelper(types); + + Type intType = types.getType("commonj.sdo", "Int"); + Type stringType = types.getType("commonj.sdo", "String"); + + // create a new Type for Customers + DataObject customerType = factory.create("commonj.sdo", + "Type"); + customerType.set("uri", "http://example.com/customer"); + customerType.set("name", "Customer"); + + // create a customer number property + DataObject custNumProperty = customerType.createDataObject("property"); + custNumProperty.set("name", "custNum"); + custNumProperty.set("type", intType); + + // create a first name property + DataObject firstNameProperty = + customerType.createDataObject("property"); + firstNameProperty.set("name", "firstName"); + firstNameProperty.set("type", stringType); + + // create a last name property + DataObject lastNameProperty = customerType.createDataObject("property"); + lastNameProperty.set("name", "lastName"); + lastNameProperty.set("type", stringType); + + // now define the Customer type so that customers can be made + types.define(customerType); + + DataObject customer1 = factory.create("http://example.com/customer", + "Customer"); + customer1.setInt("custNum", 1); + customer1.set("firstName", "John"); + customer1.set("lastName", "Adams"); + DataObject customer2 = factory.create("http://example.com/customer", + "Customer"); + customer2.setInt("custNum", 2); + customer2.set("firstName", "Jeremy"); + customer2.set("lastName", "Pavick"); + + assertNotNull(customer1); + Type type = customer1.getType(); + assertNotNull(type.getProperty("custNum")); + assertNotNull(type.getProperty("firstName")); + assertNotNull(type.getProperty("lastName")); + assertEquals(type.getProperty("custNum").getType(), intType); + assertEquals(type.getProperty("firstName").getType(), stringType); + assertEquals(type.getProperty("lastName").getType(), stringType); + + assertNotNull(customer2); + type = customer2.getType(); + assertNotNull(type.getProperty("custNum")); + assertNotNull(type.getProperty("firstName")); + assertNotNull(type.getProperty("lastName")); + assertEquals(type.getProperty("custNum").getType(), intType); + assertEquals(type.getProperty("firstName").getType(), stringType); + assertEquals(type.getProperty("lastName").getType(), stringType); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + xmlHelper.save( + customer1, + "http://example.com/customer", + "Customer", baos); + assertTrue( + TestUtil.equalXmlFiles( + new ByteArrayInputStream(baos.toByteArray()), + getClass().getResource(CUSTOMER1_XML))); + + baos = new ByteArrayOutputStream(); + xmlHelper.save( + customer2, + "http://example.com/customer", + "Customer", baos); + assertTrue( + TestUtil.equalXmlFiles( + new ByteArrayInputStream(baos.toByteArray()), + getClass().getResource(CUSTOMER2_XML))); + } + + public void testDefineDataType() throws Exception + { + TypeHelper types = SDOUtil.createTypeHelper(); + DataFactory factory = SDOUtil.createDataFactory(types); + XSDHelper xsdHelper = SDOUtil.createXSDHelper(types); + XMLHelper xmlHelper = SDOUtil.createXMLHelper(types); + + Property javaClassProperty = xsdHelper.getGlobalProperty("commonj.sdo/java", "javaClass", false); + + // create a data types + DataObject intType = factory.create("commonj.sdo", "Type"); + intType.set("uri", "http://example.com/customer"); + intType.set("name", "MyIntType"); + intType.setBoolean("dataType", true); + intType.set(javaClassProperty, "int"); + + DataObject stringType = factory.create("commonj.sdo", "Type"); + stringType.set("uri", "http://example.com/customer"); + stringType.set("name", "MyStringType"); + stringType.setBoolean("dataType", true); + stringType.set(javaClassProperty, "java.lang.String"); + + // create a new Type for Customers + DataObject customerType = factory.create("commonj.sdo", + "Type"); + customerType.set("uri", "http://example.com/customer"); + customerType.set("name", "Customer"); + + // create a customer number property + DataObject custNumProperty = customerType.createDataObject("property"); + custNumProperty.set("name", "custNum"); + custNumProperty.set("type", intType); + + // create a first name property + DataObject firstNameProperty = + customerType.createDataObject("property"); + firstNameProperty.set("name", "firstName"); + firstNameProperty.set("type", stringType); + + // create a last name property + DataObject lastNameProperty = customerType.createDataObject("property"); + lastNameProperty.set("name", "lastName"); + lastNameProperty.set("type", stringType); + + // now define the Customer type so that customers can be made + types.define(customerType); + + DataObject customer1 = factory.create("http://example.com/customer", + "Customer"); + + customer1.setInt("custNum", 1); + customer1.set("firstName", "John"); + customer1.set("lastName", "Adams"); + DataObject customer2 = factory.create("http://example.com/customer", + "Customer"); + customer2.setInt("custNum", 2); + customer2.set("firstName", "Jeremy"); + customer2.set("lastName", "Pavick"); + + assertNotNull(customer1); + Type type = customer1.getType(); + assertNotNull(type.getProperty("custNum")); + assertNotNull(type.getProperty("firstName")); + assertNotNull(type.getProperty("lastName")); + assertNotNull(type.getProperty("custNum")); + assertNotNull(type.getProperty("firstName")); + assertNotNull(type.getProperty("lastName")); + + type = type.getProperty("custNum").getType(); + assertEquals(type.getURI(), "http://example.com/customer"); + assertEquals(type.getName(), "MyIntType"); + assertTrue(type.isDataType()); + + assertNotNull(customer2); + type = customer2.getType(); + assertNotNull(type.getProperty("custNum")); + assertNotNull(type.getProperty("firstName")); + assertNotNull(type.getProperty("lastName")); + assertNotNull(type.getProperty("custNum")); + assertNotNull(type.getProperty("firstName")); + assertNotNull(type.getProperty("lastName")); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + xmlHelper.save( + customer1, + "http://example.com/customer", + "Customer", baos); + assertTrue( + TestUtil.equalXmlFiles( + new ByteArrayInputStream(baos.toByteArray()), + getClass().getResource(CUSTOMER1_XML))); + + baos = new ByteArrayOutputStream(); + xmlHelper.save( + customer2, + "http://example.com/customer", + "Customer", baos); + assertTrue( + TestUtil.equalXmlFiles( + new ByteArrayInputStream(baos.toByteArray()), + getClass().getResource(CUSTOMER2_XML))); + } + + public void testFastDefineType() throws Exception + { + TypeHelper types = SDOUtil.createTypeHelper(); + DataFactory factory = SDOUtil.createDataFactory(types); + XMLHelper xmlHelper = SDOUtil.createXMLHelper(types); + + Type intType = types.getType("commonj.sdo", "Int"); + Type stringType = types.getType("commonj.sdo", "String"); + + // create a new Type for Customers + Type customerType = SDOUtil.createType(types, "http://example.com/customer", "Customer", false); + + // create a customer number property + SDOUtil.createProperty(customerType, "custNum", intType); + + // create a first name property + SDOUtil.createProperty(customerType, "firstName", stringType); + + // create a last name property + SDOUtil.createProperty(customerType, "lastName", stringType); + + DataObject customer1 = factory.create("http://example.com/customer", + "Customer"); + customer1.setInt("custNum", 1); + customer1.set("firstName", "John"); + customer1.set("lastName", "Adams"); + DataObject customer2 = factory.create("http://example.com/customer", + "Customer"); + customer2.setInt("custNum", 2); + customer2.set("firstName", "Jeremy"); + customer2.set("lastName", "Pavick"); + + assertNotNull(customer1); + Type type = customer1.getType(); + assertNotNull(type.getProperty("custNum")); + assertNotNull(type.getProperty("firstName")); + assertNotNull(type.getProperty("lastName")); + assertEquals(type.getProperty("custNum").getType(), intType); + assertEquals(type.getProperty("firstName").getType(), stringType); + assertEquals(type.getProperty("lastName").getType(), stringType); + + assertNotNull(customer2); + type = customer2.getType(); + assertNotNull(type.getProperty("custNum")); + assertNotNull(type.getProperty("firstName")); + assertNotNull(type.getProperty("lastName")); + assertEquals(type.getProperty("custNum").getType(), intType); + assertEquals(type.getProperty("firstName").getType(), stringType); + assertEquals(type.getProperty("lastName").getType(), stringType); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + xmlHelper.save( + customer1, + "http://example.com/customer", + "Customer", baos); + assertTrue( + TestUtil.equalXmlFiles( + new ByteArrayInputStream(baos.toByteArray()), + getClass().getResource(CUSTOMER1_XML))); + + baos = new ByteArrayOutputStream(); + xmlHelper.save( + customer2, + "http://example.com/customer", + "Customer", baos); + assertTrue( + TestUtil.equalXmlFiles( + new ByteArrayInputStream(baos.toByteArray()), + getClass().getResource(CUSTOMER2_XML))); + } + + public void testDefineSequencedType() throws Exception + { + + TypeHelper types = SDOUtil.createTypeHelper(); + DataFactory factory = SDOUtil.createDataFactory(types); + XMLHelper xmlHelper = SDOUtil.createXMLHelper(types); + + Type stringType = types.getType("commonj.sdo", "String"); + Type decimalType = types.getType("commonj.sdo", "Decimal"); + + // Define a new mixed type - MixedQuote + DataObject mixedQuoteType = factory.create("commonj.sdo", "Type"); + mixedQuoteType.set("uri", "http://www.example.com/mixed"); + mixedQuoteType.set("name", "MixedQuote"); + mixedQuoteType.set("sequenced", Boolean.TRUE); + + DataObject symbolProperty = mixedQuoteType.createDataObject("property"); + symbolProperty.set("name", "symbol"); + symbolProperty.set("type", stringType); + + DataObject companyNameProperty = mixedQuoteType.createDataObject("property"); + companyNameProperty.set("name", "companyName"); + companyNameProperty.set("type", stringType); + + DataObject priceProperty = mixedQuoteType.createDataObject("property"); + priceProperty.set("name", "price"); + priceProperty.set("type", decimalType); + + DataObject quotesProperty = mixedQuoteType.createDataObject("property"); + quotesProperty.set("name", "quotes"); + quotesProperty.set("type", mixedQuoteType); + quotesProperty.set("many", Boolean.TRUE); + quotesProperty.set("containment", Boolean.TRUE); + + types.define(mixedQuoteType); + + DataObject quote = factory.create("http://www.example.com/mixed", "MixedQuote"); + + assertTrue(quote.getType().isSequenced()); + + Sequence sequence = quote.getSequence(); + + sequence.add("\n "); + + quote.setString("symbol", "fbnt"); + + sequence.add("\n "); + + quote.setString("companyName", "FlyByNightTechnology"); + + sequence.add("\n some text\n "); + + DataObject child = quote.createDataObject("quotes"); + child.setBigDecimal("price", new BigDecimal("2000.0")); + + sequence.add("\n more text\n "); + + // quote.setBigDecimal("price", new BigDecimal("1000.0")); + sequence.add("price", new BigDecimal("1000.0")); + + sequence.add("\n"); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + xmlHelper.save(quote, "http://www.example.com/mixed", "mixedStockQuote", baos); + assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(MIXED_XML))); + } + + public void testDefineSequencedOpenType() throws Exception + { + + TypeHelper types = SDOUtil.createTypeHelper(); + DataFactory factory = SDOUtil.createDataFactory(types); + XMLHelper xmlHelper = SDOUtil.createXMLHelper(types); + + Type stringType = types.getType("commonj.sdo", "String"); + Type decimalType = types.getType("commonj.sdo", "Decimal"); + + // Define a new mixed type - MixedQuote + DataObject mixedQuoteType = factory.create("commonj.sdo", "Type"); + mixedQuoteType.set("uri", "http://www.example.com/mixed"); + mixedQuoteType.set("name", "MixedOpenQuote"); + mixedQuoteType.set("sequenced", Boolean.TRUE); + mixedQuoteType.set("open", Boolean.TRUE); + +// DataObject symbolProperty = mixedQuoteType.createDataObject("property"); +// symbolProperty.set("name", "symbol"); +// symbolProperty.set("type", stringType); + + DataObject companyNameProperty = mixedQuoteType.createDataObject("property"); + companyNameProperty.set("name", "companyName"); + companyNameProperty.set("type", stringType); + + DataObject priceProperty = mixedQuoteType.createDataObject("property"); + priceProperty.set("name", "price"); + priceProperty.set("type", decimalType); + + DataObject quotesProperty = mixedQuoteType.createDataObject("property"); + quotesProperty.set("name", "quotes"); + quotesProperty.set("type", mixedQuoteType); + quotesProperty.set("many", Boolean.TRUE); + quotesProperty.set("containment", Boolean.TRUE); + + types.define(mixedQuoteType); + + // Define a global type + DataObject globalType = factory.create("commonj.sdo", "Type"); + globalType.set("uri", "http://www.example.com/open"); + // Don't set the type's name - null is used for types containing global properties. + + DataObject symbolProperty = globalType.createDataObject("property"); + symbolProperty.set("name", "symbol"); + symbolProperty.set("type", stringType); + symbolProperty.set("containment", Boolean.TRUE); + + types.define(globalType); + + DataObject quote = factory.create("http://www.example.com/mixed", "MixedOpenQuote"); + + assertTrue(quote.getType().isSequenced()); + + Sequence sequence = quote.getSequence(); + + sequence.add("\n "); + + Type definedGlobalType = types.getType("http://www.example.com/open", null); + + Property definedSymbolProperty = definedGlobalType.getProperty("symbol"); + quote.setString(definedSymbolProperty, "fbnt"); + + sequence.add("\n "); + + quote.setString("companyName", "FlyByNightTechnology"); + + sequence.add("\n some text\n "); + + DataObject child = quote.createDataObject("quotes"); + child.setBigDecimal("price", new BigDecimal("2000.0")); + + sequence.add("\n more text\n "); + + // quote.setBigDecimal("price", new BigDecimal("1000.0")); + sequence.add("price", new BigDecimal("1000.0")); + + sequence.add("\n"); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + xmlHelper.save(quote, "http://www.example.com/mixed", "mixedOpenStockQuote", baos); + assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(MIXEDOPEN_XML))); + } + + + public void testDefineOpenType() throws Exception + { + TypeHelper types = SDOUtil.createTypeHelper(); + DataFactory factory = SDOUtil.createDataFactory(types); + XMLHelper xmlHelper = SDOUtil.createXMLHelper(types); + + Type stringType = types.getType("commonj.sdo", "String"); + Type decimalType = types.getType("commonj.sdo", "Decimal"); + + // Define a new open type - OpenQuote + DataObject openQuoteType = factory.create("commonj.sdo", "Type"); + openQuoteType.set("uri", "http://www.example.com/open"); + openQuoteType.set("name", "OpenQuote"); + openQuoteType.set("open", Boolean.TRUE); + openQuoteType.setBoolean("open", true); + + types.define(openQuoteType); + + // Define new type - CompanyType + DataObject companyType = factory.create("commonj.sdo", "Type"); + companyType.set("uri", "http://www.example.com/open"); + companyType.set("name", "CompanyType"); + + // Create CompanyType property - "name" + DataObject nameProperty = companyType.createDataObject("property"); + nameProperty.set("name", "name"); + nameProperty.set("type", stringType); + nameProperty.set("containment", Boolean.TRUE); + + types.define(companyType); + + // Define a global type + DataObject globalType = factory.create("commonj.sdo", "Type"); + globalType.set("uri", "http://www.example.com/open"); + // Don't set the type's name - null is used for types containing global properties. + + DataObject symbolProperty = globalType.createDataObject("property"); + symbolProperty.set("name", "symbol"); + symbolProperty.set("type", stringType); + symbolProperty.set("containment", Boolean.TRUE); + + // Define a global property - company + DataObject companyProperty = globalType.createDataObject("property"); + companyProperty.set("name", "company"); + companyProperty.set("type", companyType); + companyProperty.set("containment", Boolean.TRUE); + + // Define a global property - price + DataObject priceProperty = globalType.createDataObject("property"); + priceProperty.set("name", "price"); + priceProperty.set("type", decimalType); + + types.define(globalType); + + // Create DataObject instances + DataObject openQuote = factory.create("http://www.example.com/open", "OpenQuote"); + + assertTrue(openQuote.getType().isOpen()); + + // Get global type + Type definedGlobalType = types.getType("http://www.example.com/open", null); + + Property definedSymbolProperty = definedGlobalType.getProperty("symbol"); + openQuote.set(definedSymbolProperty, "s1"); + + Property definedCompanyProperty = definedGlobalType.getProperty("company"); + + DataObject company = openQuote.createDataObject(definedCompanyProperty); + company.setString("name", "FlyByNightTechnology"); + + Property definedPriceProperty = definedGlobalType.getProperty("price"); + openQuote.setBigDecimal(definedPriceProperty, new BigDecimal("1000.0")); + + assertEquals(definedPriceProperty.getType(), decimalType); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + xmlHelper.save( + openQuote, + "http://www.example.com/open", + "openStockQuote", baos); + assertTrue( + TestUtil.equalXmlFiles( + new ByteArrayInputStream(baos.toByteArray()), + getClass().getResource(OPEN_XML))); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/MixedTypeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/MixedTypeTestCase.java new file mode 100644 index 0000000000..e46f9858e2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/MixedTypeTestCase.java @@ -0,0 +1,86 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.net.URL; + +import commonj.sdo.DataObject; +import commonj.sdo.Sequence; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; +import junit.framework.TestCase; + + +public class MixedTypeTestCase extends TestCase { + private final String TEST_MODEL = "/mixed.xsd"; + private final String TEST_NAMESPACE = "http://www.example.com/mixed"; + private final String TEST_DATA = "/mixed.xml"; + + /** + * Sequenced type SDO 2 test. + */ + public void testSequencedType() throws IOException { + Type quoteType = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "MixedQuote"); + DataObject quote = DataFactory.INSTANCE.create(quoteType); + + Sequence sequence = quote.getSequence(); + + sequence.add("\n "); + + quote.setString("symbol", "fbnt"); + + sequence.add("\n "); + + quote.setString("companyName", "FlyByNightTechnology"); + + sequence.add("\n some text\n "); + + DataObject child = quote.createDataObject("quotes"); + child.setBigDecimal("price", new BigDecimal("2000.0")); + + sequence.add("\n more text\n "); + + // quote.setBigDecimal("price", new BigDecimal("1000.0")); + sequence.add("price", new BigDecimal("1000.0")); + + sequence.add("\n"); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "mixedStockQuote", baos); + + assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA))); + } + + protected void setUp() throws Exception { + super.setUp(); + + // Populate the meta data for the test (Stock Quote) model + URL url = getClass().getResource(TEST_MODEL); + InputStream inputStream = url.openStream(); + XSDHelper.INSTANCE.define(inputStream, url.toString()); + inputStream.close(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/OpenTypeTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/OpenTypeTestCase.java new file mode 100644 index 0000000000..7e743e296a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/OpenTypeTestCase.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.net.URL; +import java.util.Iterator; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; +import junit.framework.TestCase; + + +public class OpenTypeTestCase extends TestCase { + private final String TEST_MODEL = "/open.xsd"; + private final String TEST_NAMESPACE = "http://www.example.com/open"; + private final String TEST_DATA = "/open.xml"; + + /** + * Open content SDO 2 test. + */ + public void testOpenType() throws IOException { + Type quoteType = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "OpenQuote"); + DataObject quote = DataFactory.INSTANCE.create(quoteType); + + quote.setString("symbol", "s1"); + + for (Iterator iter = quote.getInstanceProperties().iterator(); iter.hasNext();) { + Property property = (Property) iter.next(); + } + + Property companyProperty = XSDHelper.INSTANCE.getGlobalProperty(TEST_NAMESPACE, "company", true); + DataObject company = quote.createDataObject(companyProperty); + company.setString("name", "FlyByNightTechnology"); + + Property priceProperty = XSDHelper.INSTANCE.getGlobalProperty(TEST_NAMESPACE, "price", true); + quote.getList(priceProperty).add(new BigDecimal("1000.0")); + + for (Iterator iter = quote.getInstanceProperties().iterator(); iter.hasNext();) { + Property property = (Property) iter.next(); + } + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "openStockQuote", baos); + + assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(TEST_DATA))); + } + + protected void setUp() throws Exception { + super.setUp(); + + // Populate the meta data for the test (Stock Quote) model + URL url = getClass().getResource(TEST_MODEL); + InputStream inputStream = url.openStream(); + XSDHelper.INSTANCE.define(inputStream, url.toString()); + inputStream.close(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleCopyTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleCopyTestCase.java new file mode 100644 index 0000000000..2e91a1a66f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleCopyTestCase.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.CopyHelper; +import commonj.sdo.helper.XMLDocument; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; +import junit.framework.TestCase; + +public class SimpleCopyTestCase extends TestCase { + + private final String TEST_MODEL = "/simple.xsd"; + private final String TEST_NAMESPACE = "http://www.example.com/simple"; + private final String QUOTE_XML = "/quote.xml"; + private final String SHALLOW_QUOTE_XML = "/shallowquote.xml"; + + public void testSimpleCopy() throws IOException { + XMLDocument doc = XMLHelper.INSTANCE.load(getClass().getResourceAsStream(QUOTE_XML)); + DataObject sdo = doc.getRootObject(); + + DataObject copiedSdo = CopyHelper.INSTANCE.copyShallow(sdo); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XMLHelper.INSTANCE.save(copiedSdo, TEST_NAMESPACE, "stockQuote", baos); + assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(SHALLOW_QUOTE_XML))); + assertFalse(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(QUOTE_XML))); + + copiedSdo = CopyHelper.INSTANCE.copy(sdo); + + baos.reset(); + XMLHelper.INSTANCE.save(copiedSdo, TEST_NAMESPACE, "stockQuote", baos); + assertFalse(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(SHALLOW_QUOTE_XML))); + assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(QUOTE_XML))); + } + + protected void setUp() throws Exception { + super.setUp(); + + // Populate the meta data for the test (Stock Quote) model + URL url = getClass().getResource(TEST_MODEL); + InputStream inputStream = url.openStream(); + XSDHelper.INSTANCE.define(inputStream, url.toString()); + inputStream.close(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleDynamicTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleDynamicTestCase.java new file mode 100644 index 0000000000..d86b793087 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleDynamicTestCase.java @@ -0,0 +1,78 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.net.URL; + +import junit.framework.TestCase; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; + + +public class SimpleDynamicTestCase extends TestCase { + private final String TEST_MODEL = "/simple.xsd"; + private final String TEST_NAMESPACE = "http://www.example.com/simple"; + private final String QUOTE_XML = "/quote.xml"; + + /** + * Simple Dynamic SDO 2 test. + */ + public void testDynamic() throws IOException { + Type quoteType = TypeHelper.INSTANCE.getType(TEST_NAMESPACE, "Quote"); + DataObject quote = DataFactory.INSTANCE.create(quoteType); + + quote.setString("symbol", "fbnt"); + quote.setString("companyName", "FlyByNightTechnology"); + quote.setBigDecimal("price", new BigDecimal("1000.0")); + quote.setBigDecimal("open1", new BigDecimal("1000.0")); + quote.setBigDecimal("high", new BigDecimal("1000.0")); + quote.setBigDecimal("low", new BigDecimal("1000.0")); + quote.setDouble("volume", 1000); + quote.setDouble("change1", 1000); + + DataObject child = quote.createDataObject("quotes"); + child.setBigDecimal("price", new BigDecimal("2000.0")); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XMLHelper.INSTANCE.save(quote, TEST_NAMESPACE, "stockQuote", baos); + + assertTrue(TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(QUOTE_XML))); + } + + + protected void setUp() throws Exception { + super.setUp(); + + // Populate the meta data for the test (Stock Quote) model + URL url = getClass().getResource(TEST_MODEL); + InputStream inputStream = url.openStream(); + XSDHelper.INSTANCE.define(inputStream, url.toString()); + inputStream.close(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleEqualityTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleEqualityTestCase.java new file mode 100644 index 0000000000..ac05b362d9 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/SimpleEqualityTestCase.java @@ -0,0 +1,60 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.EqualityHelper; +import commonj.sdo.helper.XMLDocument; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; +import junit.framework.TestCase; + +public class SimpleEqualityTestCase extends TestCase { + private static final String TEST_MODEL = "/simple.xsd"; + private static final String QUOTE_XML = "/quote.xml"; + private static final String SHALLOW_QUOTE_XML = "/shallowquote.xml"; + + public void testEquality() throws IOException { + + XMLDocument doc = XMLHelper.INSTANCE.load(getClass().getResourceAsStream(QUOTE_XML)); + DataObject sdo = doc.getRootObject(); + + doc = XMLHelper.INSTANCE.load(getClass().getResourceAsStream(SHALLOW_QUOTE_XML)); + DataObject shallowSdo = doc.getRootObject(); + + boolean result = EqualityHelper.INSTANCE.equalShallow(sdo, shallowSdo); + assertTrue(result); + + result = EqualityHelper.INSTANCE.equal(sdo, shallowSdo); + assertFalse(result); + } + + + protected void setUp() throws Exception { + super.setUp(); + + // Populate the meta data for the test (Stock Quote) model + URL url = getClass().getResource(TEST_MODEL); + InputStream inputStream = url.openStream(); + XSDHelper.INSTANCE.define(inputStream, url.toString()); + inputStream.close(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java new file mode 100644 index 0000000000..d2ac035e02 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java @@ -0,0 +1,282 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.FactoryConfigurationError; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +public class TestUtil +{ + private static void getAllNodes(NodeList nodeList, List nodes) + { + int length = nodeList.getLength(); + if (length == 0) + { + return; + } + + for (int i=0; i + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/XMLDocumentSchemaLocation.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/XMLDocumentSchemaLocation.xsd new file mode 100644 index 0000000000..268ea375f0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/XMLDocumentSchemaLocation.xsd @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/XMLDocumentTestCase.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/XMLDocumentTestCase.xml new file mode 100644 index 0000000000..34e1648429 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/XMLDocumentTestCase.xml @@ -0,0 +1,14 @@ + + some string + + another string + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/customer1.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/customer1.xml new file mode 100644 index 0000000000..0c18fa47fa --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/customer1.xml @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/customer2.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/customer2.xml new file mode 100644 index 0000000000..5b74c06c73 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/customer2.xml @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/datatype.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/datatype.xsd new file mode 100644 index 0000000000..032f026137 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/datatype.xsd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed.xml new file mode 100644 index 0000000000..42ff3a3a5b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed.xml @@ -0,0 +1,9 @@ + + + fbnt + FlyByNightTechnology + some text + 2000.0 + more text + 1000.0 + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed.xsd new file mode 100644 index 0000000000..c45fc87de2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed.xsd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed2.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed2.xml new file mode 100644 index 0000000000..723d7bb891 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixed2.xml @@ -0,0 +1,12 @@ + + + fbnt + FlyByNightTechnology + some text + 2000.0 + more text + 1000.0 + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixedopen.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixedopen.xml new file mode 100644 index 0000000000..5e618c58c8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/mixedopen.xml @@ -0,0 +1,12 @@ + + + fbnt + FlyByNightTechnology + some text + 2000.0 + more text + 1000.0 + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/names.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/names.xsd new file mode 100644 index 0000000000..601ecc5f6a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/names.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open.xml new file mode 100644 index 0000000000..d4a5b92e0c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open.xml @@ -0,0 +1,8 @@ + + + s1 + + FlyByNightTechnology + + 1000.0 + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open.xsd new file mode 100644 index 0000000000..06881e3f05 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open.xsd @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open2.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open2.xml new file mode 100644 index 0000000000..1dd5cf49f6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/open2.xml @@ -0,0 +1,9 @@ + + + s1 + + 1000.0 + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/quote.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/quote.xml new file mode 100644 index 0000000000..d7b5969e23 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/quote.xml @@ -0,0 +1,14 @@ + + + fbnt + FlyByNightTechnology + 1000.0 + 1000.0 + 1000.0 + 1000.0 + 1000.0 + 1000.0 + + 2000.0 + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/sdoannotations.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/sdoannotations.xsd new file mode 100644 index 0000000000..355e9e2ba3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/sdoannotations.xsd @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/sdotypes.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/sdotypes.xsd new file mode 100644 index 0000000000..aa0def2be6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/sdotypes.xsd @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/shallowquote.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/shallowquote.xml new file mode 100644 index 0000000000..a56f2fe2b7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/shallowquote.xml @@ -0,0 +1,11 @@ + + + fbnt + FlyByNightTechnology + 1000.0 + 1000.0 + 1000.0 + 1000.0 + 1000.0 + 1000.0 + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/simple.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/simple.xsd new file mode 100644 index 0000000000..5310f7e1f3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/simple.xsd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/simplechangesummary.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/simplechangesummary.xml new file mode 100644 index 0000000000..7ac7a7cb2a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/impl/src/test/resources/simplechangesummary.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + fbnt + FlyByNightTechnology + 1000.0 + 1000.0 + 1000.0 + 1000.0 + 1000.0 + 1000.0 + + 2000.0 + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/pom.xml new file mode 100644 index 0000000000..f1669981da --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/pom.xml @@ -0,0 +1,42 @@ + + + + + org.apache.tuscany + tuscany-sdo + incubating-M1 + + 4.0.0 + tuscany-sdo-plugin + maven-plugin + incubating-M1 + Tuscany SDO Maven Plugin + + + + org.apache.maven + maven-plugin-api + 2.0 + + + org.apache.tuscany + tuscany-sdo-tools + ${pom.version} + compile + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java new file mode 100644 index 0000000000..88a7b93b6e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java @@ -0,0 +1,264 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.plugin; + +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.util.List; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +import org.apache.tuscany.sdo.generate.JavaGenerator; +import org.apache.tuscany.sdo.generate.XSD2JavaGenerator; + +/** + * @version $Rev$ $Date$ + * @goal generate + * @phase generate-sources + * @description Generate SDO interface classes from an XML Schema + */ +public class GeneratorMojo extends AbstractMojo { + /** + * The directory containing schema files; defaults to ${basedir}/src/main/xsd + * + * @parameter expression="${basedir}/src/main/xsd" + */ + private String schemaDir; + + /** + * Name of the schema file; if omitted all files in the directory are processed + * + * @parameter + */ + private File schemaFile; + + /** + * The Java package to generate into. By default the value is derived from the schema URI. + * + * @parameter + */ + private String javaPackage; + + /** + * The directory to generate into; defaults to ${project.build.directory}/sdo-source + * + * @parameter expression="${project.build.directory}/sdo-source" + */ + private String targetDirectory; + + /** + * Specifies the prefix string to use for naming the generated factory. + * + * @parameter + */ + private String prefix; + + /** + * This option can be used to eliminate the generated interface and to generate only an implementation class. + * + * @parameter + */ + private Boolean noInterfaces; + + /** + * Turns off container management for containment properties. + * + * @parameter + */ + private Boolean noContainment; + + /** + * This option eliminates all change notification overhead in the generated classes. + * + * @parameter + */ + private Boolean noNotification; + + /** + * With this option, all generated properties will not record their unset state. + * + * @parameter + */ + private Boolean noUnsettable; + + /** + * Generate a fast XML parser/loader for instances of the model. + * + * @parameter + */ + private Boolean generateLoader; + + /** + * Generate a Switch class for the model. + * + * @parameter + */ + private Boolean generateSwitch; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + private List compilerSourceRoots; + + /** + * With this option, generated code will not have EMF references. + * + * @parameter + */ + private Boolean noEMF; + + /** + * Support for generating multiple schema files. + * + * @parameter + */ + private SchemaFileOption[] schemaFiles; + + public void execute() throws MojoExecutionException { + + // check for schemaFiles parameter first, if properties are not set, use global property + if (null != schemaFiles) { + for (int i = 0; i < schemaFiles.length; ++i) { + SchemaFileOption sf = schemaFiles[i]; + + if (null == sf.getTargetDirectory()) { + sf.setTargetDirectory(targetDirectory); + } + if (null == sf.getJavaPackage()) { + sf.setJavaPackage(javaPackage); + } + if (null == sf.isNoInterfaces()) { + sf.setNoInterfaces(noInterfaces); + } + if (null == sf.isNoContainment()) { + sf.setNoContainment(noContainment); + } + if (null == sf.isNoNotification()) { + sf.setNoNotification(noNotification); + } + if (null == sf.isNoUnsettable()) { + sf.setNoUnsettable(noUnsettable); + } + if (null == sf.isGenerateLoader()) { + sf.setGenerateLoader(generateLoader); + } + if (null == sf.isGenerateSwitch()) { + sf.setGenerateSwitch(generateSwitch); + } + if (null == sf.getCompilerSourceRoots()) { + sf.setCompilerSourceRoots(compilerSourceRoots); + } + if (null == sf.isNoEMF()) { + sf.setNoEMF(noEMF); + } + if (sf.getFileName() == null || sf.getFileName().length() == 0) { + throw new MojoExecutionException("no fileName specfied for schema."); + } + if (!sf.getFileName().canRead() || !sf.getFileName().isFile()) { + + throw new MojoExecutionException("file can not be read:" + sf.getFileName()); + } + } + } else { + + if (schemaFile == null) { + File[] files = new File(schemaDir).listFiles(FILTER); + schemaFiles = new SchemaFileOption[files.length]; + for (int i = files.length - 1; i > -1; --i) { + schemaFiles[i] = new SchemaFileOption(); + schemaFiles[i].setFileName(files[i]); + schemaFiles[i].setJavaPackage(javaPackage); + schemaFiles[i].setCompilerSourceRoots(compilerSourceRoots); + schemaFiles[i].setGenerateLoader(generateLoader); + schemaFiles[i].setGenerateSwitch(generateSwitch); + schemaFiles[i].setNoContainment(noContainment); + schemaFiles[i].setNoEMF(noEMF); + schemaFiles[i].setNoInterfaces(noInterfaces); + schemaFiles[i].setNoNotification(noNotification); + schemaFiles[i].setNoUnsettable(noUnsettable); + schemaFiles[i].setPrefix(prefix); + schemaFiles[i].setTargetDirectory(targetDirectory); + } + } else { + schemaFiles = new SchemaFileOption[] { new SchemaFileOption() }; + schemaFiles[0].setFileName(schemaFile); + schemaFiles[0].setJavaPackage(javaPackage); + schemaFiles[0].setCompilerSourceRoots(compilerSourceRoots); + schemaFiles[0].setGenerateLoader(generateLoader); + schemaFiles[0].setGenerateSwitch(generateSwitch); + schemaFiles[0].setNoContainment(noContainment); + schemaFiles[0].setNoEMF(noEMF); + schemaFiles[0].setNoInterfaces(noInterfaces); + schemaFiles[0].setNoNotification(noNotification); + schemaFiles[0].setNoUnsettable(noUnsettable); + schemaFiles[0].setPrefix(prefix); + schemaFiles[0].setTargetDirectory(targetDirectory); + } + } + + for (int i = 0; i < schemaFiles.length; i++) { + File file = schemaFiles[i].getFileName(); + File marker = new File(targetDirectory, ".gen#" + file.getName()); + if (file.lastModified() > marker.lastModified()) { + getLog().info("Generating SDO interfaces from " + file); + + int genOptions = 0; + + if (schemaFiles[i].isNoInterfaces() != null && schemaFiles[i].isNoInterfaces().booleanValue()) { + genOptions |= JavaGenerator.OPTION_NO_INTERFACES; + } + if (schemaFiles[i].isNoContainment() != null && schemaFiles[i].isNoContainment().booleanValue()) { + genOptions |= JavaGenerator.OPTION_NO_CONTAINMENT; + } + if (schemaFiles[i].isNoNotification() != null && schemaFiles[i].isNoNotification().booleanValue()) { + genOptions |= JavaGenerator.OPTION_NO_NOTIFICATION; + } + if (schemaFiles[i].isGenerateLoader() != null && schemaFiles[i].isGenerateLoader().booleanValue()) { + genOptions |= JavaGenerator.OPTION_GENERATE_LOADER; + } + if (schemaFiles[i].isNoUnsettable() != null && schemaFiles[i].isNoUnsettable().booleanValue()) { + genOptions |= JavaGenerator.OPTION_NO_UNSETTABLE; + } + if (schemaFiles[i].isGenerateSwitch() != null && schemaFiles[i].isGenerateSwitch().booleanValue()) { + genOptions |= JavaGenerator.OPTION_GENERATE_SWITCH; + } + if (schemaFiles[i].isNoEMF() != null && schemaFiles[i].isNoEMF().booleanValue()) { + genOptions |= JavaGenerator.OPTION_NO_EMF; + } + + XSD2JavaGenerator.generateFromXMLSchema(file.toString(), targetDirectory, javaPackage, prefix, genOptions); + } + try { + marker.createNewFile(); + } catch (IOException e) { + throw new MojoExecutionException(e.getMessage() + "'" + marker.getAbsolutePath() + "'", e); + } + marker.setLastModified(System.currentTimeMillis()); + } + + compilerSourceRoots.add(targetDirectory); + } + + private static final FileFilter FILTER = new FileFilter() { + public boolean accept(File pathname) { + return (pathname.isFile() || !pathname.isHidden()); + } + }; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/SchemaFileOption.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/SchemaFileOption.java new file mode 100644 index 0000000000..ec10a59f68 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/SchemaFileOption.java @@ -0,0 +1,189 @@ +package org.apache.tuscany.sdo.plugin; + +import java.io.File; +import java.util.List; + +public class SchemaFileOption { + + /** + * Name of the schema file + * + */ + private File fileName; + + /** + * The Java package to generate into. By default the value is derived from the schema URI. + * + * @parameter + */ + private String javaPackage; + + /** + * The directory to generate into; defaults to ${project.build.directory}/sdo-source + * + * @parameter expression="${project.build.directory}/sdo-source" + */ + private String targetDirectory; + + /** + * Specifies the prefix string to use for naming the generated factory. + * + * @parameter + */ + private String prefix; + + /** + * This option can be used to eliminate the generated interface and to generate only an implementation class. + * + * @parameter + */ + private Boolean noInterfaces; + + /** + * Turns off container management for containment properties. + * + * @parameter + */ + private Boolean noContainment; + + /** + * This option eliminates all change notification overhead in the generated classes. + * + * @parameter + */ + private Boolean noNotification; + + /** + * With this option, all generated properties will not record their unset state. + * + * @parameter + */ + private Boolean noUnsettable; + + /** + * Generate a fast XML parser/loader for instances of the model. + * + * @parameter + */ + private Boolean generateLoader; + + /** + * Generate a Switch class for the model. + * + * @parameter + */ + private Boolean generateSwitch; + + /** + * @parameter expression="${project.compileSourceRoots}" + * @readonly + */ + private List compilerSourceRoots; + + /** + * With this option, generated code will not have EMF references. + * + * @parameter + */ + private Boolean noEMF; + + public SchemaFileOption() { + } + + public List getCompilerSourceRoots() { + return compilerSourceRoots; + } + + public void setCompilerSourceRoots(List compilerSourceRoots) { + this.compilerSourceRoots = compilerSourceRoots; + } + + public Boolean isGenerateLoader() { + return generateLoader; + } + + public void setGenerateLoader(Boolean generateLoader) { + this.generateLoader = generateLoader; + } + + public Boolean isGenerateSwitch() { + return generateSwitch; + } + + public void setGenerateSwitch(Boolean generateSwitch) { + this.generateSwitch = generateSwitch; + } + + public String getJavaPackage() { + return javaPackage; + } + + public void setJavaPackage(String javaPackage) { + this.javaPackage = javaPackage; + } + + public Boolean isNoContainment() { + return noContainment; + } + + public void setNoContainment(Boolean noContainment) { + this.noContainment = noContainment; + } + + public Boolean isNoEMF() { + return noEMF; + } + + public void setNoEMF(Boolean noEMF) { + this.noEMF = noEMF; + } + + public Boolean isNoInterfaces() { + return noInterfaces; + } + + public void setNoInterfaces(Boolean noInterfaces) { + this.noInterfaces = noInterfaces; + } + + public Boolean isNoNotification() { + return noNotification; + } + + public void setNoNotification(Boolean noNotification) { + this.noNotification = noNotification; + } + + public Boolean isNoUnsettable() { + return noUnsettable; + } + + public void setNoUnsettable(Boolean noUnsettable) { + this.noUnsettable = noUnsettable; + } + + public String getPrefix() { + return prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + public String getTargetDirectory() { + return targetDirectory; + } + + public void setTargetDirectory(String targetDirectory) { + this.targetDirectory = targetDirectory; + } + + public File getFileName() { + return fileName; + } + + public void setFileName(File fileName) { + this.fileName = fileName; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/plugin/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/pom.xml new file mode 100644 index 0000000000..ab58b3cbbd --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/pom.xml @@ -0,0 +1,56 @@ + + + + + org.apache.tuscany + tuscany-project + incubating-M1 + + 4.0.0 + tuscany-sdo + pom + Tuscany SDO Implementation Project + incubating-M1 + + + impl + tools + plugin + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.4 + 1.4 + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*TestCase.java + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/pom.xml new file mode 100644 index 0000000000..3141053567 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/pom.xml @@ -0,0 +1,68 @@ + + + + + org.apache.tuscany + tuscany-sdo + incubating-M1 + + 4.0.0 + tuscany-sdo-tools + Tuscany SDO Tools + SDO Tools. + incubating-M1 + + + + eclipse.emf + http://download.eclipse.org/tools/emf/maven2 + + true + + + + + + + org.apache.tuscany + tuscany-sdo-impl + incubating-M1 + compile + + + + org.eclipse.emf + codegen + 2.2.0-RC4 + compile + + + + org.eclipse.emf + codegen-ecore + 2.2.0-RC4 + compile + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/readme.htm new file mode 100644 index 0000000000..1d96e24387 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/readme.htm @@ -0,0 +1,29 @@ + + + + +Tuscany SDO Tools + + + + + +

      Tuscany SDO Tools

      +

      Building SDO Tools

      + +To build the Tuscany SDO Java Generator tools, perform the following steps +
        +
      • Ensure that the environment variable JAVA_HOME is set to point to an installation of Java 5 (Java 1.5.0_6 works)
      • +
      • Run the command "mvn"
      • +
      +Note: only the Interface2JavaGenerator class requires Java 5. You can build the XSD2JavaGenerator tool using a Java 1.4 JDK by removing the Interface2JavaGenerator.java file before running the "mvn" command. + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/Interface2JavaGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/Interface2JavaGenerator.java new file mode 100644 index 0000000000..5bf5eba837 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/Interface2JavaGenerator.java @@ -0,0 +1,242 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.generate; + +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EcoreFactory; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; + +import commonj.sdo.helper.TypeHelper; + +public class Interface2JavaGenerator extends JavaGenerator +{ + /** + * Generate static SDOs from Java interfaces + * + * Usage arguments: see JavaGenerator + * + * [ -targetDirectory ] + * [ -javaPackage ] + * [ -namespace ] + * [ other options ... ] + * interface-names + * + * Options: + * + * -namespace + * Set the namespaceURI of the generated SDO Types to the specified value. + * + * NOTE: see the base class JavaGenerator for other options. + * + * Example: + * + * generate somepackage.InterfaceA somepackage.InterfaceB + * + */ + public static void main(String args[]) + { + try + { + JavaGenerator generator = new Interface2JavaGenerator(); + generator.processArguments(args); + generator.run(args); + } + catch (IllegalArgumentException e) + { + printUsage(); + } + } + + protected String namespace = null; + + protected int handleArgument(String args[], int index) + { + if (args[index].equalsIgnoreCase("-namespace")) + { + namespace = args[++index]; + } + else + { + return super.handleArgument(args, index); + } + + return index + 1; + } + + protected void run(String args[]) + { + List javaInterfaces=new ArrayList(); + + for (int index = inputIndex; index < args.length; ++index) + { + javaInterfaces.add(args[index]); + } + + ClassLoader classLoader=JavaGenerator.class.getClassLoader(); + generateFromJavaInterfaces(classLoader, javaInterfaces, namespace, targetDirectory, javaPackage, prefix, genOptions); + } + + public static void generateFromJavaInterfaces(ClassLoader classLoader, List javaInterfaces, String packageURI, String targetDirectory, String javaPackage, String prefix, int genOptions) + { + try + { + // Initialize the SDO runtime + DataObjectUtil.initRuntime(); + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + + // Create an EPackage for the generated SDO + if (packageURI == null) + packageURI = "http://" + javaPackage; + EPackage implEPackage = EcoreFactory.eINSTANCE.createEPackage(); + implEPackage.setNsURI(packageURI); + String shortName = shortName(packageURI); + implEPackage.setName(shortName); + implEPackage.setNsPrefix(shortName.toLowerCase()); + packageRegistry.put(packageURI, implEPackage); + + // Create EClasses for all the given Java interfaces + Map eClasses = new HashMap(); + for (Iterator iter = javaInterfaces.iterator(); iter.hasNext();) + { + String interfaceName = (String)iter.next(); + Class instanceClass = Class.forName(interfaceName, true, classLoader); + + EClass implEClass = EcoreFactory.eINSTANCE.createEClass(); + String className = shortName(instanceClass.getName()); + implEClass.setName(className); + implEClass.setInstanceClass(instanceClass); + + eClasses.put(instanceClass, implEClass); + implEPackage.getEClassifiers().add(implEClass); + } + + // Populate the EClasses with EAttributes and EReferences for their properties + for (Iterator iter = implEPackage.getEClassifiers().iterator(); iter.hasNext();) + { + EClass implEClass = (EClass)iter.next(); + Class instanceClass = implEClass.getInstanceClass(); + Method[] methods = instanceClass.getMethods(); + for (int m = 0; m < methods.length; m++) + { + Method method = methods[m]; + String propertyName = null; + if (method.getName().startsWith("get")) + propertyName = method.getName().substring(3); + else if (method.getName().startsWith("is")) + propertyName = method.getName().substring(2); + + if (propertyName != null) + { + if (propertyName.length() > 1) + propertyName = propertyName.substring(0, 1).toLowerCase() + propertyName.substring(1); + + Class propertyClass = method.getReturnType(); + EClass propertyEClass = (EClass)eClasses.get(propertyClass); + + if (propertyEClass != null) + { + // The property is another SDO, create an EReference to represent the property + EReference reference = EcoreFactory.eINSTANCE.createEReference(); + reference.setName(propertyName); + reference.setContainment(true); + reference.setEType(propertyEClass); + implEClass.getEStructuralFeatures().add(reference); + + } + else + { + // The property is a List and T is an SDO, created a 0..many EReference to represent the property + if (propertyClass == List.class) + { + Type genericType = method.getGenericReturnType(); + if (genericType instanceof ParameterizedType) + { + ParameterizedType parameterizedType = (ParameterizedType)genericType; + Type[] targs = parameterizedType.getActualTypeArguments(); + if (targs.length != 0 && eClasses.containsKey(targs[0])) + { + propertyEClass = (EClass)eClasses.get(targs[0]); + if (propertyEClass != null) + { + EReference reference = EcoreFactory.eINSTANCE.createEReference(); + reference.setName(propertyName); + reference.setContainment(true); + reference.setEType(propertyEClass); + reference.setUpperBound(-1); + implEClass.getEStructuralFeatures().add(reference); + } + } + } + continue; + } + + // The property is a regular Java type / not an SDO, create an EAttribute to represent it + EAttribute attribute = EcoreFactory.eINSTANCE.createEAttribute(); + attribute.setName(propertyName); + EDataType dataType = (EDataType)TypeHelper.INSTANCE.getType(propertyClass); + attribute.setEType(dataType); + implEClass.getEStructuralFeatures().add(attribute); + } + } + } + } + + generatePackages(packageRegistry.values(), packageURI, shortName, targetDirectory, javaPackage, prefix, genOptions); + } + catch (ClassNotFoundException e) + { + e.printStackTrace(); + } + } + + protected static void printUsage() + { + System.out.println("Usage arguments:"); + System.out.println(" [ -targetDirectory ]"); + System.out.println(" [ -javaPackage ]"); + System.out.println(" [ -namespace ]"); + System.out.println(" [ -prefix ]"); + System.out.println(" [ -sparsePattern | -storePattern ]"); + System.out.println(" [ -noInterfaces ]"); + System.out.println(" [ -noContainment ]"); + System.out.println(" [ -noNotification ]"); + System.out.println(" [ -arrayAccessors ]"); + System.out.println(" [ -generateLoader ]"); + System.out.println(" [ -noUnsettable ]"); + System.out.println(" [ -noEMF ]"); + System.out.println(" interface-names"); + System.out.println(""); + System.out.println("For example:"); + System.out.println(""); + System.out.println(" generate somepackage.InterfaceA somepackage.InterfaceB"); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/JavaGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/JavaGenerator.java new file mode 100644 index 0000000000..f12a2667ee --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/JavaGenerator.java @@ -0,0 +1,616 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.generate; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; + +import org.apache.tuscany.sdo.generate.adapter.SDOGenModelGeneratorAdapterFactory; +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.impl.SDOPackageImpl; +import org.apache.tuscany.sdo.model.impl.ModelPackageImpl; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.codegen.ecore.generator.Generator; +import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenClass; +import org.eclipse.emf.codegen.ecore.genmodel.GenDelegationKind; +import org.eclipse.emf.codegen.ecore.genmodel.GenModel; +import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.codegen.ecore.genmodel.GenResourceKind; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapterFactory; +import org.eclipse.emf.codegen.util.CodeGenUtil; +import org.eclipse.emf.common.util.BasicMonitor; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.Diagnostician; +import org.eclipse.emf.ecore.util.ExtendedMetaData; +import org.eclipse.xsd.XSDSchema; + +import commonj.sdo.helper.XSDHelper; + +/** + * Abstract base class for static SDO code generators. See XSD2JavaGenerator and Interface2JavaGenerator for + * concrete generator commands. + * + * Supports the following command line options: + * + * [ -targetDirectory ] + * [ -javaPackage ] + * [ -prefix ] + * [ -sparsePattern | -storePattern ] + * [ -noInterfaces ] + * [ -noContainment ] + * [ -noNotification ] + * [ -arrayAccessors ] + * [ -generateLoader ] + * [ -noUnsettable ] + * [ -noEMF ] + * + * Basic options: + * + * -targetDirectory + * Generates the Java source code in the specified directory. By default, the code is generated + * in the same directory as the input xsd or wsdl file. + * -javaPackage + * Overrides the Java package for the generated classes. By default the package name is derived + * from the targetNamespace of the XML schema being generated. For example, if the targetNamespace is + * "http://www.example.com/simple", the default package will be "com.example.simple". + * -prefix + * Specifies the prefix string to use for naming the generated factory. For example "-prefix Foo" will + * result in a factory interface with the name "FooFactory". + * -sparsePattern + * For SDO metamodels that have classes with many properties of which only a few are typically set at + * runtime, this option can be used to produce a space-optimized implementation (at the expense of speed). + * -storePattern + * This option can be used to generate static classes that work with a Store-based DataObject + * implementation. It changes the generator pattern to generate accessors which delegate to the + * reflective methods (as opposed to the other way around) and changes the DataObject base class + * to org.apache.tuscany.sdo.impl.StoreDataObjectImpl. Note that this option generates classes that + * require a Store implementation to be provided before they can be run. + * -noEMF + * This option is used to generate static classes that have no references to EMF classes. This + * feature is currently being implemented and is in a preliminary state. + * + * The following options can be used to increase performance, but with some loss of SDO functionality: + * + * -noInterfaces + * By default, each DataObject generates both a Java interface and a corresponding implementation + * class. If an SDO metamodel does not use multiple inheritance (which is always the case for + * XML Schema derived models), then this option can be used to eliminate the interface and to generate + * only an implementation class. + * + * Following are planned but not supported yet: + * + * -noNotification + * This option eliminates all change notification overhead in the generated classes. Changes to + * DataObjects generated using this option cannot be recorded, and consequently the classes cannot + * be used with an SDO ChangeSummary or DataGraph. + * -noContainment + * Turns off container management for containment properties. DataObject.getContainer() will always + * return null for data objects generated with this option, even if a containment reference is set. + * Setting a containment reference will also not automatically remove the target object from its + * previous container, if it had one, so it will need to be explicitly removed by the client. Use + * of this option is only recommended for scenarios where this kind of container movement/management + * is not necessary. + * -arrayAccessors + * Generates Java array getters/setters for multiplicity-many properties. With this option, + * the set of "standard" JavaBean array accessor methods (e.g., Foo[] getFoo(), Foo getFoo(int), + * int getFooLength(), setFoo(Foo[]), and void setFoo(int, Foo)) are generated. The normal + * List-returning accessor is renamed with the suffix "List" (e.g., List getFooList()). The array + * returned by the generated method is not a copy, but instead a pointer to the underlying storage + * array, so directly modifying it can have undesirable consequences and should be avoided. + * -generateLoader + * Generate a fast XML parser/loader for instances of the model. The details of this option are + * subject to change, but currently it generates two additional classes in a "util" package: + * ResourceImpl and ResourceFactoryImpl. To use the generated loader at runtime, + * you need to pass an option to the XMLHelper.load() method like this: + * Map options = new HashMap(); + * options.put("GENERATED_LOADER", ResourceFactoryImpl.class); + * XMLDocument doc = XMLHelper.INSTANCE.load(new FileInputStream("somefile.xml"), null, options); + * Note: this option currently only works for simple schemas without substitution groups or wildcards. + * -noUnsettable + * By default, some XML constructs result in SDO property implementations that maintain additional + * state information to record when the property has been set to the "default value", as opposed to + * being truly unset (see DataObject.isSet() and DataObject.unset()). The SDO specification allows an + * implementation to choose to provide this behavior or not. With this option, all generated properties + * will not record their unset state. The generated isSet() methods simply returns whether the current + * value is equal to the property's "default value". + * + */ +public abstract class JavaGenerator +{ + public static int OPTION_NO_INTERFACES=0x1; + public static int OPTION_SPARSE_PATTERN=0x2; + public static int OPTION_STORE_PATTERN=0x4; + public static int OPTION_NO_CONTAINMENT=0x8; + public static int OPTION_NO_NOTIFICATION=0x10; + public static int OPTION_ARRAY_ACCESSORS=0x20; + public static int OPTION_GENERATE_LOADER=0x40; + public static int OPTION_NO_UNSETTABLE=0x80; + //FIXME Temporary, I need this option for now to get Switch classes generated for the SCDL models + public static int OPTION_GENERATE_SWITCH=0x100; + public static int OPTION_NO_EMF=0x200; + + static + { + System.setProperty("EMF_NO_CONSTRAINTS", "true"); // never generate a validator class + } + + /** + * @deprecated replaced by XSD2JavaGenerator + */ + public static void main(String args[]) + { + try + { + JavaGenerator generator = new XSD2JavaGenerator(); + generator.processArguments(args); + generator.run(args); + } + catch (IllegalArgumentException e) + { + printUsage(); + } + } + + protected void processArguments(String args[]) + { + if (args.length == 0) + { + throw new IllegalArgumentException(); + } + + int index = 0; + while (args[index].startsWith("-")) + { + int newIndex = handleArgument(args, index); + if (newIndex == index) + { + throw new IllegalArgumentException(); + } + index = newIndex; + if (index == args.length) + { + throw new IllegalArgumentException(); + } + } + + inputIndex = index; + } + + protected String targetDirectory = null; + protected String javaPackage = null; + protected String prefix = null; + protected int genOptions = 0; + protected String xsdFileName; + protected int inputIndex; + + protected int handleArgument(String args[], int index) + { + if (args[index].equalsIgnoreCase("-targetDirectory")) + { + targetDirectory = args[++index]; + } + else if (args[index].equalsIgnoreCase("-javaPackage")) + { + javaPackage = args[++index]; + } + else if (args[index].equalsIgnoreCase("-prefix")) + { + prefix = args[++index]; + } + else if (args[index].equalsIgnoreCase("-noInterfaces")) + { + genOptions |= OPTION_NO_INTERFACES; + } + else if (args[index].equalsIgnoreCase("-sparsePattern")) + { + genOptions |= OPTION_SPARSE_PATTERN; + } + else if (args[index].equalsIgnoreCase("-storePattern")) + { + genOptions |= OPTION_STORE_PATTERN; + } + else if (args[index].equalsIgnoreCase("-noContainment")) + { + genOptions |= OPTION_NO_CONTAINMENT; + } + else if (args[index].equalsIgnoreCase("-noNotification")) + { + genOptions |= OPTION_NO_NOTIFICATION; + } + else if (args[index].equalsIgnoreCase("-arrayAccessors")) + { + genOptions |= OPTION_ARRAY_ACCESSORS; + } + else if (args[index].equalsIgnoreCase("-generateLoader")) + { + genOptions |= OPTION_GENERATE_LOADER; + } + else if (args[index].equalsIgnoreCase("-noUnsettable")) + { + genOptions |= OPTION_NO_UNSETTABLE; + } + else if (args[index].equalsIgnoreCase("-noEMF")) + { + genOptions |= OPTION_NO_EMF; + } + //else if (...) + else + { + return index; + } + + return index + 1; + } + + protected abstract void run(String args[]); + + /** + * @deprecated moved to XSD2JavaGenerator + */ + public static void generateFromXMLSchema(String xsdFileName, String targetDirectory, String javaPackage, String prefix, int genOptions) + { + DataObjectUtil.initRuntime(); + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData); + + try + { + File inputFile = new File(xsdFileName).getAbsoluteFile(); + InputStream inputStream = new FileInputStream(inputFile); + xsdHelper.define(inputStream, inputFile.toURI().toString()); + + if (targetDirectory == null) + { + targetDirectory = new File(xsdFileName).getCanonicalFile().getParent(); + } + else + { + targetDirectory = new File(targetDirectory).getCanonicalPath(); + } + + if (!packageRegistry.values().isEmpty()) + { + String packageURI = getSchemaNamespace(xsdFileName); + generatePackages(packageRegistry.values(), packageURI, null, targetDirectory, javaPackage, prefix, genOptions); + } + + /* + for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) + { + EPackage ePackage = (EPackage)iter.next(); + String basePackage = extractBasePackageName(ePackage, javaPackage); + if (prefix == null) + { + prefix = CodeGenUtil.capName(ePackage.getName()); + } + generateFromEPackage(ePackage, targetDirectory, basePackage, prefix, genOptions); + } + */ + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + public static void generatePackages(Collection packageList, String packageURI, String shortName, String targetDirectory, String javaPackage, String prefix, int genOptions) + { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + List usedGenPackages = new ArrayList(); + GenModel genModel = null; + for (Iterator iter = packageList.iterator(); iter.hasNext();) + { + EPackage currentEPackage = (EPackage)iter.next(); + String currentBasePackage = extractBasePackageName(currentEPackage, javaPackage); + String currentPrefix = prefix == null ? CodeGenUtil.capName(shortName != null ? shortName : currentEPackage.getName()) : prefix; + GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage, currentPrefix, genOptions, resourceSet); + if (currentEPackage.getNsURI().equals(packageURI)) + { + genModel = currentGenPackage.getGenModel(); + } + else + { + usedGenPackages.add(currentGenPackage); + } + } + + if (genModel == null) return; // nothing to generate + + usedGenPackages.add(createGenPackage(SDOPackageImpl.eINSTANCE, "org.apache.tuscany", "SDO", 0, resourceSet)); + usedGenPackages.add(createGenPackage(ModelPackageImpl.eINSTANCE, "org.apache.tuscany.sdo", "Model", 0, resourceSet)); + genModel.getUsedGenPackages().addAll(usedGenPackages); + + // Invoke the SDO JavaGenerator to generate the SDO classes + try + { + generateFromGenModel(genModel, new File(targetDirectory).getCanonicalPath(), genOptions); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + /** + * @deprecated + */ + public static String getSchemaNamespace(String xsdFileName) + { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + File inputFile = new File(xsdFileName).getAbsoluteFile(); + Resource model = resourceSet.getResource(URI.createURI(inputFile.toURI().toString()), true); + XSDSchema schema = (XSDSchema)model.getContents().get(0); + return schema.getTargetNamespace(); + } + + public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix, int genOptions, ResourceSet resourceSet) + { + GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions); + + URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore"); + URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); + + Resource ecoreResource = resourceSet.createResource(ecoreURI); + ecoreResource.getContents().add(ePackage); + + Resource genModelResource = resourceSet.createResource(genModelURI); + genModelResource.getContents().add(genModel); + + return (GenPackage)genModel.getGenPackages().get(0); + } + + public static void generateFromEPackage(EPackage ePackage, String targetDirectory, String basePackage, String prefix, int genOptions) + { + GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions); + + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + URI ecoreURI = URI.createURI("file:///temp.ecore"); + URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel"); + + Resource ecoreResource = resourceSet.createResource(ecoreURI); + ecoreResource.getContents().add(ePackage); + + Resource genModelResource = resourceSet.createResource(genModelURI); + genModelResource.getContents().add(genModel); + + generateFromGenModel(genModel, targetDirectory, genOptions); + } + + public static void generateFromGenModel(GenModel genModel, String targetDirectory, int genOptions) + { + Resource resource = genModel.eResource(); + + if (targetDirectory != null) + { + resource.getResourceSet().getURIConverter().getURIMap().put( + URI.createURI("platform:/resource/TargetProject/"), + URI.createFileURI(targetDirectory + "/")); + genModel.setModelDirectory("/TargetProject"); + } + + //genModel.gen(new BasicMonitor.Printing(System.out)); + GeneratorAdapterFactory.Descriptor.Registry.INSTANCE.addDescriptor + (GenModelPackage.eNS_URI, GenModelGeneratorAdapterFactory.DESCRIPTOR); + + Generator generator = new Generator(); + + if ((genOptions & OPTION_NO_EMF) != 0) + { + generator.getAdapterFactoryDescriptorRegistry().addDescriptor + (GenModelPackage.eNS_URI, SDOGenModelGeneratorAdapterFactory.DESCRIPTOR); + } + + generator.setInput(genModel); + generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, new BasicMonitor.Printing(System.out)); + + + for (Iterator j = resource.getContents().iterator(); j.hasNext();) + { + EObject eObject = (EObject)j.next(); + Diagnostic diagnostic = Diagnostician.INSTANCE.validate(eObject); + if (diagnostic.getSeverity() != Diagnostic.OK) + { + printDiagnostic(diagnostic, ""); + } + } + } + + public static GenModel ecore2GenModel(EPackage ePackage, String basePackage, String prefix, int genOptions) + { + GenModel genModel = GenModelFactory.eINSTANCE.createGenModel(); + genModel.initialize(Collections.singleton(ePackage)); + + genModel.setRootExtendsInterface(""); + genModel.setRootImplementsInterface("commonj.sdo.DataObject"); + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.DataObjectImpl"); + genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence"); + genModel.setFeatureMapWrapperInternalInterface("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setFeatureMapWrapperClass("org.apache.tuscany.sdo.util.BasicSequence"); + genModel.setSuppressEMFTypes(true); + genModel.setSuppressEMFMetaData(true); + genModel.setSuppressEMFModelTags(true); + genModel.setCanGenerate(true); + //FIXME workaround java.lang.NoClassDefFoundError: org/eclipse/jdt/core/jdom/IDOMNode with 02162006 build + genModel.setFacadeHelperClass("Hack"); + genModel.setForceOverwrite(true); + + if ((genOptions & OPTION_NO_INTERFACES) != 0) + { + genModel.setSuppressInterfaces(true); + } + + if ((genOptions & OPTION_SPARSE_PATTERN) != 0) + { + genModel.setFeatureDelegation(GenDelegationKind.VIRTUAL_LITERAL); + } + else if ((genOptions & OPTION_STORE_PATTERN) != 0) + { + genModel.setFeatureDelegation(GenDelegationKind.REFLECTIVE_LITERAL); + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.StoreDataObjectImpl"); + } + + if ((genOptions & OPTION_NO_CONTAINMENT) != 0) + { + genModel.setSuppressContainment(true); + } + + if ((genOptions & OPTION_NO_NOTIFICATION) != 0) + { + genModel.setSuppressNotification(true); + } + + if ((genOptions & OPTION_ARRAY_ACCESSORS) != 0) + { + genModel.setArrayAccessors(true); + } + + if ((genOptions & OPTION_NO_UNSETTABLE) != 0) + { + genModel.setSuppressUnsettable(true); + } + + if ((genOptions & OPTION_NO_EMF) != 0) + { + genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.DataObjectBase"); + } + + GenPackage genPackage = (GenPackage)genModel.getGenPackages().get(0); + + if (basePackage != null) + { + genPackage.setBasePackage(basePackage); + } + if (prefix != null) + { + genPackage.setPrefix(prefix); + } + + //FIXME Temporary, I need this option for now to get Switch classes generated for the SCDL models + if ((genOptions & OPTION_GENERATE_SWITCH) == 0) + { + genPackage.setAdapterFactory(false); + } + + if ((genOptions & OPTION_GENERATE_LOADER) != 0) + { + //FIXME workaround compile error with 02162006 build, generated code references non-existent EcoreResourceImpl class + genPackage.setResource(GenResourceKind.XML_LITERAL); + //genPackage.setDataTypeConverters(true); + } + else + { + genPackage.setResource(GenResourceKind.NONE_LITERAL); + for (Iterator iter = genPackage.getGenClasses().iterator(); iter.hasNext();) + { + GenClass genClass = (GenClass)iter.next(); + if ("DocumentRoot".equals(genClass.getName())) + { + genClass.setDynamic(true); // Don't generate DocumentRoot class + break; + } + } + } + + return genModel; + } + + public static String extractBasePackageName(EPackage ePackage, String javaPackage) + { + String qualifiedName = javaPackage != null ? javaPackage : ePackage.getName(); + String name = /*CodeGenUtil.*/shortName(qualifiedName); + String baseName = qualifiedName.substring(0, qualifiedName.length() - name.length()); + if (javaPackage != null || !name.equals(qualifiedName)) + { + ePackage.setName(name); + } + return baseName != null ? /*CodeGenUtil.*/safeQualifiedName(baseName) : null; + } + + public static String shortName(String qualifiedName) + { + int index = qualifiedName.lastIndexOf("."); + return index != -1 ? qualifiedName.substring(index + 1) : qualifiedName; + } + + public static String safeQualifiedName(String qualifiedName) + { + StringBuffer safeQualifiedName = new StringBuffer(); + for (StringTokenizer stringTokenizer = new StringTokenizer(qualifiedName, "."); stringTokenizer.hasMoreTokens();) + { + String name = stringTokenizer.nextToken(); + safeQualifiedName.append(CodeGenUtil.safeName(name)); + if (stringTokenizer.hasMoreTokens()) + { + safeQualifiedName.append('.'); + } + } + return safeQualifiedName.toString(); + } + + protected static void printDiagnostic(Diagnostic diagnostic, String indent) + { + System.out.print(indent); + System.out.println(diagnostic.getMessage()); + for (Iterator i = diagnostic.getChildren().iterator(); i.hasNext();) + { + printDiagnostic((Diagnostic)i.next(), indent + " "); + } + } + + protected static void printUsage() + { + System.out.println("Usage arguments:"); + System.out.println(" [ -targetDirectory ]"); + System.out.println(" [ -javaPackage ]"); + System.out.println(" [ -prefix ]"); + System.out.println(" [ -sparsePattern | -storePattern ]"); + System.out.println(" [ -noInterfaces ]"); + System.out.println(" [ -noContainment ]"); + System.out.println(" [ -noNotification ]"); + System.out.println(" [ -arrayAccessors ]"); + System.out.println(" [ -generateLoader ]"); + System.out.println(" [ -noUnsettable ]"); + System.out.println(" [ -noEMF ]"); + System.out.println(" | "); + System.out.println(""); + System.out.println("For example:"); + System.out.println(""); + System.out.println(" generate somedir/somefile.xsd"); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/XSD2JavaGenerator.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/XSD2JavaGenerator.java new file mode 100644 index 0000000000..d14604b65c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/XSD2JavaGenerator.java @@ -0,0 +1,179 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.generate; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +import org.apache.tuscany.sdo.helper.XSDHelperImpl; +import org.apache.tuscany.sdo.util.DataObjectUtil; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EPackageRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.BasicExtendedMetaData; +import org.eclipse.emf.ecore.util.ExtendedMetaData; +import org.eclipse.xsd.XSDSchema; + +import commonj.sdo.helper.XSDHelper; + +public class XSD2JavaGenerator extends JavaGenerator +{ + /** + * Generate static SDOs from XML Schema + * + * Usage arguments: see JavaGenerator + * + * [ -targetDirectory ] + * [ -javaPackage ] + * [ -schemaNamespace ] + * [ other options ... ] + * | + * + * Options: + * + * -schemaNamespace + * Generate classes for XSD types in the specified targetNamespace. By default, types in the + * targetNamespace of the first schema in the specified xsd or wsdl file are generated. + * + * NOTE: see the base class JavaGenerator for other options. + * + * Example: + * + * generate somedir/somefile.xsd + * + * See base class JavaGenerator for details and the other options. + * + */ + public static void main(String args[]) + { + try + { + XSD2JavaGenerator generator = new XSD2JavaGenerator(); + generator.processArguments(args); + generator.run(args); + } + catch (IllegalArgumentException e) + { + printUsage(); + } + } + + protected String schemaNamespace = null; + + protected int handleArgument(String args[], int index) + { + if (args[index].equalsIgnoreCase("-schemaNamespace")) + { + schemaNamespace = args[++index]; + } + else + { + return super.handleArgument(args, index); + } + + return index + 1; + } + + protected void run(String args[]) + { + String xsdFileName = args[inputIndex]; + generateFromXMLSchema(xsdFileName, schemaNamespace, targetDirectory, javaPackage, prefix, genOptions); + } + + public static void generateFromXMLSchema(String xsdFileName, String namespace, String targetDirectory, String javaPackage, String prefix, int genOptions) + { + DataObjectUtil.initRuntime(); + EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE); + ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry); + XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData); + + try + { + File inputFile = new File(xsdFileName).getAbsoluteFile(); + InputStream inputStream = new FileInputStream(inputFile); + xsdHelper.define(inputStream, inputFile.toURI().toString()); + + if (targetDirectory == null) + { + targetDirectory = new File(xsdFileName).getCanonicalFile().getParent(); + } + else + { + targetDirectory = new File(targetDirectory).getCanonicalPath(); + } + + if (!packageRegistry.values().isEmpty()) + { + String packageURI = namespace != null ? namespace : getSchemaNamespace(xsdFileName); + generatePackages(packageRegistry.values(), packageURI, null, targetDirectory, javaPackage, prefix, genOptions); + } + + /* + for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) + { + EPackage ePackage = (EPackage)iter.next(); + String basePackage = extractBasePackageName(ePackage, javaPackage); + if (prefix == null) + { + prefix = CodeGenUtil.capName(ePackage.getName()); + } + generateFromEPackage(ePackage, targetDirectory, basePackage, prefix, genOptions); + } + */ + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + public static String getSchemaNamespace(String xsdFileName) + { + ResourceSet resourceSet = DataObjectUtil.createResourceSet(); + File inputFile = new File(xsdFileName).getAbsoluteFile(); + Resource model = resourceSet.getResource(URI.createURI(inputFile.toURI().toString()), true); + XSDSchema schema = (XSDSchema)model.getContents().get(0); + return schema.getTargetNamespace(); + } + + protected static void printUsage() + { + System.out.println("Usage arguments:"); + System.out.println(" [ -targetDirectory ]"); + System.out.println(" [ -javaPackage ]"); + System.out.println(" [ -schemaNamespace ]"); + System.out.println(" [ -prefix ]"); + System.out.println(" [ -sparsePattern | -storePattern ]"); + System.out.println(" [ -noInterfaces ]"); + System.out.println(" [ -noContainment ]"); + System.out.println(" [ -noNotification ]"); + System.out.println(" [ -arrayAccessors ]"); + System.out.println(" [ -generateLoader ]"); + System.out.println(" [ -noUnsettable ]"); + System.out.println(" [ -noEMF ]"); + System.out.println(" | "); + System.out.println(""); + System.out.println("For example:"); + System.out.println(""); + System.out.println(" generate somedir/somefile.xsd"); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenClassGeneratorAdapter.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenClassGeneratorAdapter.java new file mode 100644 index 0000000000..965307eefc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenClassGeneratorAdapter.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.generate.adapter; + +import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenClassGeneratorAdapter; + +public class SDOGenClassGeneratorAdapter extends GenClassGeneratorAdapter { + + public SDOGenClassGeneratorAdapter(GeneratorAdapterFactory generatorAdapterFactory) + { + super(generatorAdapterFactory); + } + + private static JETEmitterDescriptor[] jetEmitterDescriptors; + + protected JETEmitterDescriptor[] getJETEmitterDescriptors() + { + if (jetEmitterDescriptors == null) + { + JETEmitterDescriptor[] base = super.getJETEmitterDescriptors(); + jetEmitterDescriptors = new JETEmitterDescriptor[base.length]; + System.arraycopy(base, 0, jetEmitterDescriptors, 0, base.length); + jetEmitterDescriptors[CLASS_ID] = new JETEmitterDescriptor("model/SDOClass.javajet", "org.apache.tuscany.sdo.generate.templates.model.SDOClass"); + } + return jetEmitterDescriptors; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapterFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapterFactory.java new file mode 100644 index 0000000000..aa47d612ed --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenModelGeneratorAdapterFactory.java @@ -0,0 +1,51 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.generate.adapter; + +import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapterFactory; +import org.eclipse.emf.common.notify.Adapter; + +public class SDOGenModelGeneratorAdapterFactory extends + GenModelGeneratorAdapterFactory { + + public static final GeneratorAdapterFactory.Descriptor DESCRIPTOR = new GeneratorAdapterFactory.Descriptor() + { + public GeneratorAdapterFactory createAdapterFactory() + { + return new SDOGenModelGeneratorAdapterFactory(); + } + }; + + public Adapter createGenClassAdapter() + { + if (genClassGeneratorAdapter == null) + { + genClassGeneratorAdapter = new SDOGenClassGeneratorAdapter(this); + } + return genClassGeneratorAdapter; + } + + public Adapter createGenPackageAdapter() + { + if (genPackageGeneratorAdapter == null) + { + genPackageGeneratorAdapter = new SDOGenPackageGeneratorAdapter(this); + } + return genPackageGeneratorAdapter; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenPackageGeneratorAdapter.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenPackageGeneratorAdapter.java new file mode 100644 index 0000000000..b8e33fefc5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/adapter/SDOGenPackageGeneratorAdapter.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.generate.adapter; + +import org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory; +import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; +import org.eclipse.emf.codegen.ecore.genmodel.generator.GenPackageGeneratorAdapter; +import org.eclipse.emf.common.util.Monitor; + +public class SDOGenPackageGeneratorAdapter extends GenPackageGeneratorAdapter +{ + public SDOGenPackageGeneratorAdapter(GeneratorAdapterFactory generatorAdapterFactory) + { + super(generatorAdapterFactory); + } + + private static JETEmitterDescriptor[] jetEmitterDescriptors; + + protected JETEmitterDescriptor[] getJETEmitterDescriptors() + { + if (jetEmitterDescriptors == null) + { + JETEmitterDescriptor[] base = super.getJETEmitterDescriptors(); + jetEmitterDescriptors = new JETEmitterDescriptor[base.length]; + System.arraycopy(base, 0, jetEmitterDescriptors, 0, base.length); + jetEmitterDescriptors[FACTORY_CLASS_ID] = new JETEmitterDescriptor("model/SDOFactoryClass.javajet", "org.apache.tuscany.sdo.generate.templates.model.SDOFactoryClass"); + } + return jetEmitterDescriptors; + } + + protected void generatePackageClass(GenPackage genPackage, Monitor monitor) + { + // do nothing + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOClass.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOClass.java new file mode 100644 index 0000000000..f1e1db7bbc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOClass.java @@ -0,0 +1,4165 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.generate.templates.model; + +import java.util.*; +import org.eclipse.emf.codegen.ecore.genmodel.*; + +public class SDOClass +{ + protected static String nl; + public static synchronized SDOClass create(String lineSeparator) + { + nl = lineSeparator; + SDOClass result = new SDOClass(); + nl = null; + return result; + } + + protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = ""; + protected final String TEXT_2 = "/**" + NL + " * " + NL + " * " + NL + " *" + NL + " * "; + protected final String TEXT_3 = "Id"; + protected final String TEXT_4 = NL + " */"; + protected final String TEXT_5 = NL + "package "; + protected final String TEXT_6 = ";"; + protected final String TEXT_7 = NL + "package "; + protected final String TEXT_8 = ";"; + protected final String TEXT_9 = NL; + protected final String TEXT_10 = NL; + protected final String TEXT_11 = NL + "/**" + NL + " * " + NL + " * A representation of the model object '"; + protected final String TEXT_12 = "'." + NL + " * "; + protected final String TEXT_13 = NL + " *" + NL + " * " + NL + " * "; + protected final String TEXT_14 = NL + " * "; + protected final String TEXT_15 = NL + " *"; + protected final String TEXT_16 = NL + " *

      " + NL + " * The following features are supported:" + NL + " *

        "; + protected final String TEXT_17 = NL + " *
      • {@link "; + protected final String TEXT_18 = "#"; + protected final String TEXT_19 = " "; + protected final String TEXT_20 = "}
      • "; + protected final String TEXT_21 = NL + " *
      " + NL + " *

      "; + protected final String TEXT_22 = NL + " *"; + protected final String TEXT_23 = NL + " * @see "; + protected final String TEXT_24 = "#get"; + protected final String TEXT_25 = "()"; + protected final String TEXT_26 = NL + " * @model "; + protected final String TEXT_27 = NL + " * "; + protected final String TEXT_28 = NL + " * @model"; + protected final String TEXT_29 = NL + " * @extends "; + protected final String TEXT_30 = NL + " * @generated" + NL + " */"; + protected final String TEXT_31 = NL + "/**" + NL + " * " + NL + " * An implementation of the model object '"; + protected final String TEXT_32 = "'." + NL + " * " + NL + " *

      "; + protected final String TEXT_33 = NL + " * The following features are implemented:" + NL + " *

        "; + protected final String TEXT_34 = NL + " *
      • {@link "; + protected final String TEXT_35 = "#"; + protected final String TEXT_36 = " "; + protected final String TEXT_37 = "}
      • "; + protected final String TEXT_38 = NL + " *
      "; + protected final String TEXT_39 = NL + " *

      " + NL + " *" + NL + " * @generated" + NL + " */"; + protected final String TEXT_40 = NL + "public"; + protected final String TEXT_41 = " abstract"; + protected final String TEXT_42 = " class "; + protected final String TEXT_43 = NL + "public interface "; + protected final String TEXT_44 = NL + "{"; + protected final String TEXT_45 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_46 = " copyright = \""; + protected final String TEXT_47 = "\";"; + protected final String TEXT_48 = NL; + protected final String TEXT_49 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final "; + protected final String TEXT_50 = " mofDriverNumber = \""; + protected final String TEXT_51 = "\";"; + protected final String TEXT_52 = NL; + protected final String TEXT_53 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static final long serialVersionUID = 1L;" + NL; + protected final String TEXT_54 = NL + "\t/**" + NL + "\t * An array of objects representing the values of non-primitive features." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Object[] "; + protected final String TEXT_55 = " = null;" + NL; + protected final String TEXT_56 = NL + "\t/**" + NL + "\t * A bit field representing the indices of non-primitive feature values." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected int "; + protected final String TEXT_57 = " = 0;" + NL; + protected final String TEXT_58 = NL + "\t/**" + NL + "\t * A set of bit flags representing the values of boolean attributes and whether unsettable features have been set." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected int "; + protected final String TEXT_59 = " = 0;" + NL; + protected final String TEXT_60 = NL + "\t/**" + NL + "\t * The feature id for the '"; + protected final String TEXT_61 = "' "; + protected final String TEXT_62 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tpublic final static int "; + protected final String TEXT_63 = " = "; + protected final String TEXT_64 = ";" + NL; + protected final String TEXT_65 = NL + "\t/**" + NL + "\t * The cached value of the '{@link #"; + protected final String TEXT_66 = "() "; + protected final String TEXT_67 = "}' "; + protected final String TEXT_68 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @see #"; + protected final String TEXT_69 = "()" + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\t" + NL + "\t// How to get BasicSequence from Sequence?" + NL + "\t"; + protected final String TEXT_70 = NL + "\tprotected "; + protected final String TEXT_71 = " "; + protected final String TEXT_72 = " = null;" + NL + "\t"; + protected final String TEXT_73 = NL + "\tprotected "; + protected final String TEXT_74 = " "; + protected final String TEXT_75 = " = null;"; + protected final String TEXT_76 = NL + "\t/**" + NL + "\t * The empty value for the '{@link #"; + protected final String TEXT_77 = "() "; + protected final String TEXT_78 = "}' array accessor." + NL + "\t * " + NL + "\t * " + NL + "\t * @see #"; + protected final String TEXT_79 = "()" + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected static final "; + protected final String TEXT_80 = "[] "; + protected final String TEXT_81 = "_EEMPTY_ARRAY = new "; + protected final String TEXT_82 = " [0];" + NL; + protected final String TEXT_83 = NL + "\t/**" + NL + "\t * The default value of the '{@link #"; + protected final String TEXT_84 = "() "; + protected final String TEXT_85 = "}' "; + protected final String TEXT_86 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @see #"; + protected final String TEXT_87 = "()" + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected static final "; + protected final String TEXT_88 = " "; + protected final String TEXT_89 = "_DEFAULT_ = "; + protected final String TEXT_90 = ";"; + protected final String TEXT_91 = NL; + protected final String TEXT_92 = NL + "\t/**" + NL + "\t * An additional set of bit flags representing the values of boolean attributes and whether unsettable features have been set." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected int "; + protected final String TEXT_93 = " = 0;" + NL; + protected final String TEXT_94 = NL + "\t/**" + NL + "\t * The flag representing the value of the '{@link #"; + protected final String TEXT_95 = "() "; + protected final String TEXT_96 = "}' "; + protected final String TEXT_97 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @see #"; + protected final String TEXT_98 = "()" + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected static final int "; + protected final String TEXT_99 = "_EFLAG = 1 "; + protected final String TEXT_100 = ";" + NL; + protected final String TEXT_101 = NL + "\t/**" + NL + "\t * The cached value of the '{@link #"; + protected final String TEXT_102 = "() "; + protected final String TEXT_103 = "}' "; + protected final String TEXT_104 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @see #"; + protected final String TEXT_105 = "()" + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected "; + protected final String TEXT_106 = " "; + protected final String TEXT_107 = " = "; + protected final String TEXT_108 = "_DEFAULT_;" + NL; + protected final String TEXT_109 = NL + "\t/**" + NL + "\t * An additional set of bit flags representing the values of boolean attributes and whether unsettable features have been set." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected int "; + protected final String TEXT_110 = " = 0;" + NL; + protected final String TEXT_111 = NL + "\t/**" + NL + "\t * The flag representing whether the "; + protected final String TEXT_112 = " "; + protected final String TEXT_113 = " has been set." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected static final int "; + protected final String TEXT_114 = "_ESETFLAG = 1 "; + protected final String TEXT_115 = ";" + NL; + protected final String TEXT_116 = NL + "\t/**" + NL + "\t * This is true if the "; + protected final String TEXT_117 = " "; + protected final String TEXT_118 = " has been set." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @ordered" + NL + "\t */" + NL + "\tprotected boolean "; + protected final String TEXT_119 = "_set_ = false;" + NL; + protected final String TEXT_120 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; + protected final String TEXT_121 = "()" + NL + "\t{" + NL + "\t\tsuper();"; + protected final String TEXT_122 = NL + "\t\t"; + protected final String TEXT_123 = " |= "; + protected final String TEXT_124 = "_EFLAG;"; + protected final String TEXT_125 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_126 = " getType()" + NL + "\t{" + NL + "\t\treturn "; + protected final String TEXT_127 = ".INSTANCE.getType("; + protected final String TEXT_128 = ".class); //TBD Generate a more efficient implementation" + NL + "\t}" + NL; + protected final String TEXT_129 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_130 = NL + "\t"; + protected final String TEXT_131 = "[] "; + protected final String TEXT_132 = "();" + NL; + protected final String TEXT_133 = NL + "\tpublic "; + protected final String TEXT_134 = "[] "; + protected final String TEXT_135 = "()" + NL + "\t{"; + protected final String TEXT_136 = NL + "\t\t"; + protected final String TEXT_137 = " list = ("; + protected final String TEXT_138 = ")"; + protected final String TEXT_139 = "();" + NL + "\t\tif (list.isEmpty()) return "; + protected final String TEXT_140 = "_EEMPTY_ARRAY;"; + protected final String TEXT_141 = NL + "\t\tif ("; + protected final String TEXT_142 = " == null || "; + protected final String TEXT_143 = ".isEmpty()) return "; + protected final String TEXT_144 = "_EEMPTY_ARRAY;" + NL + "\t\t"; + protected final String TEXT_145 = " list = ("; + protected final String TEXT_146 = ")"; + protected final String TEXT_147 = ";"; + protected final String TEXT_148 = NL + "\t\tlist.shrink();" + NL + "\t\treturn ("; + protected final String TEXT_149 = "[])list.data();" + NL + "\t}" + NL; + protected final String TEXT_150 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_151 = NL + "\t"; + protected final String TEXT_152 = " get"; + protected final String TEXT_153 = "(int index);" + NL; + protected final String TEXT_154 = NL + "\tpublic "; + protected final String TEXT_155 = " get"; + protected final String TEXT_156 = "(int index)" + NL + "\t{" + NL + "\t\treturn ("; + protected final String TEXT_157 = ")"; + protected final String TEXT_158 = "().get(index);" + NL + "\t}" + NL; + protected final String TEXT_159 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_160 = NL + "\tint get"; + protected final String TEXT_161 = "Length();" + NL; + protected final String TEXT_162 = NL + "\tpublic int get"; + protected final String TEXT_163 = "Length()" + NL + "\t{"; + protected final String TEXT_164 = NL + "\t\treturn "; + protected final String TEXT_165 = "().size();"; + protected final String TEXT_166 = NL + "\t\treturn "; + protected final String TEXT_167 = " == null ? 0 : "; + protected final String TEXT_168 = ".size();"; + protected final String TEXT_169 = NL + "\t}" + NL; + protected final String TEXT_170 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_171 = NL + "\tvoid set"; + protected final String TEXT_172 = "("; + protected final String TEXT_173 = "[] new"; + protected final String TEXT_174 = ");" + NL; + protected final String TEXT_175 = NL + "\tpublic void set"; + protected final String TEXT_176 = "("; + protected final String TEXT_177 = "[] new"; + protected final String TEXT_178 = ")" + NL + "\t{" + NL + "\t\t(("; + protected final String TEXT_179 = ")"; + protected final String TEXT_180 = "()).setData(new"; + protected final String TEXT_181 = ".length, new"; + protected final String TEXT_182 = ");" + NL + "\t}" + NL; + protected final String TEXT_183 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_184 = NL + "\tvoid set"; + protected final String TEXT_185 = "(int index, "; + protected final String TEXT_186 = " element);" + NL; + protected final String TEXT_187 = NL + "\tpublic void set"; + protected final String TEXT_188 = "(int index, "; + protected final String TEXT_189 = " element)" + NL + "\t{" + NL + "\t\t"; + protected final String TEXT_190 = "().set(index, element);" + NL + "\t}" + NL; + protected final String TEXT_191 = NL + "\t/**" + NL + "\t * Returns the value of the '"; + protected final String TEXT_192 = "' "; + protected final String TEXT_193 = "."; + protected final String TEXT_194 = NL + "\t * The key is of type "; + protected final String TEXT_195 = "list of {@link "; + protected final String TEXT_196 = "}"; + protected final String TEXT_197 = "{@link "; + protected final String TEXT_198 = "}"; + protected final String TEXT_199 = "," + NL + "\t * and the value is of type "; + protected final String TEXT_200 = "list of {@link "; + protected final String TEXT_201 = "}"; + protected final String TEXT_202 = "{@link "; + protected final String TEXT_203 = "}"; + protected final String TEXT_204 = ","; + protected final String TEXT_205 = NL + "\t * The list contents are of type {@link "; + protected final String TEXT_206 = "}."; + protected final String TEXT_207 = NL + "\t * The default value is "; + protected final String TEXT_208 = "."; + protected final String TEXT_209 = NL + "\t * The literals are from the enumeration {@link "; + protected final String TEXT_210 = "}."; + protected final String TEXT_211 = NL + "\t * It is bidirectional and its opposite is '{@link "; + protected final String TEXT_212 = "#"; + protected final String TEXT_213 = " "; + protected final String TEXT_214 = "}'."; + protected final String TEXT_215 = NL + "\t * "; + protected final String TEXT_216 = NL + "\t *

      " + NL + "\t * If the meaning of the '"; + protected final String TEXT_217 = "' "; + protected final String TEXT_218 = " isn't clear," + NL + "\t * there really should be more of a description here..." + NL + "\t *

      "; + protected final String TEXT_219 = NL + "\t * "; + protected final String TEXT_220 = NL + "\t * " + NL + "\t * "; + protected final String TEXT_221 = NL + "\t * "; + protected final String TEXT_222 = NL + "\t * @return the value of the '"; + protected final String TEXT_223 = "' "; + protected final String TEXT_224 = "."; + protected final String TEXT_225 = NL + "\t * @see "; + protected final String TEXT_226 = NL + "\t * @see #isSet"; + protected final String TEXT_227 = "()"; + protected final String TEXT_228 = NL + "\t * @see #unset"; + protected final String TEXT_229 = "()"; + protected final String TEXT_230 = NL + "\t * @see #set"; + protected final String TEXT_231 = "("; + protected final String TEXT_232 = ")"; + protected final String TEXT_233 = NL + "\t * @see "; + protected final String TEXT_234 = "#get"; + protected final String TEXT_235 = "()"; + protected final String TEXT_236 = NL + "\t * @see "; + protected final String TEXT_237 = "#"; + protected final String TEXT_238 = NL + "\t * @model "; + protected final String TEXT_239 = NL + "\t * "; + protected final String TEXT_240 = NL + "\t * @model"; + protected final String TEXT_241 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_242 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_243 = NL + "\t"; + protected final String TEXT_244 = " "; + protected final String TEXT_245 = "();" + NL; + protected final String TEXT_246 = NL + "\tpublic "; + protected final String TEXT_247 = " "; + protected final String TEXT_248 = "()" + NL + "\t{"; + protected final String TEXT_249 = NL + "\t\treturn "; + protected final String TEXT_250 = "("; + protected final String TEXT_251 = "("; + protected final String TEXT_252 = ")get("; + protected final String TEXT_253 = ", true)"; + protected final String TEXT_254 = ")."; + protected final String TEXT_255 = "()"; + protected final String TEXT_256 = ";"; + protected final String TEXT_257 = NL + "\t\t"; + protected final String TEXT_258 = " "; + protected final String TEXT_259 = " = ("; + protected final String TEXT_260 = ")eVirtualGet("; + protected final String TEXT_261 = ");"; + protected final String TEXT_262 = NL + "\t\tif ("; + protected final String TEXT_263 = " == null)" + NL + "\t\t{"; + protected final String TEXT_264 = NL + "\t\t\teVirtualSet("; + protected final String TEXT_265 = ", "; + protected final String TEXT_266 = " = new "; + protected final String TEXT_267 = ");"; + protected final String TEXT_268 = NL + " \t\t"; + protected final String TEXT_269 = " = createSequence("; + protected final String TEXT_270 = ");" + NL + " \t"; + protected final String TEXT_271 = NL + " \t\t\t"; + protected final String TEXT_272 = " = createPropertyList(ListKind.CONTAINMENT, "; + protected final String TEXT_273 = ".class, "; + protected final String TEXT_274 = ");" + NL + " \t\t"; + protected final String TEXT_275 = NL + "\t\t}" + NL + "\t\treturn "; + protected final String TEXT_276 = ";"; + protected final String TEXT_277 = NL + "\t\tif (eContainerFeatureID != "; + protected final String TEXT_278 = ") return null;" + NL + "\t\treturn ("; + protected final String TEXT_279 = ")eContainer();"; + protected final String TEXT_280 = NL + "\t\t"; + protected final String TEXT_281 = " "; + protected final String TEXT_282 = " = ("; + protected final String TEXT_283 = ")eVirtualGet("; + protected final String TEXT_284 = ", "; + protected final String TEXT_285 = "_DEFAULT_"; + protected final String TEXT_286 = ");"; + protected final String TEXT_287 = NL + "\t\tif ("; + protected final String TEXT_288 = " != null && "; + protected final String TEXT_289 = ".isProxy())" + NL + "\t\t{" + NL + "\t\t\t"; + protected final String TEXT_290 = " old"; + protected final String TEXT_291 = " = ("; + protected final String TEXT_292 = ")"; + protected final String TEXT_293 = ";" + NL + "\t\t\t"; + protected final String TEXT_294 = " = "; + protected final String TEXT_295 = "eResolveProxy(old"; + protected final String TEXT_296 = ");" + NL + "\t\t\tif ("; + protected final String TEXT_297 = " != old"; + protected final String TEXT_298 = ")" + NL + "\t\t\t{"; + protected final String TEXT_299 = NL + "\t\t\t\t"; + protected final String TEXT_300 = " new"; + protected final String TEXT_301 = " = ("; + protected final String TEXT_302 = ")"; + protected final String TEXT_303 = ";"; + protected final String TEXT_304 = NL + "\t\t\t\tChangeContext changeContext = old"; + protected final String TEXT_305 = ".inverseRemove(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_306 = ", null, null);"; + protected final String TEXT_307 = NL + "\t\t\t\t"; + protected final String TEXT_308 = " changeContext = old"; + protected final String TEXT_309 = ".inverseRemove(this, "; + protected final String TEXT_310 = ", "; + protected final String TEXT_311 = ".class, null);"; + protected final String TEXT_312 = NL + "\t\t\t\tif (new"; + protected final String TEXT_313 = ".eInternalContainer() == null)" + NL + "\t\t\t\t{"; + protected final String TEXT_314 = NL + "\t\t\t\t\tchangeContext = new"; + protected final String TEXT_315 = ".eInverseAdd(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_316 = ", null, changeContext);"; + protected final String TEXT_317 = NL + "\t\t\t\t\tchangeContext = new"; + protected final String TEXT_318 = ".eInverseAdd(this, "; + protected final String TEXT_319 = ", "; + protected final String TEXT_320 = ".class, changeContext);"; + protected final String TEXT_321 = NL + "\t\t\t\t}" + NL + "\t\t\t\tif (changeContext != null) changeContext.dispatch();"; + protected final String TEXT_322 = NL + "\t\t\t\teVirtualSet("; + protected final String TEXT_323 = ", "; + protected final String TEXT_324 = ");"; + protected final String TEXT_325 = NL + "\t\t\t\tif (isNotifying())" + NL + "\t\t\t\t\tnotify(ChangeKind.RESOLVE, "; + protected final String TEXT_326 = ", old"; + protected final String TEXT_327 = ", "; + protected final String TEXT_328 = ");"; + protected final String TEXT_329 = NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_330 = NL + "\t\treturn ("; + protected final String TEXT_331 = ")eVirtualGet("; + protected final String TEXT_332 = ", "; + protected final String TEXT_333 = "_DEFAULT_"; + protected final String TEXT_334 = ");"; + protected final String TEXT_335 = NL + "\t\treturn ("; + protected final String TEXT_336 = " & "; + protected final String TEXT_337 = "_EFLAG) != 0;"; + protected final String TEXT_338 = NL + "\t\treturn "; + protected final String TEXT_339 = ";"; + protected final String TEXT_340 = NL + "\t\t"; + protected final String TEXT_341 = " "; + protected final String TEXT_342 = " = basicGet"; + protected final String TEXT_343 = "();" + NL + "\t\treturn "; + protected final String TEXT_344 = " != null && "; + protected final String TEXT_345 = ".isProxy() ? "; + protected final String TEXT_346 = "eResolveProxy(("; + protected final String TEXT_347 = ")"; + protected final String TEXT_348 = ") : "; + protected final String TEXT_349 = ";"; + protected final String TEXT_350 = NL + "\t\treturn create"; + protected final String TEXT_351 = "(get"; + protected final String TEXT_352 = "(), getType(), "; + protected final String TEXT_353 = ");"; + protected final String TEXT_354 = NL + "\t\treturn ("; + protected final String TEXT_355 = ")(("; + protected final String TEXT_356 = ")get"; + protected final String TEXT_357 = "()).list("; + protected final String TEXT_358 = ");"; + protected final String TEXT_359 = NL + " return get"; + protected final String TEXT_360 = "(get"; + protected final String TEXT_361 = "(), getType(), "; + protected final String TEXT_362 = ");" + NL; + protected final String TEXT_363 = NL + "\t\treturn (("; + protected final String TEXT_364 = ")get"; + protected final String TEXT_365 = "()).list("; + protected final String TEXT_366 = ");"; + protected final String TEXT_367 = NL + "\t\treturn "; + protected final String TEXT_368 = "("; + protected final String TEXT_369 = "("; + protected final String TEXT_370 = ")get(get"; + protected final String TEXT_371 = "(), getType(), "; + protected final String TEXT_372 = ")"; + protected final String TEXT_373 = ")."; + protected final String TEXT_374 = "()"; + protected final String TEXT_375 = ";"; + protected final String TEXT_376 = NL + "\t\treturn "; + protected final String TEXT_377 = "("; + protected final String TEXT_378 = "("; + protected final String TEXT_379 = ")get(get"; + protected final String TEXT_380 = "(), getType(), "; + protected final String TEXT_381 = ");"; + protected final String TEXT_382 = ")."; + protected final String TEXT_383 = "()"; + protected final String TEXT_384 = ";"; + protected final String TEXT_385 = NL + "\t\t// TODO: implement this method to return the '"; + protected final String TEXT_386 = "' "; + protected final String TEXT_387 = NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_388 = NL + "\t}" + NL; + protected final String TEXT_389 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_390 = " basicGet"; + protected final String TEXT_391 = "()" + NL + "\t{"; + protected final String TEXT_392 = NL + "\t\tif (eContainerFeatureID != "; + protected final String TEXT_393 = ") return null;" + NL + "\t\treturn ("; + protected final String TEXT_394 = ")eInternalContainer();"; + protected final String TEXT_395 = NL + "\t\treturn ("; + protected final String TEXT_396 = ")eVirtualGet("; + protected final String TEXT_397 = ");"; + protected final String TEXT_398 = NL + "\t\treturn "; + protected final String TEXT_399 = ";"; + protected final String TEXT_400 = NL + "\t\treturn ("; + protected final String TEXT_401 = ")get(get"; + protected final String TEXT_402 = "(), getType(), "; + protected final String TEXT_403 = ");"; + protected final String TEXT_404 = NL + "\t\treturn ("; + protected final String TEXT_405 = ")get"; + protected final String TEXT_406 = "().get("; + protected final String TEXT_407 = ", false);"; + protected final String TEXT_408 = NL + "\t\t// TODO: implement this method to return the '"; + protected final String TEXT_409 = "' "; + protected final String TEXT_410 = NL + "\t\t// -> do not perform proxy resolution" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_411 = NL + "\t}" + NL; + protected final String TEXT_412 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext basicSet"; + protected final String TEXT_413 = "("; + protected final String TEXT_414 = " new"; + protected final String TEXT_415 = ", ChangeContext changeContext)" + NL + "\t{"; + protected final String TEXT_416 = NL + "\t\tObject old"; + protected final String TEXT_417 = " = eVirtualSet("; + protected final String TEXT_418 = ", new"; + protected final String TEXT_419 = ");"; + protected final String TEXT_420 = NL + "\t\t"; + protected final String TEXT_421 = " old"; + protected final String TEXT_422 = " = "; + protected final String TEXT_423 = ";" + NL + "\t\t"; + protected final String TEXT_424 = " = new"; + protected final String TEXT_425 = ";"; + protected final String TEXT_426 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_427 = " == EVIRTUAL_NO_VALUE;"; + protected final String TEXT_428 = NL + "\t\tboolean old"; + protected final String TEXT_429 = "_set_ = ("; + protected final String TEXT_430 = " & "; + protected final String TEXT_431 = "_ESETFLAG) != 0;" + NL + "\t\t"; + protected final String TEXT_432 = " |= "; + protected final String TEXT_433 = "_ESETFLAG;"; + protected final String TEXT_434 = NL + "\t\tboolean old"; + protected final String TEXT_435 = "_set_ = "; + protected final String TEXT_436 = "_set_;" + NL + "\t\t"; + protected final String TEXT_437 = "_set_ = true;"; + protected final String TEXT_438 = NL + "\t\tif (isNotifying())" + NL + "\t\t{"; + protected final String TEXT_439 = NL + "\t\t\t"; + protected final String TEXT_440 = " notification = new "; + protected final String TEXT_441 = "(this, "; + protected final String TEXT_442 = ".SET, "; + protected final String TEXT_443 = ", "; + protected final String TEXT_444 = "isSetChange ? null : old"; + protected final String TEXT_445 = "old"; + protected final String TEXT_446 = ", new"; + protected final String TEXT_447 = ", "; + protected final String TEXT_448 = "isSetChange"; + protected final String TEXT_449 = "!old"; + protected final String TEXT_450 = "_set_"; + protected final String TEXT_451 = ");"; + protected final String TEXT_452 = NL + "\t\t\t"; + protected final String TEXT_453 = " notification = new "; + protected final String TEXT_454 = "(this, "; + protected final String TEXT_455 = ".SET, "; + protected final String TEXT_456 = ", "; + protected final String TEXT_457 = "old"; + protected final String TEXT_458 = " == EVIRTUAL_NO_VALUE ? null : old"; + protected final String TEXT_459 = "old"; + protected final String TEXT_460 = ", new"; + protected final String TEXT_461 = ");"; + protected final String TEXT_462 = NL + "\t\t\tif (changeContext == null) changeContext = notification; else changeContext.add(notification);" + NL + "\t\t}"; + protected final String TEXT_463 = NL + "\t\treturn changeContext;"; + protected final String TEXT_464 = NL + "\t\treturn (("; + protected final String TEXT_465 = ".Internal)(("; + protected final String TEXT_466 = ".Internal.Wrapper)get"; + protected final String TEXT_467 = "()).featureMap()).basicAdd("; + protected final String TEXT_468 = ", new"; + protected final String TEXT_469 = ", changeContext);"; + protected final String TEXT_470 = NL + "\t\treturn (("; + protected final String TEXT_471 = ".Internal)get"; + protected final String TEXT_472 = "()).basicAdd("; + protected final String TEXT_473 = ", new"; + protected final String TEXT_474 = ", changeContext);"; + protected final String TEXT_475 = NL + "\t\t// TODO: implement this method to set the contained '"; + protected final String TEXT_476 = "' "; + protected final String TEXT_477 = NL + "\t\t// -> this method is automatically invoked to keep the containment relationship in synch" + NL + "\t\t// -> do not modify other features" + NL + "\t\t// -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first)" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_478 = NL + "\t}" + NL; + protected final String TEXT_479 = NL + "\t/**" + NL + "\t * Sets the value of the '{@link "; + protected final String TEXT_480 = "#"; + protected final String TEXT_481 = " "; + protected final String TEXT_482 = "}' "; + protected final String TEXT_483 = "." + NL + "\t * " + NL + "\t * " + NL + "\t * @param value the new value of the '"; + protected final String TEXT_484 = "' "; + protected final String TEXT_485 = "."; + protected final String TEXT_486 = NL + "\t * @see "; + protected final String TEXT_487 = NL + "\t * @see #isSet"; + protected final String TEXT_488 = "()"; + protected final String TEXT_489 = NL + "\t * @see #unset"; + protected final String TEXT_490 = "()"; + protected final String TEXT_491 = NL + "\t * @see #"; + protected final String TEXT_492 = "()" + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_493 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_494 = NL + "\tvoid set"; + protected final String TEXT_495 = "("; + protected final String TEXT_496 = " value);" + NL; + protected final String TEXT_497 = NL + "\tpublic void set"; + protected final String TEXT_498 = "("; + protected final String TEXT_499 = " new"; + protected final String TEXT_500 = ")" + NL + "\t{"; + protected final String TEXT_501 = NL + "\t\t_set_("; + protected final String TEXT_502 = ", "; + protected final String TEXT_503 = "new "; + protected final String TEXT_504 = "("; + protected final String TEXT_505 = "new"; + protected final String TEXT_506 = ")"; + protected final String TEXT_507 = ");"; + protected final String TEXT_508 = NL + "\t\tif (new"; + protected final String TEXT_509 = " != eInternalContainer() || (eContainerFeatureID != "; + protected final String TEXT_510 = " && new"; + protected final String TEXT_511 = " != null))" + NL + "\t\t{" + NL + "\t\t\tif ("; + protected final String TEXT_512 = ".isAncestor(this, "; + protected final String TEXT_513 = "new"; + protected final String TEXT_514 = "))" + NL + "\t\t\t\tthrow new "; + protected final String TEXT_515 = "(\"Recursive containment not allowed for \" + toString());"; + protected final String TEXT_516 = NL + "\t\t\tChangeContext changeContext = null;" + NL + "\t\t\tif (eInternalContainer() != null)" + NL + "\t\t\t\tchangeContext = eBasicRemoveFromContainer(changeContext);" + NL + "\t\t\tif (new"; + protected final String TEXT_517 = " != null)" + NL + "\t\t\t\tchangeContext = (("; + protected final String TEXT_518 = ")new"; + protected final String TEXT_519 = ").eInverseAdd(this, "; + protected final String TEXT_520 = ", "; + protected final String TEXT_521 = ".class, changeContext);" + NL + "\t\t\tchangeContext = eBasicSetContainer(("; + protected final String TEXT_522 = ")new"; + protected final String TEXT_523 = ", "; + protected final String TEXT_524 = ", changeContext);" + NL + "\t\t\tif (changeContext != null) changeContext.dispatch();" + NL + "\t\t}"; + protected final String TEXT_525 = NL + "\t\telse if (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, "; + protected final String TEXT_526 = ", new"; + protected final String TEXT_527 = ", new"; + protected final String TEXT_528 = ");"; + protected final String TEXT_529 = NL + "\t\t"; + protected final String TEXT_530 = " "; + protected final String TEXT_531 = " = ("; + protected final String TEXT_532 = ")eVirtualGet("; + protected final String TEXT_533 = ");"; + protected final String TEXT_534 = NL + "\t\tif (new"; + protected final String TEXT_535 = " != "; + protected final String TEXT_536 = ")" + NL + "\t\t{" + NL + "\t\t\tChangeContext changeContext = null;" + NL + "\t\t\tif ("; + protected final String TEXT_537 = " != null)"; + protected final String TEXT_538 = NL + "\t\t\t\tchangeContext = (("; + protected final String TEXT_539 = ")"; + protected final String TEXT_540 = ").inverseRemove(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_541 = ", null, changeContext);" + NL + "\t\t\tif (new"; + protected final String TEXT_542 = " != null)" + NL + "\t\t\t\tchangeContext = (("; + protected final String TEXT_543 = ")new"; + protected final String TEXT_544 = ").eInverseAdd(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_545 = ", null, changeContext);"; + protected final String TEXT_546 = NL + "\t\t\t\tchangeContext = (("; + protected final String TEXT_547 = ")"; + protected final String TEXT_548 = ").inverseRemove(this, "; + protected final String TEXT_549 = ", "; + protected final String TEXT_550 = ".class, changeContext);" + NL + "\t\t\tif (new"; + protected final String TEXT_551 = " != null)" + NL + "\t\t\t\tchangeContext = (("; + protected final String TEXT_552 = ")new"; + protected final String TEXT_553 = ").eInverseAdd(this, "; + protected final String TEXT_554 = ", "; + protected final String TEXT_555 = ".class, changeContext);"; + protected final String TEXT_556 = NL + "\t\t\tchangeContext = basicSet"; + protected final String TEXT_557 = "("; + protected final String TEXT_558 = "new"; + protected final String TEXT_559 = ", changeContext);" + NL + "\t\t\tif (changeContext != null) changeContext.dispatch();" + NL + "\t\t}"; + protected final String TEXT_560 = NL + "\t\telse" + NL + " \t{"; + protected final String TEXT_561 = NL + "\t\t\tboolean old"; + protected final String TEXT_562 = "_set_ = eVirtualIsSet("; + protected final String TEXT_563 = ");"; + protected final String TEXT_564 = NL + "\t\t\tboolean old"; + protected final String TEXT_565 = "_set_ = ("; + protected final String TEXT_566 = " & "; + protected final String TEXT_567 = "_ESETFLAG) != 0;"; + protected final String TEXT_568 = NL + "\t\t\t"; + protected final String TEXT_569 = " |= "; + protected final String TEXT_570 = "_ESETFLAG;"; + protected final String TEXT_571 = NL + "\t\t\tboolean old"; + protected final String TEXT_572 = "_set_ = "; + protected final String TEXT_573 = "_set_;"; + protected final String TEXT_574 = NL + "\t\t\t"; + protected final String TEXT_575 = "_set_ = true;"; + protected final String TEXT_576 = NL + "\t\t\tif (isNotifying())" + NL + "\t\t\t\tnotify(ChangeKind.SET, "; + protected final String TEXT_577 = ", new"; + protected final String TEXT_578 = ", new"; + protected final String TEXT_579 = ", !old"; + protected final String TEXT_580 = "_set_);"; + protected final String TEXT_581 = NL + " \t}"; + protected final String TEXT_582 = NL + "\t\telse if (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, "; + protected final String TEXT_583 = ", new"; + protected final String TEXT_584 = ", new"; + protected final String TEXT_585 = ");"; + protected final String TEXT_586 = NL + "\t\t"; + protected final String TEXT_587 = " old"; + protected final String TEXT_588 = " = ("; + protected final String TEXT_589 = " & "; + protected final String TEXT_590 = "_EFLAG) != 0;"; + protected final String TEXT_591 = NL + "\t\tif (new"; + protected final String TEXT_592 = ") "; + protected final String TEXT_593 = " |= "; + protected final String TEXT_594 = "_EFLAG; else "; + protected final String TEXT_595 = " &= ~"; + protected final String TEXT_596 = "_EFLAG;"; + protected final String TEXT_597 = NL + "\t\t"; + protected final String TEXT_598 = " old"; + protected final String TEXT_599 = " = "; + protected final String TEXT_600 = ";"; + protected final String TEXT_601 = NL + "\t\t"; + protected final String TEXT_602 = " "; + protected final String TEXT_603 = " = new"; + protected final String TEXT_604 = " == null ? "; + protected final String TEXT_605 = "_DEFAULT_ : new"; + protected final String TEXT_606 = ";"; + protected final String TEXT_607 = NL + "\t\t"; + protected final String TEXT_608 = " = new"; + protected final String TEXT_609 = " == null ? "; + protected final String TEXT_610 = "_DEFAULT_ : new"; + protected final String TEXT_611 = ";"; + protected final String TEXT_612 = NL + "\t\t"; + protected final String TEXT_613 = " "; + protected final String TEXT_614 = " = "; + protected final String TEXT_615 = "new"; + protected final String TEXT_616 = ";"; + protected final String TEXT_617 = NL + "\t\t"; + protected final String TEXT_618 = " = "; + protected final String TEXT_619 = "new"; + protected final String TEXT_620 = ";"; + protected final String TEXT_621 = NL + "\t\tObject old"; + protected final String TEXT_622 = " = eVirtualSet("; + protected final String TEXT_623 = ", "; + protected final String TEXT_624 = ");"; + protected final String TEXT_625 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_626 = " == EVIRTUAL_NO_VALUE;"; + protected final String TEXT_627 = NL + "\t\tboolean old"; + protected final String TEXT_628 = "_set_ = ("; + protected final String TEXT_629 = " & "; + protected final String TEXT_630 = "_ESETFLAG) != 0;"; + protected final String TEXT_631 = NL + "\t\t"; + protected final String TEXT_632 = " |= "; + protected final String TEXT_633 = "_ESETFLAG;"; + protected final String TEXT_634 = NL + "\t\tboolean old"; + protected final String TEXT_635 = "_set_ = "; + protected final String TEXT_636 = "_set_;"; + protected final String TEXT_637 = NL + "\t\t"; + protected final String TEXT_638 = "_set_ = true;"; + protected final String TEXT_639 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, "; + protected final String TEXT_640 = ", "; + protected final String TEXT_641 = "isSetChange ? "; + protected final String TEXT_642 = "null"; + protected final String TEXT_643 = "_DEFAULT_"; + protected final String TEXT_644 = " : old"; + protected final String TEXT_645 = "old"; + protected final String TEXT_646 = ", "; + protected final String TEXT_647 = "new"; + protected final String TEXT_648 = ", "; + protected final String TEXT_649 = "isSetChange"; + protected final String TEXT_650 = "!old"; + protected final String TEXT_651 = "_set_"; + protected final String TEXT_652 = ");"; + protected final String TEXT_653 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.SET, "; + protected final String TEXT_654 = ", "; + protected final String TEXT_655 = "old"; + protected final String TEXT_656 = " == EVIRTUAL_NO_VALUE ? "; + protected final String TEXT_657 = "null"; + protected final String TEXT_658 = "_DEFAULT_"; + protected final String TEXT_659 = " : old"; + protected final String TEXT_660 = "old"; + protected final String TEXT_661 = ", "; + protected final String TEXT_662 = "new"; + protected final String TEXT_663 = ");"; + protected final String TEXT_664 = NL + " set(get"; + protected final String TEXT_665 = "(), getType(), "; + protected final String TEXT_666 = ", "; + protected final String TEXT_667 = " new "; + protected final String TEXT_668 = "("; + protected final String TEXT_669 = "new"; + protected final String TEXT_670 = ")"; + protected final String TEXT_671 = ");"; + protected final String TEXT_672 = NL + "\t\t(("; + protected final String TEXT_673 = ".Internal)get"; + protected final String TEXT_674 = "()).set("; + protected final String TEXT_675 = ", "; + protected final String TEXT_676 = "new "; + protected final String TEXT_677 = "("; + protected final String TEXT_678 = "new"; + protected final String TEXT_679 = ")"; + protected final String TEXT_680 = ");"; + protected final String TEXT_681 = NL + "\t\t// TODO: implement this method to set the '"; + protected final String TEXT_682 = "' "; + protected final String TEXT_683 = NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_684 = NL + "\t}" + NL; + protected final String TEXT_685 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext basicUnset"; + protected final String TEXT_686 = "(ChangeContext changeContext)" + NL + "\t{"; + protected final String TEXT_687 = NL + "\t\tObject old"; + protected final String TEXT_688 = " = eVirtualUnset("; + protected final String TEXT_689 = ");"; + protected final String TEXT_690 = NL + "\t\t"; + protected final String TEXT_691 = " old"; + protected final String TEXT_692 = " = "; + protected final String TEXT_693 = ";" + NL + "\t\t"; + protected final String TEXT_694 = " = null;"; + protected final String TEXT_695 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_696 = " != EVIRTUAL_NO_VALUE;"; + protected final String TEXT_697 = NL + "\t\tboolean old"; + protected final String TEXT_698 = "_set_ = ("; + protected final String TEXT_699 = " & "; + protected final String TEXT_700 = "_ESETFLAG) != 0;" + NL + "\t\t"; + protected final String TEXT_701 = " &= ~"; + protected final String TEXT_702 = "_ESETFLAG;"; + protected final String TEXT_703 = NL + "\t\tboolean old"; + protected final String TEXT_704 = "_set_ = "; + protected final String TEXT_705 = "_set_;" + NL + "\t\t"; + protected final String TEXT_706 = "_set_ = false;"; + protected final String TEXT_707 = NL + "\t\tif (isNotifying())" + NL + "\t\t{" + NL + "\t\t\t"; + protected final String TEXT_708 = " notification = new "; + protected final String TEXT_709 = "(this, "; + protected final String TEXT_710 = ".UNSET, "; + protected final String TEXT_711 = ", "; + protected final String TEXT_712 = "isSetChange ? old"; + protected final String TEXT_713 = " : null"; + protected final String TEXT_714 = "old"; + protected final String TEXT_715 = ", null, "; + protected final String TEXT_716 = "isSetChange"; + protected final String TEXT_717 = "old"; + protected final String TEXT_718 = "_set_"; + protected final String TEXT_719 = ");" + NL + "\t\t\tif (changeContext == null) changeContext = notification; else changeContext.add(notification);" + NL + "\t\t}" + NL + "\t\treturn changeContext;"; + protected final String TEXT_720 = NL + "\t\t// TODO: implement this method to unset the contained '"; + protected final String TEXT_721 = "' "; + protected final String TEXT_722 = NL + "\t\t// -> this method is automatically invoked to keep the containment relationship in synch" + NL + "\t\t// -> do not modify other features" + NL + "\t\t// -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first)" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_723 = NL + "\t}" + NL; + protected final String TEXT_724 = NL + "\t/**" + NL + "\t * Unsets the value of the '{@link "; + protected final String TEXT_725 = "#"; + protected final String TEXT_726 = " "; + protected final String TEXT_727 = "}' "; + protected final String TEXT_728 = "." + NL + "\t * " + NL + "\t * "; + protected final String TEXT_729 = NL + "\t * @see #isSet"; + protected final String TEXT_730 = "()"; + protected final String TEXT_731 = NL + "\t * @see #"; + protected final String TEXT_732 = "()"; + protected final String TEXT_733 = NL + "\t * @see #set"; + protected final String TEXT_734 = "("; + protected final String TEXT_735 = ")"; + protected final String TEXT_736 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_737 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_738 = NL + "\tvoid unset"; + protected final String TEXT_739 = "();" + NL; + protected final String TEXT_740 = NL + "\tpublic void unset"; + protected final String TEXT_741 = "()" + NL + "\t{"; + protected final String TEXT_742 = NL + "\t\tunset("; + protected final String TEXT_743 = ");"; + protected final String TEXT_744 = NL + "\t\t(("; + protected final String TEXT_745 = ".Unsettable)get"; + protected final String TEXT_746 = "()).unset();"; + protected final String TEXT_747 = NL + "\t\t"; + protected final String TEXT_748 = " "; + protected final String TEXT_749 = " = ("; + protected final String TEXT_750 = ")eVirtualGet("; + protected final String TEXT_751 = ");"; + protected final String TEXT_752 = NL + "\t\tif ("; + protected final String TEXT_753 = " != null)" + NL + "\t\t{" + NL + "\t\t\tChangeContext changeContext = null;"; + protected final String TEXT_754 = NL + "\t\t\tchangeContext = (("; + protected final String TEXT_755 = ")"; + protected final String TEXT_756 = ").inverseRemove(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_757 = ", null, changeContext);"; + protected final String TEXT_758 = NL + "\t\t\tchangeContext = (("; + protected final String TEXT_759 = ")"; + protected final String TEXT_760 = ").inverseRemove(this, "; + protected final String TEXT_761 = ", "; + protected final String TEXT_762 = ".class, changeContext);"; + protected final String TEXT_763 = NL + "\t\t\tchangeContext = basicUnset"; + protected final String TEXT_764 = "(changeContext);" + NL + "\t\t\tif (changeContext != null) changeContext.dispatch();" + NL + "\t\t}" + NL + "\t\telse" + NL + " \t{"; + protected final String TEXT_765 = NL + "\t\t\tboolean old"; + protected final String TEXT_766 = "_set_ = eVirtualIsSet("; + protected final String TEXT_767 = ");"; + protected final String TEXT_768 = NL + "\t\t\tboolean old"; + protected final String TEXT_769 = "_set_ = ("; + protected final String TEXT_770 = " & "; + protected final String TEXT_771 = "_ESETFLAG) != 0;"; + protected final String TEXT_772 = NL + "\t\t\t"; + protected final String TEXT_773 = " &= ~"; + protected final String TEXT_774 = "_ESETFLAG;"; + protected final String TEXT_775 = NL + "\t\t\tboolean old"; + protected final String TEXT_776 = "_set_ = "; + protected final String TEXT_777 = "_set_;"; + protected final String TEXT_778 = NL + "\t\t\t"; + protected final String TEXT_779 = "_set_ = false;"; + protected final String TEXT_780 = NL + "\t\t\tif (isNotifying())" + NL + "\t\t\t\tnotify(ChangeKind.UNSET, "; + protected final String TEXT_781 = ", null, null, old"; + protected final String TEXT_782 = "_set_);"; + protected final String TEXT_783 = NL + " \t}"; + protected final String TEXT_784 = NL + "\t\t"; + protected final String TEXT_785 = " old"; + protected final String TEXT_786 = " = ("; + protected final String TEXT_787 = " & "; + protected final String TEXT_788 = "_EFLAG) != 0;"; + protected final String TEXT_789 = NL + "\t\tObject old"; + protected final String TEXT_790 = " = eVirtualUnset("; + protected final String TEXT_791 = ");"; + protected final String TEXT_792 = NL + "\t\t"; + protected final String TEXT_793 = " old"; + protected final String TEXT_794 = " = "; + protected final String TEXT_795 = ";"; + protected final String TEXT_796 = NL + "\t\tboolean isSetChange = old"; + protected final String TEXT_797 = " != EVIRTUAL_NO_VALUE;"; + protected final String TEXT_798 = NL + "\t\tboolean old"; + protected final String TEXT_799 = "_set_ = ("; + protected final String TEXT_800 = " & "; + protected final String TEXT_801 = "_ESETFLAG) != 0;"; + protected final String TEXT_802 = NL + "\t\tboolean old"; + protected final String TEXT_803 = "_set_ = "; + protected final String TEXT_804 = "_set_;"; + protected final String TEXT_805 = NL + "\t\t"; + protected final String TEXT_806 = " = null;"; + protected final String TEXT_807 = NL + "\t\t"; + protected final String TEXT_808 = " &= ~"; + protected final String TEXT_809 = "_ESETFLAG;"; + protected final String TEXT_810 = NL + "\t\t"; + protected final String TEXT_811 = "_set_ = false;"; + protected final String TEXT_812 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.UNSET, "; + protected final String TEXT_813 = ", "; + protected final String TEXT_814 = "isSetChange ? old"; + protected final String TEXT_815 = " : null"; + protected final String TEXT_816 = "old"; + protected final String TEXT_817 = ", null, "; + protected final String TEXT_818 = "isSetChange"; + protected final String TEXT_819 = "old"; + protected final String TEXT_820 = "_set_"; + protected final String TEXT_821 = ");"; + protected final String TEXT_822 = NL + "\t\tif ("; + protected final String TEXT_823 = "_DEFAULT_) "; + protected final String TEXT_824 = " |= "; + protected final String TEXT_825 = "_EFLAG; else "; + protected final String TEXT_826 = " &= ~"; + protected final String TEXT_827 = "_EFLAG;"; + protected final String TEXT_828 = NL + "\t\t"; + protected final String TEXT_829 = " = "; + protected final String TEXT_830 = "_DEFAULT_;"; + protected final String TEXT_831 = NL + "\t\t"; + protected final String TEXT_832 = " &= ~"; + protected final String TEXT_833 = "_ESETFLAG;"; + protected final String TEXT_834 = NL + "\t\t"; + protected final String TEXT_835 = "_set_ = false;"; + protected final String TEXT_836 = NL + "\t\tif (isNotifying())" + NL + "\t\t\tnotify(ChangeKind.UNSET, "; + protected final String TEXT_837 = ", "; + protected final String TEXT_838 = "isSetChange ? old"; + protected final String TEXT_839 = " : "; + protected final String TEXT_840 = "_DEFAULT_"; + protected final String TEXT_841 = "old"; + protected final String TEXT_842 = ", "; + protected final String TEXT_843 = "_DEFAULT_, "; + protected final String TEXT_844 = "isSetChange"; + protected final String TEXT_845 = "old"; + protected final String TEXT_846 = "_set_"; + protected final String TEXT_847 = ");"; + protected final String TEXT_848 = NL + " unset(get"; + protected final String TEXT_849 = "(), getType(), "; + protected final String TEXT_850 = ");"; + protected final String TEXT_851 = NL + " unset"; + protected final String TEXT_852 = "(get"; + protected final String TEXT_853 = "());"; + protected final String TEXT_854 = NL + "\t\t// TODO: implement this method to unset the '"; + protected final String TEXT_855 = "' "; + protected final String TEXT_856 = NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_857 = NL + "\t}" + NL; + protected final String TEXT_858 = NL + "\t/**" + NL + "\t * Returns whether the value of the '{@link "; + protected final String TEXT_859 = "#"; + protected final String TEXT_860 = " "; + protected final String TEXT_861 = "}' "; + protected final String TEXT_862 = " is set." + NL + "\t * " + NL + "\t * " + NL + "\t * @return whether the value of the '"; + protected final String TEXT_863 = "' "; + protected final String TEXT_864 = " is set."; + protected final String TEXT_865 = NL + "\t * @see #unset"; + protected final String TEXT_866 = "()"; + protected final String TEXT_867 = NL + "\t * @see #"; + protected final String TEXT_868 = "()"; + protected final String TEXT_869 = NL + "\t * @see #set"; + protected final String TEXT_870 = "("; + protected final String TEXT_871 = ")"; + protected final String TEXT_872 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_873 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_874 = NL + "\tboolean isSet"; + protected final String TEXT_875 = "();" + NL; + protected final String TEXT_876 = NL + "\tpublic boolean isSet"; + protected final String TEXT_877 = "()" + NL + "\t{"; + protected final String TEXT_878 = NL + "\t\treturn isSet("; + protected final String TEXT_879 = ");"; + protected final String TEXT_880 = NL + "\t\t"; + protected final String TEXT_881 = " "; + protected final String TEXT_882 = " = ("; + protected final String TEXT_883 = ")eVirtualGet("; + protected final String TEXT_884 = ");"; + protected final String TEXT_885 = NL + "\t\treturn "; + protected final String TEXT_886 = " != null && (("; + protected final String TEXT_887 = ".Unsettable)"; + protected final String TEXT_888 = ").isSet();"; + protected final String TEXT_889 = NL + "\t\treturn eVirtualIsSet("; + protected final String TEXT_890 = ");"; + protected final String TEXT_891 = NL + "\t\treturn ("; + protected final String TEXT_892 = " & "; + protected final String TEXT_893 = "_ESETFLAG) != 0;"; + protected final String TEXT_894 = NL + "\t\treturn "; + protected final String TEXT_895 = "_set_;"; + protected final String TEXT_896 = NL + " return isSet(get"; + protected final String TEXT_897 = "(), getType(), "; + protected final String TEXT_898 = ");"; + protected final String TEXT_899 = NL + "\t\treturn !(("; + protected final String TEXT_900 = ".Internal)get"; + protected final String TEXT_901 = "()).isEmpty("; + protected final String TEXT_902 = ");"; + protected final String TEXT_903 = NL + "\t\t// TODO: implement this method to return whether the '"; + protected final String TEXT_904 = "' "; + protected final String TEXT_905 = " is set" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_906 = NL + "\t}" + NL; + protected final String TEXT_907 = NL + "\t/**" + NL + "\t * " + NL + "\t * "; + protected final String TEXT_908 = NL + "\t * " + NL + "\t * "; + protected final String TEXT_909 = NL + "\t * "; + protected final String TEXT_910 = NL + "\t * @model "; + protected final String TEXT_911 = NL + "\t * "; + protected final String TEXT_912 = NL + "\t * @model"; + protected final String TEXT_913 = NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_914 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_915 = NL + "\t"; + protected final String TEXT_916 = " "; + protected final String TEXT_917 = "("; + protected final String TEXT_918 = ")"; + protected final String TEXT_919 = ";" + NL; + protected final String TEXT_920 = NL + "\tpublic "; + protected final String TEXT_921 = " "; + protected final String TEXT_922 = "("; + protected final String TEXT_923 = ")"; + protected final String TEXT_924 = NL + "\t{"; + protected final String TEXT_925 = NL + "\t\t"; + protected final String TEXT_926 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// -> specify the condition that violates the invariant" + NL + "\t\t// -> verify the details of the diagnostic, including severity and message" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tif (false)" + NL + "\t\t{" + NL + "\t\t\tif ("; + protected final String TEXT_927 = " != null)" + NL + "\t\t\t{" + NL + "\t\t\t\t"; + protected final String TEXT_928 = ".add" + NL + "\t\t\t\t\t(new "; + protected final String TEXT_929 = NL + "\t\t\t\t\t\t("; + protected final String TEXT_930 = ".ERROR," + NL + "\t\t\t\t\t\t "; + protected final String TEXT_931 = ".DIAGNOSTIC_SOURCE," + NL + "\t\t\t\t\t\t "; + protected final String TEXT_932 = "."; + protected final String TEXT_933 = "," + NL + "\t\t\t\t\t\t "; + protected final String TEXT_934 = ".INSTANCE.getString(\"_UI_GenericInvariant_diagnostic\", new Object[] { \""; + protected final String TEXT_935 = "\", "; + protected final String TEXT_936 = ".getObjectLabel(this, "; + protected final String TEXT_937 = ") }),"; + protected final String TEXT_938 = NL + "\t\t\t\t\t\t new Object [] { this }));" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn true;"; + protected final String TEXT_939 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new UnsupportedOperationException();"; + protected final String TEXT_940 = NL + "\t}" + NL; + protected final String TEXT_941 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext eInverseAdd("; + protected final String TEXT_942 = " otherEnd, int propertyIndex, ChangeContext changeContext)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_943 = NL + "\t\t\tcase "; + protected final String TEXT_944 = ":"; + protected final String TEXT_945 = NL + "\t\t\t\treturn (("; + protected final String TEXT_946 = ")(("; + protected final String TEXT_947 = ".InternalMapView)"; + protected final String TEXT_948 = "()).eMap()).basicAdd(otherEnd, changeContext);"; + protected final String TEXT_949 = NL + "\t\t\t\treturn (("; + protected final String TEXT_950 = ")"; + protected final String TEXT_951 = "()).basicAdd(otherEnd, changeContext);"; + protected final String TEXT_952 = NL + "\t\t\t\tif (eInternalContainer() != null)" + NL + "\t\t\t\t\tchangeContext = eBasicRemoveFromContainer(changeContext);" + NL + "\t\t\t\treturn eBasicSetContainer(otherEnd, "; + protected final String TEXT_953 = ", changeContext);"; + protected final String TEXT_954 = NL + "\t\t\t\t"; + protected final String TEXT_955 = " "; + protected final String TEXT_956 = " = ("; + protected final String TEXT_957 = ")eVirtualGet("; + protected final String TEXT_958 = ");"; + protected final String TEXT_959 = NL + "\t\t\t\tif ("; + protected final String TEXT_960 = " != null)"; + protected final String TEXT_961 = NL + "\t\t\t\t\tchangeContext = (("; + protected final String TEXT_962 = ")"; + protected final String TEXT_963 = ").inverseRemove(this, EOPPOSITE_FEATURE_BASE - "; + protected final String TEXT_964 = ", null, changeContext);"; + protected final String TEXT_965 = NL + "\t\t\t\t\tchangeContext = (("; + protected final String TEXT_966 = ")"; + protected final String TEXT_967 = ").inverseRemove(this, "; + protected final String TEXT_968 = ", "; + protected final String TEXT_969 = ".class, changeContext);"; + protected final String TEXT_970 = NL + "\t\t\t\treturn basicSet"; + protected final String TEXT_971 = "(("; + protected final String TEXT_972 = ")otherEnd, changeContext);"; + protected final String TEXT_973 = NL + "\t\t}"; + protected final String TEXT_974 = NL + "\t\treturn super.eInverseAdd(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_975 = NL + "\t\treturn eDynamicInverseAdd(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_976 = NL + "\t}" + NL; + protected final String TEXT_977 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext inverseRemove("; + protected final String TEXT_978 = " otherEnd, int propertyIndex, ChangeContext changeContext)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_979 = NL + "\t\t\tcase "; + protected final String TEXT_980 = ":"; + protected final String TEXT_981 = NL + "\t\t\t\treturn (("; + protected final String TEXT_982 = ")(("; + protected final String TEXT_983 = ".InternalMapView)"; + protected final String TEXT_984 = "()).eMap()).basicRemove(otherEnd, changeContext);"; + protected final String TEXT_985 = NL + " \t\t\treturn removeFrom"; + protected final String TEXT_986 = "("; + protected final String TEXT_987 = "(), otherEnd, changeContext);"; + protected final String TEXT_988 = NL + "\t\t\t\treturn removeFromList("; + protected final String TEXT_989 = "(), otherEnd, changeContext);"; + protected final String TEXT_990 = NL + "\t\t\t\treturn eBasicSetContainer(null, "; + protected final String TEXT_991 = ", changeContext);"; + protected final String TEXT_992 = NL + "\t\t\t\treturn basicUnset"; + protected final String TEXT_993 = "(changeContext);"; + protected final String TEXT_994 = NL + "\t\t\t\treturn basicSet"; + protected final String TEXT_995 = "(null, changeContext);"; + protected final String TEXT_996 = NL + "\t\t}"; + protected final String TEXT_997 = NL + "\t\treturn super.inverseRemove(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_998 = NL + "\t\treturn eDynamicInverseRemove(otherEnd, propertyIndex, changeContext);"; + protected final String TEXT_999 = NL + "\t}" + NL; + protected final String TEXT_1000 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ChangeContext eBasicRemoveFromContainerFeature(ChangeContext changeContext)" + NL + "\t{" + NL + "\t\tswitch (eContainerFeatureID)" + NL + "\t\t{"; + protected final String TEXT_1001 = NL + "\t\t\tcase "; + protected final String TEXT_1002 = ":" + NL + "\t\t\t\treturn eInternalContainer().inverseRemove(this, "; + protected final String TEXT_1003 = ", "; + protected final String TEXT_1004 = ".class, changeContext);"; + protected final String TEXT_1005 = NL + "\t\t}"; + protected final String TEXT_1006 = NL + "\t\treturn super.eBasicRemoveFromContainerFeature(changeContext);"; + protected final String TEXT_1007 = NL + "\t\treturn eDynamicBasicRemoveFromContainer(changeContext);"; + protected final String TEXT_1008 = NL + "\t}" + NL; + protected final String TEXT_1009 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object get(int propertyIndex, boolean resolve)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1010 = NL + "\t\t\tcase "; + protected final String TEXT_1011 = ":"; + protected final String TEXT_1012 = NL + "\t\t\t\treturn "; + protected final String TEXT_1013 = "() ? Boolean.TRUE : Boolean.FALSE;"; + protected final String TEXT_1014 = NL + "\t\t\t\treturn new "; + protected final String TEXT_1015 = "("; + protected final String TEXT_1016 = "());"; + protected final String TEXT_1017 = NL + "\t\t\t\tif (resolve) return "; + protected final String TEXT_1018 = "();" + NL + "\t\t\t\treturn basicGet"; + protected final String TEXT_1019 = "();"; + protected final String TEXT_1020 = NL + "\t\t\t\tif (coreType) return (("; + protected final String TEXT_1021 = ".InternalMapView)"; + protected final String TEXT_1022 = "()).eMap();" + NL + "\t\t\t\telse return "; + protected final String TEXT_1023 = "();"; + protected final String TEXT_1024 = NL + "\t\t\t\tif (coreType) return "; + protected final String TEXT_1025 = "();" + NL + "\t\t\t\telse return "; + protected final String TEXT_1026 = "().map();"; + protected final String TEXT_1027 = NL + "\t\t\t\t// XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view" + NL + " \t\t//if (coreType) " + NL + "\t\t\t\treturn "; + protected final String TEXT_1028 = "();"; + protected final String TEXT_1029 = NL + "\t\t\t\tif (coreType) return "; + protected final String TEXT_1030 = "();" + NL + "\t\t\t\treturn (("; + protected final String TEXT_1031 = ".Internal)"; + protected final String TEXT_1032 = "()).getWrapper();"; + protected final String TEXT_1033 = NL + "\t\t\t\treturn "; + protected final String TEXT_1034 = "();"; + protected final String TEXT_1035 = NL + "\t\t}"; + protected final String TEXT_1036 = NL + "\t\treturn super.get(propertyIndex, resolve);"; + protected final String TEXT_1037 = NL + "\t\treturn eDynamicGet(propertyIndex, resolve, coreType);"; + protected final String TEXT_1038 = NL + "\t}" + NL; + protected final String TEXT_1039 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void set(int propertyIndex, Object newValue)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1040 = NL + "\t\t\tcase "; + protected final String TEXT_1041 = ":"; + protected final String TEXT_1042 = NL + " \tset"; + protected final String TEXT_1043 = "("; + protected final String TEXT_1044 = "(), newValue);"; + protected final String TEXT_1045 = NL + "\t\t\t\t(("; + protected final String TEXT_1046 = ".Internal)"; + protected final String TEXT_1047 = "()).set(newValue);"; + protected final String TEXT_1048 = NL + "\t\t\t\t(("; + protected final String TEXT_1049 = ".Setting)(("; + protected final String TEXT_1050 = ".InternalMapView)"; + protected final String TEXT_1051 = "()).eMap()).set(newValue);"; + protected final String TEXT_1052 = NL + "\t\t\t\t(("; + protected final String TEXT_1053 = ".Setting)"; + protected final String TEXT_1054 = "()).set(newValue);"; + protected final String TEXT_1055 = NL + "\t\t\t\t"; + protected final String TEXT_1056 = "().clear();" + NL + "\t\t\t\t"; + protected final String TEXT_1057 = "().addAll(("; + protected final String TEXT_1058 = ")newValue);"; + protected final String TEXT_1059 = NL + "\t\t\t\tset"; + protected final String TEXT_1060 = "((("; + protected final String TEXT_1061 = ")newValue)."; + protected final String TEXT_1062 = "());"; + protected final String TEXT_1063 = NL + "\t\t\t\tset"; + protected final String TEXT_1064 = "(("; + protected final String TEXT_1065 = ")newValue);"; + protected final String TEXT_1066 = NL + "\t\t\t\treturn;"; + protected final String TEXT_1067 = NL + "\t\t}"; + protected final String TEXT_1068 = NL + "\t\tsuper.set(propertyIndex, newValue);"; + protected final String TEXT_1069 = NL + "\t\teDynamicSet(propertyIndex, newValue);"; + protected final String TEXT_1070 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void unset(int propertyIndex)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1071 = NL + "\t\t\tcase "; + protected final String TEXT_1072 = ":"; + protected final String TEXT_1073 = NL + " \t\t\tunset"; + protected final String TEXT_1074 = "("; + protected final String TEXT_1075 = "());"; + protected final String TEXT_1076 = NL + "\t\t\t\t"; + protected final String TEXT_1077 = "().clear();"; + protected final String TEXT_1078 = NL + "\t\t\t\tunset"; + protected final String TEXT_1079 = "();"; + protected final String TEXT_1080 = NL + "\t\t\t\tset"; + protected final String TEXT_1081 = "(("; + protected final String TEXT_1082 = ")null);"; + protected final String TEXT_1083 = NL + "\t\t\t\tset"; + protected final String TEXT_1084 = "("; + protected final String TEXT_1085 = "_DEFAULT_);"; + protected final String TEXT_1086 = NL + "\t\t\t\treturn;"; + protected final String TEXT_1087 = NL + "\t\t}"; + protected final String TEXT_1088 = NL + "\t\tsuper.unset(propertyIndex);"; + protected final String TEXT_1089 = NL + "\t\teDynamicUnset(propertyIndex);"; + protected final String TEXT_1090 = NL + "\t}" + NL; + protected final String TEXT_1091 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isSet(int propertyIndex)" + NL + "\t{" + NL + "\t\tswitch (propertyIndex)" + NL + "\t\t{"; + protected final String TEXT_1092 = NL + "\t\t\tcase "; + protected final String TEXT_1093 = ":"; + protected final String TEXT_1094 = NL + " \t\treturn !is"; + protected final String TEXT_1095 = "Empty("; + protected final String TEXT_1096 = "());"; + protected final String TEXT_1097 = NL + " \t\t// KDK - should this be !isSequenceEmpty?" + NL + "\t\t\t\treturn "; + protected final String TEXT_1098 = " != null && !is"; + protected final String TEXT_1099 = "Empty("; + protected final String TEXT_1100 = "());"; + protected final String TEXT_1101 = NL + "\t\t\t\treturn "; + protected final String TEXT_1102 = " != null && !"; + protected final String TEXT_1103 = ".isEmpty();"; + protected final String TEXT_1104 = NL + "\t\t\t\t"; + protected final String TEXT_1105 = " "; + protected final String TEXT_1106 = " = ("; + protected final String TEXT_1107 = ")eVirtualGet("; + protected final String TEXT_1108 = ");" + NL + "\t\t\t\treturn "; + protected final String TEXT_1109 = " != null && !"; + protected final String TEXT_1110 = ".isEmpty();"; + protected final String TEXT_1111 = NL + "\t\t\t\treturn !"; + protected final String TEXT_1112 = "().isEmpty();"; + protected final String TEXT_1113 = NL + "\t\t\t\treturn isSet"; + protected final String TEXT_1114 = "();"; + protected final String TEXT_1115 = NL + "\t\t\t\treturn "; + protected final String TEXT_1116 = " != null;"; + protected final String TEXT_1117 = NL + "\t\t\t\treturn eVirtualGet("; + protected final String TEXT_1118 = ") != null;"; + protected final String TEXT_1119 = NL + "\t\t\t\treturn basicGet"; + protected final String TEXT_1120 = "() != null;"; + protected final String TEXT_1121 = NL + "\t\t\t\treturn "; + protected final String TEXT_1122 = " != null;"; + protected final String TEXT_1123 = NL + "\t\t\t\treturn eVirtualGet("; + protected final String TEXT_1124 = ") != null;"; + protected final String TEXT_1125 = NL + "\t\t\t\treturn "; + protected final String TEXT_1126 = "() != null;"; + protected final String TEXT_1127 = NL + "\t\t\t\treturn (("; + protected final String TEXT_1128 = " & "; + protected final String TEXT_1129 = "_EFLAG) != 0) != "; + protected final String TEXT_1130 = "_DEFAULT_;"; + protected final String TEXT_1131 = NL + "\t\t\t\treturn "; + protected final String TEXT_1132 = " != "; + protected final String TEXT_1133 = "_DEFAULT_;"; + protected final String TEXT_1134 = NL + "\t\t\t\treturn eVirtualGet("; + protected final String TEXT_1135 = ", "; + protected final String TEXT_1136 = "_DEFAULT_) != "; + protected final String TEXT_1137 = "_DEFAULT_;"; + protected final String TEXT_1138 = NL + "\t\t\t\treturn "; + protected final String TEXT_1139 = "() != "; + protected final String TEXT_1140 = "_DEFAULT_;"; + protected final String TEXT_1141 = NL + "\t\t\t\treturn "; + protected final String TEXT_1142 = "_DEFAULT_ == null ? "; + protected final String TEXT_1143 = " != null : !"; + protected final String TEXT_1144 = "_DEFAULT_.equals("; + protected final String TEXT_1145 = ");"; + protected final String TEXT_1146 = NL + "\t\t\t\t"; + protected final String TEXT_1147 = " "; + protected final String TEXT_1148 = " = ("; + protected final String TEXT_1149 = ")eVirtualGet("; + protected final String TEXT_1150 = ", "; + protected final String TEXT_1151 = "_DEFAULT_);" + NL + "\t\t\t\treturn "; + protected final String TEXT_1152 = "_DEFAULT_ == null ? "; + protected final String TEXT_1153 = " != null : !"; + protected final String TEXT_1154 = "_DEFAULT_.equals("; + protected final String TEXT_1155 = ");"; + protected final String TEXT_1156 = NL + "\t\t\t\treturn "; + protected final String TEXT_1157 = "_DEFAULT_ == null ? "; + protected final String TEXT_1158 = "() != null : !"; + protected final String TEXT_1159 = "_DEFAULT_.equals("; + protected final String TEXT_1160 = "());"; + protected final String TEXT_1161 = NL + "\t\t}"; + protected final String TEXT_1162 = NL + "\t\treturn super.isSet(propertyIndex);"; + protected final String TEXT_1163 = NL + "\t\treturn eDynamicIsSet(propertyIndex);"; + protected final String TEXT_1164 = NL + "\t}" + NL; + protected final String TEXT_1165 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass)" + NL + "\t{"; + protected final String TEXT_1166 = NL + "\t\tif (baseClass == "; + protected final String TEXT_1167 = ".class)" + NL + "\t\t{" + NL + "\t\t\tswitch (derivedFeatureID)" + NL + "\t\t\t{"; + protected final String TEXT_1168 = NL + "\t\t\t\tcase "; + protected final String TEXT_1169 = ": return "; + protected final String TEXT_1170 = ";"; + protected final String TEXT_1171 = NL + "\t\t\t\tdefault: return -1;" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_1172 = NL + "\t\treturn super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass)" + NL + "\t{"; + protected final String TEXT_1173 = NL + "\t\tif (baseClass == "; + protected final String TEXT_1174 = ".class)" + NL + "\t\t{" + NL + "\t\t\tswitch (baseFeatureID)" + NL + "\t\t\t{"; + protected final String TEXT_1175 = NL + "\t\t\t\tcase "; + protected final String TEXT_1176 = ": return "; + protected final String TEXT_1177 = ";"; + protected final String TEXT_1178 = NL + "\t\t\t\tdefault: return -1;" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_1179 = NL + "\t\treturn super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);" + NL + "\t}" + NL; + protected final String TEXT_1180 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Object[] eVirtualValues()" + NL + "\t{" + NL + "\t\treturn "; + protected final String TEXT_1181 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setVirtualValues(Object[] newValues)" + NL + "\t{" + NL + "\t\t"; + protected final String TEXT_1182 = " = newValues;" + NL + "\t}" + NL; + protected final String TEXT_1183 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected int eVirtualIndexBits(int offset)" + NL + "\t{" + NL + "\t\tswitch (offset)" + NL + "\t\t{"; + protected final String TEXT_1184 = NL + "\t\t\tcase "; + protected final String TEXT_1185 = " :" + NL + "\t\t\t\treturn "; + protected final String TEXT_1186 = ";"; + protected final String TEXT_1187 = NL + "\t\t\tdefault :" + NL + "\t\t\t\tthrow new IndexOutOfBoundsException();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setVirtualIndexBits(int offset, int newIndexBits)" + NL + "\t{" + NL + "\t\tswitch (offset)" + NL + "\t\t{"; + protected final String TEXT_1188 = NL + "\t\t\tcase "; + protected final String TEXT_1189 = " :" + NL + "\t\t\t\t"; + protected final String TEXT_1190 = " = newIndexBits;" + NL + "\t\t\t\tbreak;"; + protected final String TEXT_1191 = NL + "\t\t\tdefault :" + NL + "\t\t\t\tthrow new IndexOutOfBoundsException();" + NL + "\t\t}" + NL + "\t}" + NL; + protected final String TEXT_1192 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String toString()" + NL + "\t{" + NL + "\t\tif (isProxy()) return super.toString();" + NL + "" + NL + "\t\tStringBuffer result = new StringBuffer(super.toString());"; + protected final String TEXT_1193 = NL + "\t\tresult.append(\" ("; + protected final String TEXT_1194 = ": \");"; + protected final String TEXT_1195 = NL + "\t\tresult.append(\", "; + protected final String TEXT_1196 = ": \");"; + protected final String TEXT_1197 = NL + "\t\tif (eVirtualIsSet("; + protected final String TEXT_1198 = ")) result.append(eVirtualGet("; + protected final String TEXT_1199 = ")); else result.append(\"\");"; + protected final String TEXT_1200 = NL + "\t\tif ("; + protected final String TEXT_1201 = "("; + protected final String TEXT_1202 = " & "; + protected final String TEXT_1203 = "_ESETFLAG) != 0"; + protected final String TEXT_1204 = "_set_"; + protected final String TEXT_1205 = ") result.append(("; + protected final String TEXT_1206 = " & "; + protected final String TEXT_1207 = "_EFLAG) != 0); else result.append(\"\");"; + protected final String TEXT_1208 = NL + "\t\tif ("; + protected final String TEXT_1209 = "("; + protected final String TEXT_1210 = " & "; + protected final String TEXT_1211 = "_ESETFLAG) != 0"; + protected final String TEXT_1212 = "_set_"; + protected final String TEXT_1213 = ") result.append("; + protected final String TEXT_1214 = "); else result.append(\"\");"; + protected final String TEXT_1215 = NL + "\t\tresult.append(eVirtualGet("; + protected final String TEXT_1216 = ", "; + protected final String TEXT_1217 = "_DEFAULT_"; + protected final String TEXT_1218 = "));"; + protected final String TEXT_1219 = NL + "\t\tresult.append(("; + protected final String TEXT_1220 = " & "; + protected final String TEXT_1221 = "_EFLAG) != 0);"; + protected final String TEXT_1222 = NL + "\t\tresult.append("; + protected final String TEXT_1223 = ");"; + protected final String TEXT_1224 = NL + "\t\tresult.append(')');" + NL + "\t\treturn result.toString();" + NL + "\t}" + NL; + protected final String TEXT_1225 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected int hash = -1;" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + " \t * @generated" + NL + " \t */" + NL + "\tpublic int getHash()" + NL + "\t{" + NL + "\t\tif (hash == -1)" + NL + "\t\t{" + NL + "\t\t\tObject theKey = getKey();" + NL + "\t\t\thash = (theKey == null ? 0 : theKey.hashCode());" + NL + "\t\t}" + NL + "\t\treturn hash;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + " \t * " + NL + " \t * " + NL + " \t * @generated" + NL + " \t */" + NL + "\tpublic void setHash(int hash)" + NL + "\t{" + NL + "\t\tthis.hash = hash;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + " \t * " + NL + " \t * " + NL + " \t * @generated" + NL + " \t */" + NL + "\tpublic Object getKey()" + NL + "\t{" + NL + " \t"; + protected final String TEXT_1226 = NL + "\t\treturn new "; + protected final String TEXT_1227 = "(getTypedKey());" + NL + " \t"; + protected final String TEXT_1228 = NL + "\t\treturn getTypedKey();" + NL + " \t"; + protected final String TEXT_1229 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setKey(Object key)" + NL + "\t{"; + protected final String TEXT_1230 = NL + "\t\tgetTypedKey().addAll(("; + protected final String TEXT_1231 = ")key);"; + protected final String TEXT_1232 = NL + "\t\tsetTypedKey((("; + protected final String TEXT_1233 = ")key)."; + protected final String TEXT_1234 = "());"; + protected final String TEXT_1235 = NL + "\t\tsetTypedKey(("; + protected final String TEXT_1236 = ")key);"; + protected final String TEXT_1237 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getValue()" + NL + "\t{" + NL + " \t"; + protected final String TEXT_1238 = NL + "\t\treturn new "; + protected final String TEXT_1239 = "(getTypedValue());" + NL + " \t"; + protected final String TEXT_1240 = NL + "\t\treturn getTypedValue();" + NL + " \t"; + protected final String TEXT_1241 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object setValue(Object value)" + NL + "\t{" + NL + "\t\tObject oldValue = getValue();" + NL + " \t"; + protected final String TEXT_1242 = NL + "\t\tgetTypedValue().clear();" + NL + "\t\tgetTypedValue().addAll(("; + protected final String TEXT_1243 = ")value);" + NL + " \t"; + protected final String TEXT_1244 = NL + "\t\tsetTypedValue((("; + protected final String TEXT_1245 = ")value)."; + protected final String TEXT_1246 = "());" + NL + " \t"; + protected final String TEXT_1247 = NL + "\t\tsetTypedValue(("; + protected final String TEXT_1248 = ")value);" + NL + " \t"; + protected final String TEXT_1249 = NL + "\t\treturn oldValue;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_1250 = " getEMap()" + NL + "\t{" + NL + "\t\t"; + protected final String TEXT_1251 = " container = eContainer();" + NL + "\t\treturn container == null ? null : ("; + protected final String TEXT_1252 = ")container.get(eContainmentFeature());" + NL + "\t}"; + protected final String TEXT_1253 = NL + "} //"; + protected final String TEXT_1254 = NL; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + +/** + * + * + * Copyright (c) 2002-2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + * + * + */ + + GenClass genClass = (GenClass)((Object[])argument)[0]; GenPackage genPackage = genClass.getGenPackage(); GenModel genModel=genPackage.getGenModel(); + boolean isInterface = Boolean.TRUE.equals(((Object[])argument)[1]); boolean isImplementation = Boolean.TRUE.equals(((Object[])argument)[2]); + String publicStaticFinalFlag = isImplementation ? "public static final " : ""; + stringBuffer.append(TEXT_1); + stringBuffer.append(TEXT_2); + stringBuffer.append("$"); + stringBuffer.append(TEXT_3); + stringBuffer.append("$"); + stringBuffer.append(TEXT_4); + if (isInterface) { + stringBuffer.append(TEXT_5); + stringBuffer.append(genPackage.getInterfacePackageName()); + stringBuffer.append(TEXT_6); + } else { + stringBuffer.append(TEXT_7); + stringBuffer.append(genPackage.getClassPackageName()); + stringBuffer.append(TEXT_8); + } + stringBuffer.append(TEXT_9); + genModel.markImportLocation(stringBuffer, genPackage); + stringBuffer.append(TEXT_10); + if (isInterface) { + stringBuffer.append(TEXT_11); + stringBuffer.append(genClass.getFormattedName()); + stringBuffer.append(TEXT_12); + if (genClass.hasDocumentation()) { + stringBuffer.append(TEXT_13); + stringBuffer.append(genClass.getDocumentation(genModel.getIndentation(stringBuffer))); + stringBuffer.append(TEXT_14); + } + stringBuffer.append(TEXT_15); + if (!genClass.getGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_16); + for (Iterator i=genClass.getGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genFeature.isSuppressedGetVisibility()) { + stringBuffer.append(TEXT_17); + stringBuffer.append(genClass.getQualifiedInterfaceName()); + stringBuffer.append(TEXT_18); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_19); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_20); + } + } + stringBuffer.append(TEXT_21); + } + stringBuffer.append(TEXT_22); + if (!genModel.isSuppressEMFMetaData()) { + stringBuffer.append(TEXT_23); + stringBuffer.append(genPackage.getQualifiedPackageInterfaceName()); + stringBuffer.append(TEXT_24); + stringBuffer.append(genClass.getClassifierAccessorName()); + stringBuffer.append(TEXT_25); + } + if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genClass.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false; + stringBuffer.append(TEXT_26); + stringBuffer.append(modelInfo); + } else { + stringBuffer.append(TEXT_27); + stringBuffer.append(modelInfo); + }} if (first) { + stringBuffer.append(TEXT_28); + }} + if (genClass.needsRootExtendsInterfaceExtendsTag()) { + stringBuffer.append(TEXT_29); + stringBuffer.append(genModel.getImportedName(genModel.getRootExtendsInterface())); + } + stringBuffer.append(TEXT_30); + } else { + stringBuffer.append(TEXT_31); + stringBuffer.append(genClass.getFormattedName()); + stringBuffer.append(TEXT_32); + if (!genClass.getImplementedGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_33); + for (Iterator i=genClass.getImplementedGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + stringBuffer.append(TEXT_34); + stringBuffer.append(genClass.getQualifiedClassName()); + stringBuffer.append(TEXT_35); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_36); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_37); + } + stringBuffer.append(TEXT_38); + } + stringBuffer.append(TEXT_39); + } + if (isImplementation) { + stringBuffer.append(TEXT_40); + if (genClass.isAbstract()) { + stringBuffer.append(TEXT_41); + } + stringBuffer.append(TEXT_42); + stringBuffer.append(genClass.getClassName()); + stringBuffer.append(genClass.getClassExtends()); + stringBuffer.append(genClass.getClassImplements()); + } else { + stringBuffer.append(TEXT_43); + stringBuffer.append(genClass.getInterfaceName()); + stringBuffer.append(genClass.getInterfaceExtends()); + } + stringBuffer.append(TEXT_44); + if (genModel.getCopyrightText() != null) { + stringBuffer.append(TEXT_45); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_46); + stringBuffer.append(genModel.getCopyrightText()); + stringBuffer.append(TEXT_47); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_48); + } + if (isImplementation && genModel.getDriverNumber() != null) { + stringBuffer.append(TEXT_49); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_50); + stringBuffer.append(genModel.getDriverNumber()); + stringBuffer.append(TEXT_51); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_52); + } + if (isImplementation && genClass.isJavaIOSerializable()) { + stringBuffer.append(TEXT_53); + } + if (isImplementation && genModel.isVirtualDelegation()) { String eVirtualValuesField = genClass.getEVirtualValuesField(); + if (eVirtualValuesField != null) { + stringBuffer.append(TEXT_54); + stringBuffer.append(eVirtualValuesField); + stringBuffer.append(TEXT_55); + } + { List eVirtualIndexBitFields = genClass.getEVirtualIndexBitFields(new ArrayList()); + if (!eVirtualIndexBitFields.isEmpty()) { + for (Iterator i = eVirtualIndexBitFields.iterator(); i.hasNext();) { String eVirtualIndexBitField = (String)i.next(); + stringBuffer.append(TEXT_56); + stringBuffer.append(eVirtualIndexBitField); + stringBuffer.append(TEXT_57); + } + } + } + } + if (isImplementation && genClass.isModelRoot() && genModel.isBooleanFlagsEnabled() && genModel.getBooleanFlagsReservedBits() == -1) { + stringBuffer.append(TEXT_58); + stringBuffer.append(genModel.getBooleanFlagsField()); + stringBuffer.append(TEXT_59); + } + if (isImplementation && !genModel.isReflectiveDelegation()) { + for (Iterator i=genClass.getDeclaredFieldGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + stringBuffer.append(TEXT_60); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_61); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_62); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_63); + stringBuffer.append(genClass.getFeatureValue(genFeature)); + stringBuffer.append(TEXT_64); + if (genFeature.isListType() || genFeature.isReferenceType()) { + if (genClass.isField(genFeature)) { + stringBuffer.append(TEXT_65); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_66); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_67); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_68); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_69); + if (genFeature.getImportedType().equals("Sequence")){ + stringBuffer.append(TEXT_70); + stringBuffer.append(genFeature.getImportedEffectiveFeatureMapWrapperClass()); + stringBuffer.append(TEXT_71); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_72); + }else{ + stringBuffer.append(TEXT_73); + stringBuffer.append(genModel.getImportedName(genFeature.getType())); + stringBuffer.append(TEXT_74); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_75); + } + } + if (genModel.isArrayAccessors() && !genFeature.isFeatureMapType() && !genFeature.isMapType()) { + stringBuffer.append(TEXT_76); + stringBuffer.append(genFeature.getGetArrayAccessor()); + stringBuffer.append(TEXT_77); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_78); + stringBuffer.append(genFeature.getGetArrayAccessor()); + stringBuffer.append(TEXT_79); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_80); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_81); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_82); + } + } else { + if (!genFeature.isVolatile() || !genModel.isReflectiveDelegation() && (!genFeature.hasDelegateFeature() || !genFeature.isUnsettable())) { + stringBuffer.append(TEXT_83); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_84); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_85); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_86); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_87); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_88); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_89); + stringBuffer.append(genFeature.getStaticDefaultValue()); + stringBuffer.append(TEXT_90); + stringBuffer.append(genModel.getNonNLS(genFeature.getStaticDefaultValue())); + stringBuffer.append(TEXT_91); + } + if (genClass.isField(genFeature)) { + if (genClass.isFlag(genFeature)) { + if (genClass.getFlagIndex(genFeature) > 31 && genClass.getFlagIndex(genFeature) % 32 == 0) { + stringBuffer.append(TEXT_92); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_93); + } + stringBuffer.append(TEXT_94); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_95); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_96); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_97); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_98); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_99); + stringBuffer.append("<< " + genClass.getFlagIndex(genFeature) % 32 ); + stringBuffer.append(TEXT_100); + } else { + stringBuffer.append(TEXT_101); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_102); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_103); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_104); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_105); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_106); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_107); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_108); + } + } + } + if (genClass.isESetField(genFeature)) { + if (genClass.isESetFlag(genFeature)) { + if (genClass.getESetFlagIndex(genFeature) > 31 && genClass.getESetFlagIndex(genFeature) % 32 == 0) { + stringBuffer.append(TEXT_109); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_110); + } + stringBuffer.append(TEXT_111); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_112); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_113); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_114); + stringBuffer.append("<< " + genClass.getESetFlagIndex(genFeature) % 32 ); + stringBuffer.append(TEXT_115); + } else { + stringBuffer.append(TEXT_116); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_117); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_118); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_119); + } + } + } + //Class/declaredFieldGenFeature.override.javajetinc + } + if (isImplementation) { + stringBuffer.append(TEXT_120); + stringBuffer.append(genClass.getClassName()); + stringBuffer.append(TEXT_121); + for (Iterator i=genClass.getFlagGenFeatures("true").iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + stringBuffer.append(TEXT_122); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_123); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_124); + } + stringBuffer.append(TEXT_125); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Type")); + stringBuffer.append(TEXT_126); + stringBuffer.append(genModel.getImportedName("commonj.sdo.helper.TypeHelper")); + stringBuffer.append(TEXT_127); + stringBuffer.append(genClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_128); + } + for (Iterator i=(isImplementation ? genClass.getImplementedGenFeatures() : genClass.getDeclaredGenFeatures()).iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (genModel.isArrayAccessors() && genFeature.isListType() && !genFeature.isFeatureMapType() && !genFeature.isMapType()) { + stringBuffer.append(TEXT_129); + if (!isImplementation) { + stringBuffer.append(TEXT_130); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_131); + stringBuffer.append(genFeature.getGetArrayAccessor()); + stringBuffer.append(TEXT_132); + } else { + stringBuffer.append(TEXT_133); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_134); + stringBuffer.append(genFeature.getGetArrayAccessor()); + stringBuffer.append(TEXT_135); + if (genFeature.isVolatile()) { + stringBuffer.append(TEXT_136); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")); + stringBuffer.append(TEXT_137); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")); + stringBuffer.append(TEXT_138); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_139); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_140); + } else { + stringBuffer.append(TEXT_141); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_142); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_143); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_144); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")); + stringBuffer.append(TEXT_145); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")); + stringBuffer.append(TEXT_146); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_147); + } + stringBuffer.append(TEXT_148); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_149); + } + stringBuffer.append(TEXT_150); + if (!isImplementation) { + stringBuffer.append(TEXT_151); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_152); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_153); + } else { + stringBuffer.append(TEXT_154); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_155); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_156); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_157); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_158); + } + stringBuffer.append(TEXT_159); + if (!isImplementation) { + stringBuffer.append(TEXT_160); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_161); + } else { + stringBuffer.append(TEXT_162); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_163); + if (genFeature.isVolatile()) { + stringBuffer.append(TEXT_164); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_165); + } else { + stringBuffer.append(TEXT_166); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_167); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_168); + } + stringBuffer.append(TEXT_169); + } + stringBuffer.append(TEXT_170); + if (!isImplementation) { + stringBuffer.append(TEXT_171); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_172); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_173); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_174); + } else { + stringBuffer.append(TEXT_175); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_176); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_177); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_178); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")); + stringBuffer.append(TEXT_179); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_180); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_181); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_182); + } + stringBuffer.append(TEXT_183); + if (!isImplementation) { + stringBuffer.append(TEXT_184); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_185); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_186); + } else { + stringBuffer.append(TEXT_187); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_188); + stringBuffer.append(genFeature.getListItemType()); + stringBuffer.append(TEXT_189); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_190); + } + } + if (genFeature.isGet() && (isImplementation || !genFeature.isSuppressedGetVisibility())) { + if (isInterface) { + stringBuffer.append(TEXT_191); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_192); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_193); + if (genFeature.isListType()) { + if (genFeature.isMapType()) { GenFeature keyFeature = genFeature.getMapEntryTypeGenClass().getMapEntryKeyFeature(); GenFeature valueFeature = genFeature.getMapEntryTypeGenClass().getMapEntryValueFeature(); + stringBuffer.append(TEXT_194); + if (keyFeature.isListType()) { + stringBuffer.append(TEXT_195); + stringBuffer.append(keyFeature.getQualifiedListItemType()); + stringBuffer.append(TEXT_196); + } else { + stringBuffer.append(TEXT_197); + stringBuffer.append(keyFeature.getType()); + stringBuffer.append(TEXT_198); + } + stringBuffer.append(TEXT_199); + if (valueFeature.isListType()) { + stringBuffer.append(TEXT_200); + stringBuffer.append(valueFeature.getQualifiedListItemType()); + stringBuffer.append(TEXT_201); + } else { + stringBuffer.append(TEXT_202); + stringBuffer.append(valueFeature.getType()); + stringBuffer.append(TEXT_203); + } + stringBuffer.append(TEXT_204); + } else if (!genFeature.isWrappedFeatureMapType() && !(genModel.isSuppressEMFMetaData() && "org.eclipse.emf.ecore.EObject".equals(genFeature.getQualifiedListItemType()))) { + stringBuffer.append(TEXT_205); + stringBuffer.append(genFeature.getQualifiedListItemType()); + stringBuffer.append(TEXT_206); + } + } else if (genFeature.isSetDefaultValue()) { + stringBuffer.append(TEXT_207); + stringBuffer.append(genFeature.getDefaultValue()); + stringBuffer.append(TEXT_208); + } + if (genFeature.getTypeGenEnum() != null) { + stringBuffer.append(TEXT_209); + stringBuffer.append(genFeature.getTypeGenEnum().getQualifiedName()); + stringBuffer.append(TEXT_210); + } + if (genFeature.isBidirectional() && !genFeature.getReverse().getGenClass().isMapEntry()) { GenFeature reverseGenFeature = genFeature.getReverse(); + if (!reverseGenFeature.isSuppressedGetVisibility()) { + stringBuffer.append(TEXT_211); + stringBuffer.append(reverseGenFeature.getGenClass().getQualifiedInterfaceName()); + stringBuffer.append(TEXT_212); + stringBuffer.append(reverseGenFeature.getGetAccessor()); + stringBuffer.append(TEXT_213); + stringBuffer.append(reverseGenFeature.getFormattedName()); + stringBuffer.append(TEXT_214); + } + } + stringBuffer.append(TEXT_215); + if (!genFeature.hasDocumentation()) { + stringBuffer.append(TEXT_216); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_217); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_218); + } + stringBuffer.append(TEXT_219); + if (genFeature.hasDocumentation()) { + stringBuffer.append(TEXT_220); + stringBuffer.append(genFeature.getDocumentation(genModel.getIndentation(stringBuffer))); + stringBuffer.append(TEXT_221); + } + stringBuffer.append(TEXT_222); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_223); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_224); + if (genFeature.getTypeGenEnum() != null) { + stringBuffer.append(TEXT_225); + stringBuffer.append(genFeature.getTypeGenEnum().getQualifiedName()); + } + if (genFeature.isUnsettable()) { + if (!genFeature.isSuppressedIsSetVisibility()) { + stringBuffer.append(TEXT_226); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_227); + } + if (genFeature.isChangeable() && !genFeature.isSuppressedUnsetVisibility()) { + stringBuffer.append(TEXT_228); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_229); + } + } + if (genFeature.isChangeable() && !genFeature.isListType() && !genFeature.isSuppressedSetVisibility()) { + stringBuffer.append(TEXT_230); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_231); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_232); + } + if (!genModel.isSuppressEMFMetaData()) { + stringBuffer.append(TEXT_233); + stringBuffer.append(genPackage.getQualifiedPackageInterfaceName()); + stringBuffer.append(TEXT_234); + stringBuffer.append(genFeature.getFeatureAccessorName()); + stringBuffer.append(TEXT_235); + } + if (genFeature.isBidirectional() && !genFeature.getReverse().getGenClass().isMapEntry()) { GenFeature reverseGenFeature = genFeature.getReverse(); + if (!reverseGenFeature.isSuppressedGetVisibility()) { + stringBuffer.append(TEXT_236); + stringBuffer.append(reverseGenFeature.getGenClass().getQualifiedInterfaceName()); + stringBuffer.append(TEXT_237); + stringBuffer.append(reverseGenFeature.getGetAccessor()); + } + } + if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genFeature.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false; + stringBuffer.append(TEXT_238); + stringBuffer.append(modelInfo); + } else { + stringBuffer.append(TEXT_239); + stringBuffer.append(modelInfo); + }} if (first) { + stringBuffer.append(TEXT_240); + }} + stringBuffer.append(TEXT_241); + } else { + stringBuffer.append(TEXT_242); + } + if (!isImplementation) { + stringBuffer.append(TEXT_243); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_244); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_245); + } else { + stringBuffer.append(TEXT_246); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_247); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_248); + if (genModel.isReflectiveDelegation()) { + stringBuffer.append(TEXT_249); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_250); + } + stringBuffer.append(TEXT_251); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_252); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_253); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_254); + stringBuffer.append(genFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_255); + } + stringBuffer.append(TEXT_256); + } else if (!genFeature.isVolatile()) { + if (genFeature.isListType()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_257); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_258); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_259); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_260); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_261); + } + stringBuffer.append(TEXT_262); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_263); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_264); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_265); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_266); + stringBuffer.append(genClass.getListConstructor(genFeature)); + stringBuffer.append(TEXT_267); + } else { + if (genFeature.getImportedType().equals("Sequence")){ + stringBuffer.append(TEXT_268); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_269); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_270); + } else { + stringBuffer.append(TEXT_271); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_272); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_273); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_274); + } + } + stringBuffer.append(TEXT_275); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes() ? ".map()" : ""); + stringBuffer.append(TEXT_276); + } else if (genFeature.isContainer()) { + stringBuffer.append(TEXT_277); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_278); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_279); + } else { + if (genFeature.isResolveProxies()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_280); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_281); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_282); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_283); + stringBuffer.append(genFeature.getUpperName()); + if (!genFeature.isReferenceType()) { + stringBuffer.append(TEXT_284); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_285); + } + stringBuffer.append(TEXT_286); + } + stringBuffer.append(TEXT_287); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_288); + stringBuffer.append(genFeature.getSafeNameAsEObject()); + stringBuffer.append(TEXT_289); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_290); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_291); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_292); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_293); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_294); + stringBuffer.append(genFeature.getNonEObjectInternalTypeCast()); + stringBuffer.append(TEXT_295); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_296); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_297); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_298); + if (genFeature.isEffectiveContains()) { + stringBuffer.append(TEXT_299); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_300); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_301); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_302); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_303); + if (!genFeature.isBidirectional()) { + stringBuffer.append(TEXT_304); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_305); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_306); + } else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_307); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.notify.ChangeContext")); + stringBuffer.append(TEXT_308); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_309); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_310); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_311); + } + stringBuffer.append(TEXT_312); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_313); + if (!genFeature.isBidirectional()) { + stringBuffer.append(TEXT_314); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_315); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_316); + } else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_317); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_318); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_319); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_320); + } + stringBuffer.append(TEXT_321); + } else if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_322); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_323); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_324); + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_325); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_326); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_327); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_328); + } + stringBuffer.append(TEXT_329); + } + if (!genFeature.isResolveProxies() && genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_330); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_331); + stringBuffer.append(genFeature.getUpperName()); + if (!genFeature.isReferenceType()) { + stringBuffer.append(TEXT_332); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_333); + } + stringBuffer.append(TEXT_334); + } else if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_335); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_336); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_337); + } else { + stringBuffer.append(TEXT_338); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_339); + } + } + } else {//volatile + if (genFeature.isResolveProxies() && !genFeature.isListType()) { + stringBuffer.append(TEXT_340); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_341); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_342); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_343); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_344); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_345); + stringBuffer.append(genFeature.getNonEObjectInternalTypeCast()); + stringBuffer.append(TEXT_346); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_347); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_348); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_349); + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); + if (genFeature.isFeatureMapType()) { + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_350); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_351); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_352); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_353); + } else { + stringBuffer.append(TEXT_354); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_355); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_356); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_357); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_358); + } + } else if (genFeature.isListType()) { + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_359); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_360); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_361); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_362); + } else { + stringBuffer.append(TEXT_363); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_364); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_365); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_366); + } + } else { + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_367); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_368); + } + stringBuffer.append(TEXT_369); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_370); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_371); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_372); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_373); + stringBuffer.append(genFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_374); + } + stringBuffer.append(TEXT_375); + } else { + stringBuffer.append(TEXT_376); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_377); + } + stringBuffer.append(TEXT_378); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_379); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_380); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_381); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_382); + stringBuffer.append(genFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_383); + } + stringBuffer.append(TEXT_384); + } + } + } else { + stringBuffer.append(TEXT_385); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_386); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_387); + //Class/getGenFeature.todo.override.javajetinc + } + } + stringBuffer.append(TEXT_388); + } + //Class/getGenFeature.override.javajetinc + } + if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicGet()) { + stringBuffer.append(TEXT_389); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_390); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_391); + if (genFeature.isContainer()) { + stringBuffer.append(TEXT_392); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_393); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_394); + } else if (!genFeature.isVolatile()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_395); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_396); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_397); + } else { + stringBuffer.append(TEXT_398); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_399); + } + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_400); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_401); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_402); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_403); + } else { + stringBuffer.append(TEXT_404); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_405); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_406); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_407); + } + } else { + stringBuffer.append(TEXT_408); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_409); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_410); + //Class/basicGetGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_411); + //Class/basicGetGenFeature.override.javajetinc + } + if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicSet()) { + stringBuffer.append(TEXT_412); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_413); + stringBuffer.append(genFeature.getImportedInternalType()); + stringBuffer.append(TEXT_414); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_415); + if (!genFeature.isVolatile()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_416); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_417); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_418); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_419); + } else { + stringBuffer.append(TEXT_420); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_421); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_422); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_423); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_424); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_425); + } + if (genFeature.isUnsettable()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_426); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_427); + } else if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_428); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_429); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_430); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_431); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_432); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_433); + } else { + stringBuffer.append(TEXT_434); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_435); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_436); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_437); + } + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_438); + if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_439); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")); + stringBuffer.append(TEXT_440); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")); + stringBuffer.append(TEXT_441); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.notify.Notification")); + stringBuffer.append(TEXT_442); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_443); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_444); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(TEXT_445); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_446); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_447); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_448); + } else { + stringBuffer.append(TEXT_449); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_450); + } + stringBuffer.append(TEXT_451); + } else { + stringBuffer.append(TEXT_452); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")); + stringBuffer.append(TEXT_453); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")); + stringBuffer.append(TEXT_454); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.notify.Notification")); + stringBuffer.append(TEXT_455); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_456); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_457); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_458); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(TEXT_459); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_460); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_461); + } + stringBuffer.append(TEXT_462); + } + stringBuffer.append(TEXT_463); + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_464); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_465); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_466); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_467); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_468); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_469); + } else { + stringBuffer.append(TEXT_470); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_471); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_472); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_473); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_474); + } + } else { + stringBuffer.append(TEXT_475); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_476); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_477); + //Class/basicSetGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_478); + //Class/basicSetGenFeature.override.javajetinc + } + if (genFeature.isSet() && (isImplementation || !genFeature.isSuppressedSetVisibility())) { + if (isInterface) { + stringBuffer.append(TEXT_479); + stringBuffer.append(genClass.getQualifiedInterfaceName()); + stringBuffer.append(TEXT_480); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_481); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_482); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_483); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_484); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_485); + if (genFeature.isEnumType()) { + stringBuffer.append(TEXT_486); + stringBuffer.append(genFeature.getTypeGenEnum().getQualifiedName()); + } + if (genFeature.isUnsettable()) { + if (!genFeature.isSuppressedIsSetVisibility()) { + stringBuffer.append(TEXT_487); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_488); + } + if (!genFeature.isSuppressedUnsetVisibility()) { + stringBuffer.append(TEXT_489); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_490); + } + } + stringBuffer.append(TEXT_491); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_492); + } else { + stringBuffer.append(TEXT_493); + } + if (!isImplementation) { + stringBuffer.append(TEXT_494); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_495); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_496); + } else { + stringBuffer.append(TEXT_497); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_498); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_499); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_500); + if (genModel.isReflectiveDelegation()) { + stringBuffer.append(TEXT_501); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_502); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_503); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_504); + } + stringBuffer.append(TEXT_505); + stringBuffer.append(genFeature.getCapName()); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_506); + } + stringBuffer.append(TEXT_507); + } else if (!genFeature.isVolatile()) { + if (genFeature.isContainer()) { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_508); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_509); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_510); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_511); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil")); + stringBuffer.append(TEXT_512); + stringBuffer.append(genFeature.getEObjectCast()); + stringBuffer.append(TEXT_513); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_514); + stringBuffer.append(genModel.getImportedName("java.lang.IllegalArgumentException")); + stringBuffer.append(TEXT_515); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_516); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_517); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_518); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_519); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_520); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_521); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_522); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_523); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_524); + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_525); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_526); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_527); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_528); + } + } else if (genFeature.isBidirectional() || genFeature.isEffectiveContains()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_529); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_530); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_531); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_532); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_533); + } + stringBuffer.append(TEXT_534); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_535); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_536); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_537); + if (!genFeature.isBidirectional()) { + stringBuffer.append(TEXT_538); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_539); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_540); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_541); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_542); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_543); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_544); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_545); + } else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_546); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_547); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_548); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_549); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_550); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_551); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_552); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_553); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_554); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_555); + } + stringBuffer.append(TEXT_556); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_557); + stringBuffer.append(genFeature.getInternalTypeCast()); + stringBuffer.append(TEXT_558); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_559); + if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_560); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_561); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_562); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_563); + } else if (genClass.isESetFlag(genFeature)) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_564); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_565); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_566); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_567); + } + stringBuffer.append(TEXT_568); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_569); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_570); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_571); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_572); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_573); + } + stringBuffer.append(TEXT_574); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_575); + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_576); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_577); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_578); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_579); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_580); + } + stringBuffer.append(TEXT_581); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_582); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_583); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_584); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_585); + } + } + } else { + if (genClass.isFlag(genFeature)) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_586); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_587); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_588); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_589); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_590); + } + stringBuffer.append(TEXT_591); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_592); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_593); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_594); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_595); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_596); + } else { + if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_597); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_598); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_599); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_600); + } + } + if (genFeature.isEnumType()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_601); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_602); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_603); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_604); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_605); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_606); + } else { + stringBuffer.append(TEXT_607); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_608); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_609); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_610); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_611); + } + } else { + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_612); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_613); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_614); + stringBuffer.append(genFeature.getInternalTypeCast()); + stringBuffer.append(TEXT_615); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_616); + } else { + stringBuffer.append(TEXT_617); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_618); + stringBuffer.append(genFeature.getInternalTypeCast()); + stringBuffer.append(TEXT_619); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_620); + } + } + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_621); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_622); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_623); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_624); + } + } + if (genFeature.isUnsettable()) { + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_625); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_626); + } else if (genClass.isESetFlag(genFeature)) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_627); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_628); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_629); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_630); + } + stringBuffer.append(TEXT_631); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_632); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_633); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_634); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_635); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_636); + } + stringBuffer.append(TEXT_637); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_638); + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_639); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_640); + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_641); + if (genFeature.isReferenceType()) { + stringBuffer.append(TEXT_642); + } else { + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_643); + } + stringBuffer.append(TEXT_644); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(TEXT_645); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_646); + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_647); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(genFeature.getSafeName()); + } + stringBuffer.append(TEXT_648); + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_649); + } else { + stringBuffer.append(TEXT_650); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_651); + } + stringBuffer.append(TEXT_652); + } + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_653); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_654); + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_655); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_656); + if (genFeature.isReferenceType()) { + stringBuffer.append(TEXT_657); + } else { + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_658); + } + stringBuffer.append(TEXT_659); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(TEXT_660); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_661); + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_662); + stringBuffer.append(genFeature.getCapName()); + } else { + stringBuffer.append(genFeature.getSafeName()); + } + stringBuffer.append(TEXT_663); + } + } + } + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_664); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_665); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_666); + if (genFeature.isPrimitiveType()){ + stringBuffer.append(TEXT_667); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_668); + } + stringBuffer.append(TEXT_669); + stringBuffer.append(genFeature.getCapName()); + if (genFeature.isPrimitiveType()){ + stringBuffer.append(TEXT_670); + } + stringBuffer.append(TEXT_671); + } else { + stringBuffer.append(TEXT_672); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_673); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_674); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_675); + if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_676); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_677); + } + stringBuffer.append(TEXT_678); + stringBuffer.append(genFeature.getCapName()); + if (genFeature.isPrimitiveType()){ + stringBuffer.append(TEXT_679); + } + stringBuffer.append(TEXT_680); + } + } else { + stringBuffer.append(TEXT_681); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_682); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_683); + //Class/setGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_684); + } + //Class/setGenFeature.override.javajetinc + } + if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicUnset()) { + stringBuffer.append(TEXT_685); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_686); + if (!genFeature.isVolatile()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_687); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_688); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_689); + } else { + stringBuffer.append(TEXT_690); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_691); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_692); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_693); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_694); + } + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_695); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_696); + } else if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_697); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_698); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_699); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_700); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_701); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_702); + } else { + stringBuffer.append(TEXT_703); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_704); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_705); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_706); + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_707); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")); + stringBuffer.append(TEXT_708); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")); + stringBuffer.append(TEXT_709); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.notify.Notification")); + stringBuffer.append(TEXT_710); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_711); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_712); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_713); + } else { + stringBuffer.append(TEXT_714); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_715); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_716); + } else { + stringBuffer.append(TEXT_717); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_718); + } + stringBuffer.append(TEXT_719); + } + } else { + stringBuffer.append(TEXT_720); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_721); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_722); + //Class/basicUnsetGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_723); + //Class.basicUnsetGenFeature.override.javajetinc + } + if (genFeature.isUnset() && (isImplementation || !genFeature.isSuppressedUnsetVisibility())) { + if (isInterface) { + stringBuffer.append(TEXT_724); + stringBuffer.append(genClass.getQualifiedInterfaceName()); + stringBuffer.append(TEXT_725); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_726); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_727); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_728); + if (!genFeature.isSuppressedIsSetVisibility()) { + stringBuffer.append(TEXT_729); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_730); + } + stringBuffer.append(TEXT_731); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_732); + if (!genFeature.isListType() && !genFeature.isSuppressedSetVisibility()) { + stringBuffer.append(TEXT_733); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_734); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_735); + } + stringBuffer.append(TEXT_736); + } else { + stringBuffer.append(TEXT_737); + } + if (!isImplementation) { + stringBuffer.append(TEXT_738); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_739); + } else { + stringBuffer.append(TEXT_740); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_741); + if (genModel.isReflectiveDelegation()) { + stringBuffer.append(TEXT_742); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_743); + } else if (!genFeature.isVolatile()) { + if (genFeature.isListType()) { + stringBuffer.append(TEXT_744); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")); + stringBuffer.append(TEXT_745); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_746); + } else if (genFeature.isBidirectional() || genFeature.isEffectiveContains()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_747); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_748); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_749); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_750); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_751); + } + stringBuffer.append(TEXT_752); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_753); + if (!genFeature.isBidirectional()) { + stringBuffer.append(TEXT_754); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_755); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_756); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_757); + } else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_758); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_759); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_760); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_761); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_762); + } + stringBuffer.append(TEXT_763); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_764); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_765); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_766); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_767); + } else if (genClass.isESetFlag(genFeature)) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_768); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_769); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_770); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_771); + } + stringBuffer.append(TEXT_772); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_773); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_774); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_775); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_776); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_777); + } + stringBuffer.append(TEXT_778); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_779); + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_780); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_781); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_782); + } + stringBuffer.append(TEXT_783); + } else { + if (genClass.isFlag(genFeature)) { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_784); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_785); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_786); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_787); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_788); + } + } else if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_789); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_790); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_791); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_792); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_793); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_794); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_795); + } + } + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_796); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_797); + } else if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_798); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_799); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_800); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_801); + } else { + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_802); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_803); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_804); + } + } + if (genFeature.isReferenceType()) { + stringBuffer.append(TEXT_805); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_806); + if (!genModel.isVirtualDelegation()) { + if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_807); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_808); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_809); + } else { + stringBuffer.append(TEXT_810); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_811); + } + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_812); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_813); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_814); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_815); + } else { + stringBuffer.append(TEXT_816); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_817); + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_818); + } else { + stringBuffer.append(TEXT_819); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_820); + } + stringBuffer.append(TEXT_821); + } + } else { + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_822); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_823); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_824); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_825); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_826); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_827); + } else if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_828); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_829); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_830); + } + if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) { + if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_831); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_832); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_833); + } else { + stringBuffer.append(TEXT_834); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_835); + } + } + if (!genModel.isSuppressNotification()) { + stringBuffer.append(TEXT_836); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_837); + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_838); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_839); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_840); + } else { + stringBuffer.append(TEXT_841); + stringBuffer.append(genFeature.getCapName()); + } + stringBuffer.append(TEXT_842); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_843); + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_844); + } else { + stringBuffer.append(TEXT_845); + stringBuffer.append(genFeature.getCapName()); + stringBuffer.append(TEXT_846); + } + stringBuffer.append(TEXT_847); + } + } + } + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_848); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_849); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_850); + } else { + stringBuffer.append(TEXT_851); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_852); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_853); + } + } else { + stringBuffer.append(TEXT_854); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_855); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_856); + //Class/unsetGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_857); + } + //Class/unsetGenFeature.override.javajetinc + } + if (genFeature.isIsSet() && (isImplementation || !genFeature.isSuppressedIsSetVisibility())) { + if (isInterface) { + stringBuffer.append(TEXT_858); + stringBuffer.append(genClass.getQualifiedInterfaceName()); + stringBuffer.append(TEXT_859); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_860); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_861); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_862); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_863); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_864); + if (genFeature.isChangeable() && !genFeature.isSuppressedUnsetVisibility()) { + stringBuffer.append(TEXT_865); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_866); + } + stringBuffer.append(TEXT_867); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_868); + if (!genFeature.isListType() && genFeature.isChangeable() && !genFeature.isSuppressedSetVisibility()) { + stringBuffer.append(TEXT_869); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_870); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_871); + } + stringBuffer.append(TEXT_872); + } else { + stringBuffer.append(TEXT_873); + } + if (!isImplementation) { + stringBuffer.append(TEXT_874); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_875); + } else { + stringBuffer.append(TEXT_876); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_877); + if (genModel.isReflectiveDelegation()) { + stringBuffer.append(TEXT_878); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_879); + } else if (!genFeature.isVolatile()) { + if (genFeature.isListType()) { + if (genModel.isVirtualDelegation()) { + stringBuffer.append(TEXT_880); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_881); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_882); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_883); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_884); + } + stringBuffer.append(TEXT_885); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_886); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")); + stringBuffer.append(TEXT_887); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_888); + } else { + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_889); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_890); + } else if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_891); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_892); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_893); + } else { + stringBuffer.append(TEXT_894); + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_895); + } + } + } else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature(); + if (delegateFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_896); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_897); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_898); + } else { + stringBuffer.append(TEXT_899); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_900); + stringBuffer.append(delegateFeature.getAccessorName()); + stringBuffer.append(TEXT_901); + stringBuffer.append(genFeature.getQualifiedFeatureAccessor()); + stringBuffer.append(TEXT_902); + } + } else { + stringBuffer.append(TEXT_903); + stringBuffer.append(genFeature.getFormattedName()); + stringBuffer.append(TEXT_904); + stringBuffer.append(genFeature.getFeatureKind()); + stringBuffer.append(TEXT_905); + //Class/isSetGenFeature.todo.override.javajetinc + } + stringBuffer.append(TEXT_906); + } + //Class/isSetGenFeature.override.javajetinc + } + //Class/genFeature.override.javajetinc + }//for + for (Iterator i= (isImplementation ? genClass.getImplementedGenOperations() : genClass.getDeclaredGenOperations()).iterator(); i.hasNext();) { GenOperation genOperation = (GenOperation)i.next(); + if (isInterface) { + stringBuffer.append(TEXT_907); + if (genOperation.hasDocumentation()) { + stringBuffer.append(TEXT_908); + stringBuffer.append(genOperation.getDocumentation(genModel.getIndentation(stringBuffer))); + stringBuffer.append(TEXT_909); + } + if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genOperation.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false; + stringBuffer.append(TEXT_910); + stringBuffer.append(modelInfo); + } else { + stringBuffer.append(TEXT_911); + stringBuffer.append(modelInfo); + }} if (first) { + stringBuffer.append(TEXT_912); + }} + stringBuffer.append(TEXT_913); + } else { + stringBuffer.append(TEXT_914); + } + if (!isImplementation) { + stringBuffer.append(TEXT_915); + stringBuffer.append(genOperation.getImportedType()); + stringBuffer.append(TEXT_916); + stringBuffer.append(genOperation.getName()); + stringBuffer.append(TEXT_917); + stringBuffer.append(genOperation.getParameters()); + stringBuffer.append(TEXT_918); + stringBuffer.append(genOperation.getThrows()); + stringBuffer.append(TEXT_919); + } else { + stringBuffer.append(TEXT_920); + stringBuffer.append(genOperation.getImportedType()); + stringBuffer.append(TEXT_921); + stringBuffer.append(genOperation.getName()); + stringBuffer.append(TEXT_922); + stringBuffer.append(genOperation.getParameters()); + stringBuffer.append(TEXT_923); + stringBuffer.append(genOperation.getThrows()); + stringBuffer.append(TEXT_924); + if (genOperation.hasBody()) { + stringBuffer.append(TEXT_925); + stringBuffer.append(genOperation.getBody(genModel.getIndentation(stringBuffer))); + } else if (genOperation.isInvariant()) {GenClass opClass = genOperation.getGenClass(); String diagnostics = ((GenParameter)genOperation.getGenParameters().get(0)).getName(); String context = ((GenParameter)genOperation.getGenParameters().get(1)).getName(); + stringBuffer.append(TEXT_926); + stringBuffer.append(diagnostics); + stringBuffer.append(TEXT_927); + stringBuffer.append(diagnostics); + stringBuffer.append(TEXT_928); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic")); + stringBuffer.append(TEXT_929); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")); + stringBuffer.append(TEXT_930); + stringBuffer.append(opClass.getGenPackage().getImportedValidatorClassName()); + stringBuffer.append(TEXT_931); + stringBuffer.append(opClass.getGenPackage().getImportedValidatorClassName()); + stringBuffer.append(TEXT_932); + stringBuffer.append(opClass.getOperationID(genOperation)); + stringBuffer.append(TEXT_933); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin")); + stringBuffer.append(TEXT_934); + stringBuffer.append(genOperation.getName()); + stringBuffer.append(TEXT_935); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.EObjectValidator")); + stringBuffer.append(TEXT_936); + stringBuffer.append(context); + stringBuffer.append(TEXT_937); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(genModel.getNonNLS(2)); + stringBuffer.append(TEXT_938); + } else { + stringBuffer.append(TEXT_939); + //Class/implementedGenOperation.todo.override.javajetinc + } + stringBuffer.append(TEXT_940); + } + //Class/implementedGenOperation.override.javajetinc + }//for + if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEInverseAddGenFeatures())) { + stringBuffer.append(TEXT_941); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_942); + for (Iterator i=genClass.getEInverseAddGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_943); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_944); + if (genFeature.isListType()) { + if (genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes()) { + stringBuffer.append(TEXT_945); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")); + stringBuffer.append(TEXT_946); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_947); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_948); + } else { + stringBuffer.append(TEXT_949); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")); + stringBuffer.append(TEXT_950); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_951); + } + } else if (genFeature.isContainer()) { + stringBuffer.append(TEXT_952); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_953); + } else { + if (genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_954); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_955); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_956); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_957); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_958); + } + stringBuffer.append(TEXT_959); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_960); + if (genFeature.isEffectiveContains()) { + stringBuffer.append(TEXT_961); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_962); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_963); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_964); + } else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + stringBuffer.append(TEXT_965); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")); + stringBuffer.append(TEXT_966); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_967); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_968); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_969); + } + stringBuffer.append(TEXT_970); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_971); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_972); + } + } + } + stringBuffer.append(TEXT_973); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_974); + } else { + stringBuffer.append(TEXT_975); + } + stringBuffer.append(TEXT_976); + } + if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEInverseRemoveGenFeatures())) { + stringBuffer.append(TEXT_977); + stringBuffer.append(genModel.getImportedName("java.lang.Object")); + stringBuffer.append(TEXT_978); + for (Iterator i=genClass.getEInverseRemoveGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_979); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_980); + if (genFeature.isListType()) { + if (genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes()) { + stringBuffer.append(TEXT_981); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")); + stringBuffer.append(TEXT_982); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_983); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_984); + } else if (genFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_985); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_986); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_987); + } else { + stringBuffer.append(TEXT_988); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_989); + } + } else if (genFeature.isContainer()) { + stringBuffer.append(TEXT_990); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_991); + } else if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_992); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_993); + } else { + stringBuffer.append(TEXT_994); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_995); + } + } + } + stringBuffer.append(TEXT_996); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_997); + } else { + stringBuffer.append(TEXT_998); + } + stringBuffer.append(TEXT_999); + } + if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEBasicRemoveFromContainerGenFeatures())) { + stringBuffer.append(TEXT_1000); + for (Iterator i=genClass.getEBasicRemoveFromContainerGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_1001); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1002); + stringBuffer.append(targetClass.getQualifiedFeatureID(reverseFeature)); + stringBuffer.append(TEXT_1003); + stringBuffer.append(targetClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_1004); + } + } + stringBuffer.append(TEXT_1005); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1006); + } else { + stringBuffer.append(TEXT_1007); + } + stringBuffer.append(TEXT_1008); + } + if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getImplementedGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_1009); + for (Iterator i=genClass.getAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_1010); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1011); + if (genFeature.isPrimitiveType()) { + if (genFeature.isBooleanType()) { + stringBuffer.append(TEXT_1012); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1013); + } else { + stringBuffer.append(TEXT_1014); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_1015); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1016); + } + } else if (genFeature.isResolveProxies() && !genFeature.isListType()) { + stringBuffer.append(TEXT_1017); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1018); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1019); + } else if (genFeature.isMapType()) { + if (genFeature.isEffectiveSuppressEMFTypes()) { + stringBuffer.append(TEXT_1020); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_1021); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1022); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1023); + } else { + stringBuffer.append(TEXT_1024); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1025); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1026); + } + } else if (genFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_1027); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1028); + } else if (genFeature.isFeatureMapType()) { + stringBuffer.append(TEXT_1029); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1030); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_1031); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1032); + } else { + stringBuffer.append(TEXT_1033); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1034); + } + } + } + stringBuffer.append(TEXT_1035); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1036); + } else { + stringBuffer.append(TEXT_1037); + } + stringBuffer.append(TEXT_1038); + } + if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getESetGenFeatures())) { + stringBuffer.append(TEXT_1039); + for (Iterator i=genClass.getESetGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_1040); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1041); + if (genFeature.isListType()) { + if (genFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_1042); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1043); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1044); + } else if (genFeature.isFeatureMapType()) { + stringBuffer.append(TEXT_1045); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")); + stringBuffer.append(TEXT_1046); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1047); + } else if (genFeature.isMapType()) { + if (genFeature.isEffectiveSuppressEMFTypes()) { + stringBuffer.append(TEXT_1048); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); + stringBuffer.append(TEXT_1049); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_1050); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1051); + } else { + stringBuffer.append(TEXT_1052); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")); + stringBuffer.append(TEXT_1053); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1054); + } + } else { + stringBuffer.append(TEXT_1055); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1056); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1057); + stringBuffer.append(genModel.getImportedName("java.util.Collection")); + stringBuffer.append(TEXT_1058); + } + } else if (genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1059); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1060); + stringBuffer.append(genFeature.getObjectType()); + stringBuffer.append(TEXT_1061); + stringBuffer.append(genFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_1062); + } else { + stringBuffer.append(TEXT_1063); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1064); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1065); + } + stringBuffer.append(TEXT_1066); + } + } + stringBuffer.append(TEXT_1067); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1068); + } else { + stringBuffer.append(TEXT_1069); + } + stringBuffer.append(TEXT_1070); + for (Iterator i=genClass.getESetGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_1071); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1072); + if (genFeature.isListType() && !genFeature.isUnsettable()) { + if (genFeature.isWrappedFeatureMapType()) { + stringBuffer.append(TEXT_1073); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1074); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1075); + } else { + stringBuffer.append(TEXT_1076); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1077); + } + } else if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_1078); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1079); + } else if (genFeature.isReferenceType()) { + stringBuffer.append(TEXT_1080); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1081); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1082); + } else { + stringBuffer.append(TEXT_1083); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1084); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1085); + } + stringBuffer.append(TEXT_1086); + } + } + stringBuffer.append(TEXT_1087); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1088); + } else { + stringBuffer.append(TEXT_1089); + } + stringBuffer.append(TEXT_1090); + } + if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getImplementedGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_1091); + for (Iterator i=genClass.getAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); + if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) { + stringBuffer.append(TEXT_1092); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1093); + if (genFeature.isListType() && !genFeature.isUnsettable()) { + if (genFeature.isWrappedFeatureMapType()) { + if (genFeature.isVolatile()) { + stringBuffer.append(TEXT_1094); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1095); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1096); + } else { + stringBuffer.append(TEXT_1097); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1098); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1099); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1100); + } + } else { + if (genClass.isField(genFeature)) { + stringBuffer.append(TEXT_1101); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1102); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1103); + } else { + if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_1104); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1105); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1106); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1107); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1108); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1109); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1110); + } else { + stringBuffer.append(TEXT_1111); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1112); + } + } + } + } else if (genFeature.isUnsettable()) { + stringBuffer.append(TEXT_1113); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1114); + } else if (genFeature.isResolveProxies()) { + if (genClass.isField(genFeature)) { + stringBuffer.append(TEXT_1115); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1116); + } else { + if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_1117); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1118); + } else { + stringBuffer.append(TEXT_1119); + stringBuffer.append(genFeature.getAccessorName()); + stringBuffer.append(TEXT_1120); + } + } + } else if (genFeature.isReferenceType()) { + if (genClass.isField(genFeature)) { + stringBuffer.append(TEXT_1121); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1122); + } else { + if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_1123); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1124); + } else { + stringBuffer.append(TEXT_1125); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1126); + } + } + } else if (genFeature.isPrimitiveType() || genFeature.isEnumType()) { + if (genClass.isField(genFeature)) { + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_1127); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_1128); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1129); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1130); + } else { + stringBuffer.append(TEXT_1131); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1132); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1133); + } + } else { + if (genFeature.isEnumType() && genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_1134); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1135); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1136); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1137); + } else { + stringBuffer.append(TEXT_1138); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1139); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1140); + } + } + } else {//datatype + if (genClass.isField(genFeature)) { + stringBuffer.append(TEXT_1141); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1142); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1143); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1144); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1145); + } else { + if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) { + stringBuffer.append(TEXT_1146); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1147); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1148); + stringBuffer.append(genFeature.getImportedType()); + stringBuffer.append(TEXT_1149); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1150); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1151); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1152); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1153); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1154); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1155); + } else { + stringBuffer.append(TEXT_1156); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1157); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1158); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1159); + stringBuffer.append(genFeature.getGetAccessor()); + stringBuffer.append(TEXT_1160); + } + } + } + } + } + stringBuffer.append(TEXT_1161); + if (genModel.isMinimalReflectiveMethods()) { + stringBuffer.append(TEXT_1162); + } else { + stringBuffer.append(TEXT_1163); + } + stringBuffer.append(TEXT_1164); + //Class/eIsSet.override.javajetinc + } + if (isImplementation && !genClass.getMixinGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_1165); + for (Iterator m=genClass.getMixinGenClasses().iterator(); m.hasNext();) { GenClass mixinGenClass = (GenClass)m.next(); + stringBuffer.append(TEXT_1166); + stringBuffer.append(mixinGenClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_1167); + for (Iterator f=mixinGenClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); + stringBuffer.append(TEXT_1168); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1169); + stringBuffer.append(mixinGenClass.getQualifiedFeatureID(genFeature)); + stringBuffer.append(TEXT_1170); + } + stringBuffer.append(TEXT_1171); + } + stringBuffer.append(TEXT_1172); + for (Iterator m=genClass.getMixinGenClasses().iterator(); m.hasNext();) { GenClass mixinGenClass = (GenClass)m.next(); + stringBuffer.append(TEXT_1173); + stringBuffer.append(mixinGenClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_1174); + for (Iterator f=mixinGenClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); + stringBuffer.append(TEXT_1175); + stringBuffer.append(mixinGenClass.getQualifiedFeatureID(genFeature)); + stringBuffer.append(TEXT_1176); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1177); + } + stringBuffer.append(TEXT_1178); + } + stringBuffer.append(TEXT_1179); + } + if (isImplementation && genModel.isVirtualDelegation()) { String eVirtualValuesField = genClass.getEVirtualValuesField(); + if (eVirtualValuesField != null) { + stringBuffer.append(TEXT_1180); + stringBuffer.append(eVirtualValuesField); + stringBuffer.append(TEXT_1181); + stringBuffer.append(eVirtualValuesField); + stringBuffer.append(TEXT_1182); + } + { List eVirtualIndexBitFields = genClass.getEVirtualIndexBitFields(new ArrayList()); + if (!eVirtualIndexBitFields.isEmpty()) { List allEVirtualIndexBitFields = genClass.getAllEVirtualIndexBitFields(new ArrayList()); + stringBuffer.append(TEXT_1183); + for (int i = 0; i < allEVirtualIndexBitFields.size(); i++) { + stringBuffer.append(TEXT_1184); + stringBuffer.append(i); + stringBuffer.append(TEXT_1185); + stringBuffer.append(allEVirtualIndexBitFields.get(i)); + stringBuffer.append(TEXT_1186); + } + stringBuffer.append(TEXT_1187); + for (int i = 0; i < allEVirtualIndexBitFields.size(); i++) { + stringBuffer.append(TEXT_1188); + stringBuffer.append(i); + stringBuffer.append(TEXT_1189); + stringBuffer.append(allEVirtualIndexBitFields.get(i)); + stringBuffer.append(TEXT_1190); + } + stringBuffer.append(TEXT_1191); + } + } + } + if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getToStringGenFeatures().isEmpty()) { + stringBuffer.append(TEXT_1192); + { boolean first = true; + for (Iterator i=genClass.getToStringGenFeatures().iterator(); i.hasNext(); ) { GenFeature genFeature = (GenFeature)i.next(); + if (first) { first = false; + stringBuffer.append(TEXT_1193); + stringBuffer.append(genFeature.getName()); + stringBuffer.append(TEXT_1194); + stringBuffer.append(genModel.getNonNLS()); + } else { + stringBuffer.append(TEXT_1195); + stringBuffer.append(genFeature.getName()); + stringBuffer.append(TEXT_1196); + stringBuffer.append(genModel.getNonNLS()); + } + if (genFeature.isUnsettable() && !genFeature.isListType()) { + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1197); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1198); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1199); + stringBuffer.append(genModel.getNonNLS()); + } else { + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_1200); + if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_1201); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_1202); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1203); + } else { + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_1204); + } + stringBuffer.append(TEXT_1205); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_1206); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1207); + stringBuffer.append(genModel.getNonNLS()); + } else { + stringBuffer.append(TEXT_1208); + if (genClass.isESetFlag(genFeature)) { + stringBuffer.append(TEXT_1209); + stringBuffer.append(genClass.getESetFlagsField(genFeature)); + stringBuffer.append(TEXT_1210); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1211); + } else { + stringBuffer.append(genFeature.getUncapName()); + stringBuffer.append(TEXT_1212); + } + stringBuffer.append(TEXT_1213); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1214); + stringBuffer.append(genModel.getNonNLS()); + } + } + } else { + if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1215); + stringBuffer.append(genFeature.getUpperName()); + if (!genFeature.isListType() && !genFeature.isReferenceType()){ + stringBuffer.append(TEXT_1216); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1217); + } + stringBuffer.append(TEXT_1218); + } else { + if (genClass.isFlag(genFeature)) { + stringBuffer.append(TEXT_1219); + stringBuffer.append(genClass.getFlagsField(genFeature)); + stringBuffer.append(TEXT_1220); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_1221); + } else { + stringBuffer.append(TEXT_1222); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_1223); + } + } + } + } + } + stringBuffer.append(TEXT_1224); + } + if (isImplementation && genClass.isMapEntry()) { GenFeature keyFeature = genClass.getMapEntryKeyFeature(); GenFeature valueFeature = genClass.getMapEntryValueFeature(); + stringBuffer.append(TEXT_1225); + if (keyFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1226); + stringBuffer.append(keyFeature.getObjectType()); + stringBuffer.append(TEXT_1227); + } else { + stringBuffer.append(TEXT_1228); + } + stringBuffer.append(TEXT_1229); + if (keyFeature.isListType()) { + stringBuffer.append(TEXT_1230); + stringBuffer.append(genModel.getImportedName("java.util.Collection")); + stringBuffer.append(TEXT_1231); + } else if (keyFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1232); + stringBuffer.append(keyFeature.getObjectType()); + stringBuffer.append(TEXT_1233); + stringBuffer.append(keyFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_1234); + } else { + stringBuffer.append(TEXT_1235); + stringBuffer.append(keyFeature.getImportedType()); + stringBuffer.append(TEXT_1236); + } + stringBuffer.append(TEXT_1237); + if (valueFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1238); + stringBuffer.append(valueFeature.getObjectType()); + stringBuffer.append(TEXT_1239); + } else { + stringBuffer.append(TEXT_1240); + } + stringBuffer.append(TEXT_1241); + if (valueFeature.isListType()) { + stringBuffer.append(TEXT_1242); + stringBuffer.append(genModel.getImportedName("java.util.Collection")); + stringBuffer.append(TEXT_1243); + } else if (valueFeature.isPrimitiveType()) { + stringBuffer.append(TEXT_1244); + stringBuffer.append(valueFeature.getObjectType()); + stringBuffer.append(TEXT_1245); + stringBuffer.append(valueFeature.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_1246); + } else { + stringBuffer.append(TEXT_1247); + stringBuffer.append(valueFeature.getImportedType()); + stringBuffer.append(TEXT_1248); + } + stringBuffer.append(TEXT_1249); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_1250); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EObject")); + stringBuffer.append(TEXT_1251); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.util.EMap")); + stringBuffer.append(TEXT_1252); + } + stringBuffer.append(TEXT_1253); + stringBuffer.append(isInterface ? " " + genClass.getInterfaceName() : genClass.getClassName()); + // TODO fix the space above + genModel.emitSortedImports(); + stringBuffer.append(TEXT_1254); + return stringBuffer.toString(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java new file mode 100644 index 0000000000..c74f196d95 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java @@ -0,0 +1,1495 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.generate.templates.model; + +import java.util.*; +import org.eclipse.emf.codegen.ecore.genmodel.*; + +public class SDOFactoryClass +{ + protected static String nl; + public static synchronized SDOFactoryClass create(String lineSeparator) + { + nl = lineSeparator; + SDOFactoryClass result = new SDOFactoryClass(); + nl = null; + return result; + } + + protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; + protected final String TEXT_1 = ""; + protected final String TEXT_2 = "/**" + NL + " * " + NL + " * " + NL + " *" + NL + " * "; + protected final String TEXT_3 = "Id"; + protected final String TEXT_4 = NL + " */"; + protected final String TEXT_5 = NL + "package "; + protected final String TEXT_6 = ";"; + protected final String TEXT_7 = NL + "package "; + protected final String TEXT_8 = ";"; + protected final String TEXT_9 = NL; + protected final String TEXT_10 = NL; + protected final String TEXT_11 = NL + "/**" + NL + " * " + NL + " * The Factory for the model." + NL + " * It provides a create method for each non-abstract class of the model." + NL + " * "; + protected final String TEXT_12 = NL + " * @see "; + protected final String TEXT_13 = NL + " * @generated" + NL + " */"; + protected final String TEXT_14 = NL + "/**" + NL + " * " + NL + " * An implementation of the model Factory." + NL + " * " + NL + " * @generated" + NL + " */"; + protected final String TEXT_15 = NL + "public class "; + protected final String TEXT_16 = " extends "; + protected final String TEXT_17 = " implements "; + protected final String TEXT_18 = NL + "public interface "; + protected final String TEXT_19 = " extends "; + protected final String TEXT_20 = NL + "{"; + protected final String TEXT_21 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_22 = " copyright = \""; + protected final String TEXT_23 = "\";"; + protected final String TEXT_24 = NL; + protected final String TEXT_25 = NL; + protected final String TEXT_26 = NL + "\t/**" + NL + "\t * The singleton instance of the factory." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_27 = " INSTANCE = "; + protected final String TEXT_28 = ".init();" + NL; + protected final String TEXT_29 = NL + "\t/**" + NL + "\t * The singleton instance of the factory." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_30 = " eINSTANCE = "; + protected final String TEXT_31 = ".init();" + NL; + protected final String TEXT_32 = NL + "/**" + NL + " * The package namespace URI." + NL + " * " + NL + " * " + NL + " * @generated" + NL + " */"; + protected final String TEXT_33 = NL; + protected final String TEXT_34 = " NAMESPACE_URI = \""; + protected final String TEXT_35 = "\";"; + protected final String TEXT_36 = NL + NL + "/**" + NL + " * The package namespace name." + NL + " * " + NL + " * " + NL + " * @generated" + NL + " */"; + protected final String TEXT_37 = NL; + protected final String TEXT_38 = " NAMESPACE_PREFIX = \""; + protected final String TEXT_39 = "\";"; + protected final String TEXT_40 = NL + NL; + protected final String TEXT_41 = NL; + protected final String TEXT_42 = "int "; + protected final String TEXT_43 = " = "; + protected final String TEXT_44 = ";"; + protected final String TEXT_45 = NL + "\t" + NL + "\t" + NL + "\t/**" + NL + "\t * Creates the default factory implementation." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */"; + protected final String TEXT_46 = NL + NL + "\t/**" + NL + "\t * Creates an instance of the factory." + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_47 = "()" + NL + "\t{" + NL + "\t\tsuper(NAMESPACE_URI, NAMESPACE_PREFIX);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_48 = " create(int typeNumber)" + NL + "\t{" + NL + "\t\tswitch (typeNumber)" + NL + "\t\t{"; + protected final String TEXT_49 = NL + "\t\t\t// TODO make sure we're supposed to ingore DOCUMENT_ROOT" + NL + "\t\t\tcase "; + protected final String TEXT_50 = ": return ("; + protected final String TEXT_51 = ")create"; + protected final String TEXT_52 = "();"; + protected final String TEXT_53 = NL + "\t\t\tdefault:" + NL + "\t\t\t\treturn super.create(typeNumber);" + NL + "\t\t}" + NL + "\t}" + NL + NL; + protected final String TEXT_54 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object createFromString("; + protected final String TEXT_55 = " eDataType, String initialValue)" + NL + "\t{" + NL + "\t\tswitch (eDataType.getClassifierID())" + NL + "\t\t{"; + protected final String TEXT_56 = NL + "\t\t\tcase "; + protected final String TEXT_57 = "."; + protected final String TEXT_58 = ":" + NL + "\t\t\t\treturn create"; + protected final String TEXT_59 = "FromString(eDataType, initialValue);"; + protected final String TEXT_60 = NL + "\t\t\tdefault:" + NL + "\t\t\t\tthrow new IllegalArgumentException(\"The datatype '\" + eDataType.getName() + \"' is not a valid classifier\");"; + protected final String TEXT_61 = NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String convertToString("; + protected final String TEXT_62 = " eDataType, Object instanceValue)" + NL + "\t{" + NL + "\t\tswitch (eDataType.getClassifierID())" + NL + "\t\t{"; + protected final String TEXT_63 = NL + "\t\t\tcase "; + protected final String TEXT_64 = "."; + protected final String TEXT_65 = ":" + NL + "\t\t\t\treturn convert"; + protected final String TEXT_66 = "ToString(eDataType, instanceValue);"; + protected final String TEXT_67 = NL + "\t\t\tdefault:" + NL + "\t\t\t\tthrow new IllegalArgumentException(\"The datatype '\" + eDataType.getName() + \"' is not a valid classifier\");"; + protected final String TEXT_68 = NL + "\t\t}" + NL + "\t}" + NL; + protected final String TEXT_69 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_70 = " create"; + protected final String TEXT_71 = "()" + NL + "\t{"; + protected final String TEXT_72 = NL + "\t\t"; + protected final String TEXT_73 = " "; + protected final String TEXT_74 = " = "; + protected final String TEXT_75 = "super.create("; + protected final String TEXT_76 = ");"; + protected final String TEXT_77 = NL + "\t\t"; + protected final String TEXT_78 = " "; + protected final String TEXT_79 = " = new "; + protected final String TEXT_80 = "()"; + protected final String TEXT_81 = "{}"; + protected final String TEXT_82 = ";"; + protected final String TEXT_83 = NL + "\t\treturn "; + protected final String TEXT_84 = ";" + NL + "\t}" + NL + "\t" + NL + "\t// Following creates and initializes SDO metadata for the supported types." + NL + "\tprotected "; + protected final String TEXT_85 = " "; + protected final String TEXT_86 = "Type = null;" + NL + "\t" + NL + "\tpublic "; + protected final String TEXT_87 = " get"; + protected final String TEXT_88 = "()" + NL + "\t{" + NL + "\t\t// TODO - kdk - verify how to generate quoteType..."; + protected final String TEXT_89 = "Type?" + NL + "\t\treturn "; + protected final String TEXT_90 = "Type;" + NL + " }"; + protected final String TEXT_91 = NL + NL + "\tprivate static boolean isInited = false;" + NL + "\t" + NL + "\tpublic static "; + protected final String TEXT_92 = " init()" + NL + "\t{" + NL + " \tif (isInited) return ("; + protected final String TEXT_93 = ")FactoryBase.getStaticFactory("; + protected final String TEXT_94 = ".NAMESPACE_URI);" + NL + " \t"; + protected final String TEXT_95 = " the"; + protected final String TEXT_96 = " = new "; + protected final String TEXT_97 = "();" + NL + " \tisInited = true;" + NL + "" + NL + " \t// Initialize simple dependencies" + NL + " \t"; + protected final String TEXT_98 = ".registerStaticTypes("; + protected final String TEXT_99 = ".class);" + NL + " \t"; + protected final String TEXT_100 = ".registerStaticTypes("; + protected final String TEXT_101 = ".class);" + NL + " \t" + NL + " \t// Create package meta-data objects" + NL + " \tthe"; + protected final String TEXT_102 = ".createMetaData();" + NL + "" + NL + " \t// Initialize created meta-data" + NL + " \tthe"; + protected final String TEXT_103 = ".initializeMetaData();" + NL + "" + NL + " \t// Mark meta-data to indicate it can't be changed" + NL + " \t//the"; + protected final String TEXT_104 = ".freeze(); //FB do we need to freeze / should we freeze ????" + NL + "" + NL + " \treturn the"; + protected final String TEXT_105 = ";" + NL + "\t}" + NL + " " + NL + "\tprivate boolean isCreated = false;" + NL + "" + NL + "\tpublic void createMetaData()" + NL + "\t{" + NL + "\t\tif (isCreated) return;" + NL + "\t\tisCreated = true;"; + protected final String TEXT_106 = NL + " "; + protected final String TEXT_107 = NL + " "; + protected final String TEXT_108 = "Type = createType(false, "; + protected final String TEXT_109 = ");"; + protected final String TEXT_110 = NL + "\t\tcreateProperty("; + protected final String TEXT_111 = ", "; + protected final String TEXT_112 = "Type, "; + protected final String TEXT_113 = "."; + protected final String TEXT_114 = ");"; + protected final String TEXT_115 = NL + "\t}" + NL + "\tprivate boolean isInitialized = false;" + NL + "" + NL + "\tpublic void initializeMetaData()" + NL + "\t{" + NL + "\t\tif (isInitialized) return;" + NL + "\t\tisInitialized = true;" + NL + "" + NL + "\t\t// Obtain other dependent packages" + NL + "\t\t"; + protected final String TEXT_116 = " theModelPackageImpl = ("; + protected final String TEXT_117 = ")FactoryBase.getStaticFactory("; + protected final String TEXT_118 = ".NAMESPACE_URI);" + NL + "" + NL + "\t\t// Add supertypes to classes" + NL + "\t\t// Initialize classes and features; add operations and parameters"; + protected final String TEXT_119 = NL + "\t\t" + NL + "\t\tinitializeType("; + protected final String TEXT_120 = "Type, "; + protected final String TEXT_121 = ".class, \""; + protected final String TEXT_122 = "\");"; + protected final String TEXT_123 = NL + "\t\tinitializeProperty(("; + protected final String TEXT_124 = ")"; + protected final String TEXT_125 = "Type.getProperties().get("; + protected final String TEXT_126 = "."; + protected final String TEXT_127 = "), "; + protected final String TEXT_128 = ", \""; + protected final String TEXT_129 = "\", "; + protected final String TEXT_130 = ", "; + protected final String TEXT_131 = ", "; + protected final String TEXT_132 = ", "; + protected final String TEXT_133 = ", "; + protected final String TEXT_134 = ", "; + protected final String TEXT_135 = ", "; + protected final String TEXT_136 = ", "; + protected final String TEXT_137 = " , "; + protected final String TEXT_138 = ");"; + protected final String TEXT_139 = NL + "\t\tinitializeProperty(("; + protected final String TEXT_140 = ")"; + protected final String TEXT_141 = "Type.getProperties().get("; + protected final String TEXT_142 = "."; + protected final String TEXT_143 = "), "; + protected final String TEXT_144 = ", \""; + protected final String TEXT_145 = "\", "; + protected final String TEXT_146 = ", "; + protected final String TEXT_147 = ", "; + protected final String TEXT_148 = ", "; + protected final String TEXT_149 = ", "; + protected final String TEXT_150 = ", "; + protected final String TEXT_151 = ", "; + protected final String TEXT_152 = ");"; + protected final String TEXT_153 = "createXSDMetaData();" + NL + "\t}" + NL + " " + NL + "\tprotected void createXSDMetaData()" + NL + "\t{" + NL + "\t\tsuper.createXSDMetaData();"; + protected final String TEXT_154 = NL + "\t\t// TODO - kdk - is the order right? should kind, elementOnly be first" + NL + "\t\taddXSDMapping" + NL + "\t\t("; + protected final String TEXT_155 = "Type," + NL + "\t\tnew String[] " + NL + "\t\t{" + NL + "\t\t\"name\", \""; + protected final String TEXT_156 = "\"," + NL + "\t\t\"kind\", \"elementOnly\"" + NL + "\t\t});"; + protected final String TEXT_157 = NL + "\t\taddXSDMapping" + NL + "\t\t(("; + protected final String TEXT_158 = ")"; + protected final String TEXT_159 = "Type.getProperties().get("; + protected final String TEXT_160 = "."; + protected final String TEXT_161 = ")," + NL + "\t\tnew String[]" + NL + "\t\t{" + NL + "\t\t\"kind\", \"element\"," + NL + "\t\t\"name\", \""; + protected final String TEXT_162 = "\"" + NL + "\t\t});" + NL + "\t"; + protected final String TEXT_163 = NL; + protected final String TEXT_164 = NL + "\t\t// TODO - kdk - how do I filter out mixed, xMLNSPrefixMap, and xSISchemaLocation without hardcoding it" + NL + "\t\t// TODO - kdk - can I hardcode ##targetNamespace?" + NL + "\t"; + protected final String TEXT_165 = NL + "\t\tcreateGlobalProperty" + NL + "\t\t(\""; + protected final String TEXT_166 = "\", " + NL + "\t\t"; + protected final String TEXT_167 = ".get"; + protected final String TEXT_168 = "()," + NL + "\t\tnew String[] " + NL + "\t\t{" + NL + "\t\t\"kind\", \"element\"," + NL + "\t\t\"name\", \""; + protected final String TEXT_169 = "\"," + NL + "\t\t\"namespace\", \"##targetNamespace\"" + NL + "\t\t}); " + NL + "\t"; + protected final String TEXT_170 = NL + " }" + NL; + protected final String TEXT_171 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_172 = " create"; + protected final String TEXT_173 = "(String literal)" + NL + "\t{"; + protected final String TEXT_174 = NL + "\t\t"; + protected final String TEXT_175 = " result = "; + protected final String TEXT_176 = ".get(literal);" + NL + "\t\tif (result == null) throw new IllegalArgumentException(\"The value '\" + literal + \"' is not a valid enumerator of '\" + "; + protected final String TEXT_177 = ".getName() + \"'\");"; + protected final String TEXT_178 = NL + "\t\treturn result;"; + protected final String TEXT_179 = NL + "\t\treturn new "; + protected final String TEXT_180 = "(create"; + protected final String TEXT_181 = "(literal));"; + protected final String TEXT_182 = NL + "\t\treturn create"; + protected final String TEXT_183 = "(literal);"; + protected final String TEXT_184 = NL + "\t\treturn new "; + protected final String TEXT_185 = "("; + protected final String TEXT_186 = ".create"; + protected final String TEXT_187 = "(literal));"; + protected final String TEXT_188 = NL + "\t\treturn "; + protected final String TEXT_189 = ".create"; + protected final String TEXT_190 = "(literal);"; + protected final String TEXT_191 = NL + "\t\treturn ("; + protected final String TEXT_192 = ")"; + protected final String TEXT_193 = ".createFromString("; + protected final String TEXT_194 = ", literal);"; + protected final String TEXT_195 = NL + "\t\tif (literal == null) return null;" + NL + "\t\t"; + protected final String TEXT_196 = " result = new "; + protected final String TEXT_197 = "();" + NL + "\t\tfor ("; + protected final String TEXT_198 = " stringTokenizer = new "; + protected final String TEXT_199 = "(literal); stringTokenizer.hasMoreTokens(); )" + NL + "\t\t{" + NL + "\t\t\tString item = stringTokenizer.nextToken();"; + protected final String TEXT_200 = NL + "\t\t\tresult.add(create"; + protected final String TEXT_201 = "(item));"; + protected final String TEXT_202 = NL + "\t\t\tresult.add(create"; + protected final String TEXT_203 = "FromString("; + protected final String TEXT_204 = ", item));"; + protected final String TEXT_205 = NL + "\t\t\tresult.add("; + protected final String TEXT_206 = ".create"; + protected final String TEXT_207 = "(item));"; + protected final String TEXT_208 = NL + "\t\t\tresult.add("; + protected final String TEXT_209 = ".createFromString("; + protected final String TEXT_210 = ", item));"; + protected final String TEXT_211 = NL + "\t\t}" + NL + "\t\treturn result;"; + protected final String TEXT_212 = NL + "\t\tif (literal == null) return "; + protected final String TEXT_213 = ";" + NL + "\t\t"; + protected final String TEXT_214 = " result = "; + protected final String TEXT_215 = ";" + NL + "\t\tRuntimeException exception = null;"; + protected final String TEXT_216 = NL + "\t\ttry" + NL + "\t\t{"; + protected final String TEXT_217 = NL + "\t\t\tresult = create"; + protected final String TEXT_218 = "(literal);"; + protected final String TEXT_219 = NL + "\t\t\tresult = ("; + protected final String TEXT_220 = ")create"; + protected final String TEXT_221 = "FromString("; + protected final String TEXT_222 = ", literal);"; + protected final String TEXT_223 = NL + "\t\t\tresult = "; + protected final String TEXT_224 = ".create"; + protected final String TEXT_225 = "(literal);"; + protected final String TEXT_226 = NL + "\t\t\tresult = ("; + protected final String TEXT_227 = ")"; + protected final String TEXT_228 = ".createFromString("; + protected final String TEXT_229 = ", literal);"; + protected final String TEXT_230 = NL + "\t\t\tif ("; + protected final String TEXT_231 = "result != null && "; + protected final String TEXT_232 = ".INSTANCE.validate("; + protected final String TEXT_233 = ", "; + protected final String TEXT_234 = "new "; + protected final String TEXT_235 = "(result)"; + protected final String TEXT_236 = "result"; + protected final String TEXT_237 = ", null, null))" + NL + "\t\t\t{" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tcatch (RuntimeException e)" + NL + "\t\t{" + NL + "\t\t\texception = e;" + NL + "\t\t}"; + protected final String TEXT_238 = NL + "\t\tif ("; + protected final String TEXT_239 = "result != null || "; + protected final String TEXT_240 = "exception == null) return result;" + NL + " " + NL + "\t\tthrow exception;"; + protected final String TEXT_241 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new "; + protected final String TEXT_242 = "();"; + protected final String TEXT_243 = NL + "\t\treturn (("; + protected final String TEXT_244 = ")super.createFromString("; + protected final String TEXT_245 = ", literal))."; + protected final String TEXT_246 = "();"; + protected final String TEXT_247 = NL + "\t\treturn ("; + protected final String TEXT_248 = ")super.createFromString("; + protected final String TEXT_249 = ", literal);"; + protected final String TEXT_250 = NL + "\t}" + NL; + protected final String TEXT_251 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; + protected final String TEXT_252 = " create"; + protected final String TEXT_253 = "FromString("; + protected final String TEXT_254 = " eDataType, String initialValue)" + NL + "\t{"; + protected final String TEXT_255 = NL + "\t\treturn create"; + protected final String TEXT_256 = "(initialValue);"; + protected final String TEXT_257 = NL + "\t\t"; + protected final String TEXT_258 = " result = "; + protected final String TEXT_259 = ".get(initialValue);" + NL + "\t\tif (result == null) throw new IllegalArgumentException(\"The value '\" + initialValue + \"' is not a valid enumerator of '\" + eDataType.getName() + \"'\");"; + protected final String TEXT_260 = NL + "\t\treturn result;"; + protected final String TEXT_261 = NL + "\t\treturn ("; + protected final String TEXT_262 = ")create"; + protected final String TEXT_263 = "FromString("; + protected final String TEXT_264 = ", initialValue);"; + protected final String TEXT_265 = NL + "\t\treturn ("; + protected final String TEXT_266 = ")"; + protected final String TEXT_267 = ".createFromString("; + protected final String TEXT_268 = ", initialValue);"; + protected final String TEXT_269 = NL + "\t\treturn create"; + protected final String TEXT_270 = "(initialValue);"; + protected final String TEXT_271 = NL + "\t\tif (initialValue == null) return null;" + NL + "\t\t"; + protected final String TEXT_272 = " result = new "; + protected final String TEXT_273 = "();" + NL + "\t\tfor ("; + protected final String TEXT_274 = " stringTokenizer = new "; + protected final String TEXT_275 = "(initialValue); stringTokenizer.hasMoreTokens(); )" + NL + "\t\t{" + NL + "\t\t\tString item = stringTokenizer.nextToken();"; + protected final String TEXT_276 = NL + "\t\t\tresult.add(create"; + protected final String TEXT_277 = "FromString("; + protected final String TEXT_278 = ", item));"; + protected final String TEXT_279 = NL + "\t\t\tresult.add("; + protected final String TEXT_280 = ".createFromString("; + protected final String TEXT_281 = ", item));"; + protected final String TEXT_282 = NL + "\t\t}" + NL + "\t\treturn result;"; + protected final String TEXT_283 = NL + "\t\treturn new "; + protected final String TEXT_284 = "(create"; + protected final String TEXT_285 = "(initialValue));"; + protected final String TEXT_286 = NL + "\t\treturn create"; + protected final String TEXT_287 = "(initialValue);"; + protected final String TEXT_288 = NL + "\t\tif (initialValue == null) return null;" + NL + "\t\t"; + protected final String TEXT_289 = " result = null;" + NL + "\t\tRuntimeException exception = null;"; + protected final String TEXT_290 = NL + "\t\ttry" + NL + "\t\t{"; + protected final String TEXT_291 = NL + "\t\t\tresult = ("; + protected final String TEXT_292 = ")create"; + protected final String TEXT_293 = "FromString("; + protected final String TEXT_294 = ", initialValue);"; + protected final String TEXT_295 = NL + "\t\t\tresult = ("; + protected final String TEXT_296 = ")"; + protected final String TEXT_297 = ".createFromString("; + protected final String TEXT_298 = ", initialValue);"; + protected final String TEXT_299 = NL + "\t\t\tif (result != null && "; + protected final String TEXT_300 = ".INSTANCE.validate(eDataType, result, null, null))" + NL + "\t\t\t{" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tcatch (RuntimeException e)" + NL + "\t\t{" + NL + "\t\t\texception = e;" + NL + "\t\t}"; + protected final String TEXT_301 = NL + "\t\tif (result != null || exception == null) return result;" + NL + " " + NL + "\t\tthrow exception;"; + protected final String TEXT_302 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new "; + protected final String TEXT_303 = "();"; + protected final String TEXT_304 = NL + "\t\treturn ("; + protected final String TEXT_305 = ")super.createFromString(eDataType, initialValue);"; + protected final String TEXT_306 = NL + "\t}" + NL; + protected final String TEXT_307 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String convert"; + protected final String TEXT_308 = "("; + protected final String TEXT_309 = " instanceValue)" + NL + "\t{"; + protected final String TEXT_310 = NL + "\t\treturn instanceValue == null ? null : instanceValue.toString();"; + protected final String TEXT_311 = NL + "\t\treturn instanceValue == null ? null : convert"; + protected final String TEXT_312 = "(instanceValue."; + protected final String TEXT_313 = "());"; + protected final String TEXT_314 = NL + "\t\treturn convert"; + protected final String TEXT_315 = "(instanceValue);"; + protected final String TEXT_316 = NL + "\t\treturn "; + protected final String TEXT_317 = ".convert"; + protected final String TEXT_318 = "(instanceValue);"; + protected final String TEXT_319 = NL + "\t\treturn "; + protected final String TEXT_320 = ".convertToString("; + protected final String TEXT_321 = ", instanceValue);"; + protected final String TEXT_322 = NL + "\t\tif (instanceValue == null) return null;" + NL + "\t\tif (instanceValue.isEmpty()) return \"\";" + NL + "\t\t"; + protected final String TEXT_323 = " result = new "; + protected final String TEXT_324 = "();" + NL + "\t\tfor ("; + protected final String TEXT_325 = " i = instanceValue.iterator(); i.hasNext(); )" + NL + "\t\t{"; + protected final String TEXT_326 = NL + "\t\t\tresult.append(convert"; + protected final String TEXT_327 = "(("; + protected final String TEXT_328 = ")i.next()));"; + protected final String TEXT_329 = NL + "\t\t\tresult.append(convert"; + protected final String TEXT_330 = "ToString("; + protected final String TEXT_331 = ", i.next()));"; + protected final String TEXT_332 = NL + "\t\t\tresult.append("; + protected final String TEXT_333 = ".convert"; + protected final String TEXT_334 = "(("; + protected final String TEXT_335 = ")i.next()));"; + protected final String TEXT_336 = NL + "\t\t\tresult.append("; + protected final String TEXT_337 = ".convertToString("; + protected final String TEXT_338 = ", i.next()));"; + protected final String TEXT_339 = NL + "\t\t\tresult.append(' ');" + NL + "\t\t}" + NL + "\t\treturn result.substring(0, result.length() - 1);"; + protected final String TEXT_340 = NL + "\t\tif (instanceValue == null) return null;"; + protected final String TEXT_341 = NL + "\t\tif ("; + protected final String TEXT_342 = ".isInstance(instanceValue))" + NL + "\t\t{" + NL + "\t\t\ttry" + NL + "\t\t\t{"; + protected final String TEXT_343 = NL + "\t\t\t\tString value = convert"; + protected final String TEXT_344 = "(instanceValue);"; + protected final String TEXT_345 = NL + "\t\t\t\tString value = convert"; + protected final String TEXT_346 = "ToString("; + protected final String TEXT_347 = ", instanceValue);"; + protected final String TEXT_348 = NL + "\t\t\t\tString value = "; + protected final String TEXT_349 = ".convert"; + protected final String TEXT_350 = "(("; + protected final String TEXT_351 = ")instanceValue);"; + protected final String TEXT_352 = NL + "\t\t\t\tString value = "; + protected final String TEXT_353 = ".convertToString("; + protected final String TEXT_354 = ", instanceValue);"; + protected final String TEXT_355 = NL + "\t\t\t\tif (value != null) return value;" + NL + "\t\t\t}" + NL + "\t\t\tcatch (Exception e)" + NL + "\t\t\t{" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_356 = NL + "\t\ttry" + NL + "\t\t{"; + protected final String TEXT_357 = NL + "\t\t\tString value = convert"; + protected final String TEXT_358 = "(instanceValue);"; + protected final String TEXT_359 = NL + "\t\t\tString value = convert"; + protected final String TEXT_360 = "ToString("; + protected final String TEXT_361 = ", new "; + protected final String TEXT_362 = "(instanceValue));"; + protected final String TEXT_363 = NL + "\t\t\tString value = "; + protected final String TEXT_364 = ".convert"; + protected final String TEXT_365 = "(instanceValue);"; + protected final String TEXT_366 = NL + "\t\t\tString value = "; + protected final String TEXT_367 = ".convertToString("; + protected final String TEXT_368 = ", new "; + protected final String TEXT_369 = "(instanceValue));"; + protected final String TEXT_370 = NL + "\t\t\tif (value != null) return value;" + NL + "\t\t}" + NL + "\t\tcatch (Exception e)" + NL + "\t\t{" + NL + "\t\t}"; + protected final String TEXT_371 = NL + "\t\tthrow new IllegalArgumentException(\"Invalid value: '\"+instanceValue+\"' for datatype :\"+"; + protected final String TEXT_372 = ".getName());"; + protected final String TEXT_373 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new "; + protected final String TEXT_374 = "();"; + protected final String TEXT_375 = NL + "\t\treturn super.convertToString("; + protected final String TEXT_376 = ", new "; + protected final String TEXT_377 = "(instanceValue));"; + protected final String TEXT_378 = NL + "\t\treturn super.convertToString("; + protected final String TEXT_379 = ", instanceValue);"; + protected final String TEXT_380 = NL + "\t}" + NL; + protected final String TEXT_381 = NL + "\t/**" + NL + "\t * " + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String convert"; + protected final String TEXT_382 = "ToString("; + protected final String TEXT_383 = " eDataType, Object instanceValue)" + NL + "\t{"; + protected final String TEXT_384 = NL + "\t\treturn instanceValue == null ? null : instanceValue.toString();"; + protected final String TEXT_385 = NL + "\t\treturn convert"; + protected final String TEXT_386 = "ToString("; + protected final String TEXT_387 = ", instanceValue);"; + protected final String TEXT_388 = NL + "\t\treturn "; + protected final String TEXT_389 = ".convertToString("; + protected final String TEXT_390 = ", instanceValue);"; + protected final String TEXT_391 = NL + "\t\treturn convert"; + protected final String TEXT_392 = "(("; + protected final String TEXT_393 = ")instanceValue);"; + protected final String TEXT_394 = NL + "\t\tif (instanceValue == null) return null;" + NL + "\t\t"; + protected final String TEXT_395 = " list = ("; + protected final String TEXT_396 = ")instanceValue;" + NL + "\t\tif (list.isEmpty()) return \"\";" + NL + "\t\t"; + protected final String TEXT_397 = " result = new "; + protected final String TEXT_398 = "();" + NL + "\t\tfor ("; + protected final String TEXT_399 = " i = list.iterator(); i.hasNext(); )" + NL + "\t\t{"; + protected final String TEXT_400 = NL + "\t\t\tresult.append(convert"; + protected final String TEXT_401 = "ToString("; + protected final String TEXT_402 = ", i.next()));"; + protected final String TEXT_403 = NL + "\t\t\tresult.append("; + protected final String TEXT_404 = ".convertToString("; + protected final String TEXT_405 = ", i.next()));"; + protected final String TEXT_406 = NL + "\t\t\tresult.append(' ');" + NL + "\t\t}" + NL + "\t\treturn result.substring(0, result.length() - 1);"; + protected final String TEXT_407 = NL + "\t\treturn instanceValue == null ? null : convert"; + protected final String TEXT_408 = "((("; + protected final String TEXT_409 = ")instanceValue)."; + protected final String TEXT_410 = "());"; + protected final String TEXT_411 = NL + "\t\treturn convert"; + protected final String TEXT_412 = "(instanceValue);"; + protected final String TEXT_413 = NL + "\t\tif (instanceValue == null) return null;"; + protected final String TEXT_414 = NL + "\t\tif ("; + protected final String TEXT_415 = ".isInstance(instanceValue))" + NL + "\t\t{" + NL + "\t\t\ttry" + NL + "\t\t\t{"; + protected final String TEXT_416 = NL + "\t\t\t\tString value = convert"; + protected final String TEXT_417 = "ToString("; + protected final String TEXT_418 = ", instanceValue);"; + protected final String TEXT_419 = NL + "\t\t\t\tString value = "; + protected final String TEXT_420 = ".convertToString("; + protected final String TEXT_421 = ", instanceValue);"; + protected final String TEXT_422 = NL + "\t\t\t\tif (value != null) return value;" + NL + "\t\t\t}" + NL + "\t\t\tcatch (Exception e)" + NL + "\t\t\t{" + NL + "\t\t\t}" + NL + "\t\t}"; + protected final String TEXT_423 = NL + "\t\tthrow new IllegalArgumentException(\"Invalid value: '\"+instanceValue+\"' for datatype :\"+eDataType.getName());"; + protected final String TEXT_424 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new "; + protected final String TEXT_425 = "();"; + protected final String TEXT_426 = NL + "\t\treturn super.convertToString(eDataType, instanceValue);"; + protected final String TEXT_427 = NL + "\t}" + NL; + protected final String TEXT_428 = NL + "\t/**" + NL + "\t * Returns a new object of class '"; + protected final String TEXT_429 = "'." + NL + "\t * " + NL + "\t * " + NL + "\t * @return a new object of class '"; + protected final String TEXT_430 = "'." + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_431 = " create"; + protected final String TEXT_432 = "();" + NL; + protected final String TEXT_433 = NL + "\t/**" + NL + "\t * Returns an instance of data type '"; + protected final String TEXT_434 = "' corresponding the given literal." + NL + "\t * " + NL + "\t * " + NL + "\t * @param literal a literal of the data type." + NL + "\t * @return a new instance value of the data type." + NL + "\t * @generated" + NL + "\t */" + NL + "\t"; + protected final String TEXT_435 = " create"; + protected final String TEXT_436 = "(String literal);" + NL + "" + NL + "\t/**" + NL + "\t * Returns a literal representation of an instance of data type '"; + protected final String TEXT_437 = "'." + NL + "\t * " + NL + "\t * " + NL + "\t * @param instanceValue an instance value of the data type." + NL + "\t * @return a literal representation of the instance value." + NL + "\t * @generated" + NL + "\t */" + NL + "\tString convert"; + protected final String TEXT_438 = "("; + protected final String TEXT_439 = " instanceValue);" + NL; + protected final String TEXT_440 = NL + "} //"; + protected final String TEXT_441 = NL; + + public String generate(Object argument) + { + final StringBuffer stringBuffer = new StringBuffer(); + +/** + * + * + * Copyright (c) 2002-2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + * + * + */ + + GenPackage genPackage = (GenPackage)((Object[])argument)[0]; GenModel genModel=genPackage.getGenModel(); + boolean isInterface = Boolean.TRUE.equals(((Object[])argument)[1]); boolean isImplementation = Boolean.TRUE.equals(((Object[])argument)[2]); + String publicStaticFinalFlag = isImplementation ? "public static final " : ""; + stringBuffer.append(TEXT_1); + stringBuffer.append(TEXT_2); + stringBuffer.append("$"); + stringBuffer.append(TEXT_3); + stringBuffer.append("$"); + stringBuffer.append(TEXT_4); + if (isInterface || genModel.isSuppressInterfaces()) { + stringBuffer.append(TEXT_5); + stringBuffer.append(genPackage.getReflectionPackageName()); + stringBuffer.append(TEXT_6); + } else { + stringBuffer.append(TEXT_7); + stringBuffer.append(genPackage.getClassPackageName()); + stringBuffer.append(TEXT_8); + } + stringBuffer.append(TEXT_9); + if (isImplementation) { + if (!genPackage.hasJavaLangConflict() && !genPackage.hasInterfaceImplConflict() && !genPackage.getClassPackageName().equals(genPackage.getInterfacePackageName())) genModel.addImport(genPackage.getInterfacePackageName() + ".*"); + } + genModel.markImportLocation(stringBuffer); + stringBuffer.append(TEXT_10); + if (isInterface) { + stringBuffer.append(TEXT_11); + if (!genModel.isSuppressEMFMetaData()) { + stringBuffer.append(TEXT_12); + stringBuffer.append(genPackage.getQualifiedPackageInterfaceName()); + } + stringBuffer.append(TEXT_13); + } else { + stringBuffer.append(TEXT_14); + } + if (isImplementation) { + stringBuffer.append(TEXT_15); + stringBuffer.append(genPackage.getFactoryClassName()); + stringBuffer.append(TEXT_16); + stringBuffer.append(genModel.getImportedName("org.apache.tuscany.sdo.impl.FactoryBase")); + if (!genModel.isSuppressInterfaces()) { + stringBuffer.append(TEXT_17); + stringBuffer.append(genPackage.getImportedFactoryInterfaceName()); + } + } else { + stringBuffer.append(TEXT_18); + stringBuffer.append(genPackage.getFactoryInterfaceName()); + if (!genModel.isSuppressEMFMetaData()) { + stringBuffer.append(TEXT_19); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EFactory")); + } + } + stringBuffer.append(TEXT_20); + if (genModel.getCopyrightText() != null) { + stringBuffer.append(TEXT_21); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_22); + stringBuffer.append(genModel.getCopyrightText()); + stringBuffer.append(TEXT_23); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_24); + } + stringBuffer.append(TEXT_25); + if (isInterface && genModel.isSuppressEMFMetaData()) { + stringBuffer.append(TEXT_26); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genPackage.getFactoryInterfaceName()); + stringBuffer.append(TEXT_27); + stringBuffer.append(genPackage.getQualifiedFactoryClassName()); + stringBuffer.append(TEXT_28); + } else if (isInterface && !genModel.isSuppressInterfaces()) { + stringBuffer.append(TEXT_29); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genPackage.getFactoryInterfaceName()); + stringBuffer.append(TEXT_30); + stringBuffer.append(genPackage.getQualifiedFactoryClassName()); + stringBuffer.append(TEXT_31); + } + if (isImplementation) { + stringBuffer.append(TEXT_32); + stringBuffer.append(TEXT_33); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_34); + stringBuffer.append(genPackage.getNSURI()); + stringBuffer.append(TEXT_35); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_36); + stringBuffer.append(TEXT_37); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(genModel.getImportedName("java.lang.String")); + stringBuffer.append(TEXT_38); + stringBuffer.append(genPackage.getNSName()); + stringBuffer.append(TEXT_39); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(TEXT_40); + for (Iterator i=genPackage.getOrderedGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next(); + if (!genClassifier.getClassifierID().equals("DOCUMENT_ROOT")) { + stringBuffer.append(TEXT_41); + stringBuffer.append(publicStaticFinalFlag); + stringBuffer.append(TEXT_42); + stringBuffer.append(genPackage.getClassifierID(genClassifier)); + stringBuffer.append(TEXT_43); + stringBuffer.append(genPackage.getClassifierValue(genClassifier)); + stringBuffer.append(TEXT_44); + } } + stringBuffer.append(TEXT_45); + String factoryType = genModel.isSuppressEMFMetaData() ? genPackage.getFactoryClassName() : genPackage.getImportedFactoryInterfaceName(); + stringBuffer.append(TEXT_46); + stringBuffer.append(genPackage.getFactoryClassName()); + stringBuffer.append(TEXT_47); + stringBuffer.append(genModel.getImportedName("commonj.sdo.DataObject")); + stringBuffer.append(TEXT_48); + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + if (!genClass.isAbstract() && !genClass.getClassifierID().equals("DOCUMENT_ROOT")) { + stringBuffer.append(TEXT_49); + stringBuffer.append(genClass.getClassifierID()); + stringBuffer.append(TEXT_50); + stringBuffer.append(genModel.getImportedName("commonj.sdo.DataObject")); + stringBuffer.append(TEXT_51); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_52); + } + } + stringBuffer.append(TEXT_53); + if (!genPackage.getAllGenDataTypes().isEmpty()) { + stringBuffer.append(TEXT_54); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EDataType")); + stringBuffer.append(TEXT_55); + for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next(); + if (genDataType.isSerializable()) { + stringBuffer.append(TEXT_56); + stringBuffer.append(genPackage.getImportedPackageInterfaceName()); + stringBuffer.append(TEXT_57); + stringBuffer.append(genDataType.getClassifierID()); + stringBuffer.append(TEXT_58); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_59); + } + } + stringBuffer.append(TEXT_60); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(genModel.getNonNLS(2)); + stringBuffer.append(TEXT_61); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EDataType")); + stringBuffer.append(TEXT_62); + for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next(); + if (genDataType.isSerializable()) { + stringBuffer.append(TEXT_63); + stringBuffer.append(genPackage.getImportedPackageInterfaceName()); + stringBuffer.append(TEXT_64); + stringBuffer.append(genDataType.getClassifierID()); + stringBuffer.append(TEXT_65); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_66); + } + } + stringBuffer.append(TEXT_67); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(genModel.getNonNLS(2)); + stringBuffer.append(TEXT_68); + } + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + if (!genClass.isAbstract() && !genClass.getClassifierID().equals("DOCUMENT_ROOT")) { + stringBuffer.append(TEXT_69); + stringBuffer.append(genClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_70); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_71); + if (genClass.isDynamic()) { + stringBuffer.append(TEXT_72); + stringBuffer.append(genClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_73); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_74); + stringBuffer.append(genClass.getCastFromEObject()); + stringBuffer.append(TEXT_75); + stringBuffer.append(genClass.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_76); + } else { + stringBuffer.append(TEXT_77); + stringBuffer.append(genClass.getImportedClassName()); + stringBuffer.append(TEXT_78); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_79); + stringBuffer.append(genClass.getImportedClassName()); + stringBuffer.append(TEXT_80); + if (genModel.isSuppressInterfaces() && !genPackage.getReflectionPackageName().equals(genPackage.getInterfacePackageName())) { + stringBuffer.append(TEXT_81); + } + stringBuffer.append(TEXT_82); + } + stringBuffer.append(TEXT_83); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_84); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Type")); + stringBuffer.append(TEXT_85); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_86); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Type")); + stringBuffer.append(TEXT_87); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_88); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_89); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_90); + } + } + stringBuffer.append(TEXT_91); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_92); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_93); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_94); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_95); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_96); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_97); + stringBuffer.append(genModel.getImportedName("org.apache.tuscany.sdo.util.SDOUtil")); + stringBuffer.append(TEXT_98); + stringBuffer.append(genModel.getImportedName("org.apache.tuscany.sdo.impl.SDOFactoryImpl")); + stringBuffer.append(TEXT_99); + stringBuffer.append(genModel.getImportedName("org.apache.tuscany.sdo.util.SDOUtil")); + stringBuffer.append(TEXT_100); + stringBuffer.append(genModel.getImportedName("org.apache.tuscany.sdo.model.impl.ModelPackageImpl")); + stringBuffer.append(TEXT_101); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_102); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_103); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_104); + stringBuffer.append(factoryType); + stringBuffer.append(TEXT_105); + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + stringBuffer.append(TEXT_106); + if (!genClass.isAbstract() && !genClass.getClassifierID().equals("DOCUMENT_ROOT")) { + stringBuffer.append(TEXT_107); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_108); + stringBuffer.append(genPackage.getClassifierID(genClass)); + stringBuffer.append(TEXT_109); + for (Iterator j=genClass.getAllGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next(); + stringBuffer.append(TEXT_110); + stringBuffer.append(!genFeature.isReferenceType()); + stringBuffer.append(TEXT_111); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_112); + stringBuffer.append(genClass.getClassName()); + stringBuffer.append(TEXT_113); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_114); + } + } + } + stringBuffer.append(TEXT_115); + stringBuffer.append(genModel.getImportedName("org.apache.tuscany.sdo.model.impl.ModelFactoryImpl")); + stringBuffer.append(TEXT_116); + stringBuffer.append(genModel.getImportedName("org.apache.tuscany.sdo.model.impl.ModelFactoryImpl")); + stringBuffer.append(TEXT_117); + stringBuffer.append(genModel.getImportedName("org.apache.tuscany.sdo.model.impl.ModelFactoryImpl")); + stringBuffer.append(TEXT_118); + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + if (!genClass.isAbstract() && !genClass.getClassifierID().equals("DOCUMENT_ROOT")) { + stringBuffer.append(TEXT_119); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_120); + stringBuffer.append(genClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_121); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_122); + for (Iterator j=genClass.getAllGenFeatures().iterator(); j.hasNext();) {GenFeature genFeature = (GenFeature)j.next(); + String type = genFeature.getImportedType().equals("Sequence") ? "getSequence()" : genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage()) + ".get" + genFeature.getTypeClassifierAccessorName() + "()"; + if (genFeature.isReferenceType()) { GenFeature reverseGenFeature = genFeature.getReverse(); + String reverse = reverseGenFeature == null ? "null" : genPackage.getPackageInstanceVariable(reverseGenFeature.getGenPackage()) + ".get" + reverseGenFeature.getFeatureAccessorName() + "()"; + stringBuffer.append(TEXT_123); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Property")); + stringBuffer.append(TEXT_124); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_125); + stringBuffer.append(genClass.getClassName()); + stringBuffer.append(TEXT_126); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_127); + stringBuffer.append(type); + stringBuffer.append(TEXT_128); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_129); + stringBuffer.append(genFeature.getDefaultValue()); + stringBuffer.append(TEXT_130); + stringBuffer.append(genFeature.getLowerBound()); + stringBuffer.append(TEXT_131); + stringBuffer.append(genFeature.getUpperBound()); + stringBuffer.append(TEXT_132); + stringBuffer.append(genFeature.getContainerClass()); + stringBuffer.append(TEXT_133); + stringBuffer.append(genFeature.getChangeableFlag().equals("IS_CHANGEABLE") ? "false" : "true"); + stringBuffer.append(TEXT_134); + stringBuffer.append(genFeature.getUnsettableFlag().equals("IS_UNSETTABLE") ? "true": "false"); + stringBuffer.append(TEXT_135); + stringBuffer.append(genFeature.getDerivedFlag().equals("IS_DERIVED") ? "true" : "false"); + stringBuffer.append(TEXT_136); + stringBuffer.append(genFeature.getContainmentFlag().equals("IS_COMPOSITE")? "true": "false"); + stringBuffer.append(TEXT_137); + stringBuffer.append(reverse); + stringBuffer.append(TEXT_138); + }else{ + stringBuffer.append(TEXT_139); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Property")); + stringBuffer.append(TEXT_140); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_141); + stringBuffer.append(genClass.getClassName()); + stringBuffer.append(TEXT_142); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_143); + stringBuffer.append(type); + stringBuffer.append(TEXT_144); + stringBuffer.append(genFeature.getSafeName()); + stringBuffer.append(TEXT_145); + stringBuffer.append(genFeature.getDefaultValue()); + stringBuffer.append(TEXT_146); + stringBuffer.append(genFeature.getLowerBound()); + stringBuffer.append(TEXT_147); + stringBuffer.append(genFeature.getUpperBound()); + stringBuffer.append(TEXT_148); + stringBuffer.append(genFeature.getContainerClass()); + stringBuffer.append(TEXT_149); + stringBuffer.append(genFeature.getChangeableFlag().equals("IS_CHANGEABLE") ? "false" : "true"); + stringBuffer.append(TEXT_150); + stringBuffer.append(genFeature.getUnsettableFlag().equals("IS_UNSETTABLE") ? "true": "false"); + stringBuffer.append(TEXT_151); + stringBuffer.append(genFeature.getDerivedFlag().equals("IS_DERIVED") ? "true" : "false"); + stringBuffer.append(TEXT_152); + } + } + } + } + stringBuffer.append(TEXT_153); + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + if (!genClass.isAbstract() && !genClass.getClassifierID().equals("DOCUMENT_ROOT")) { + stringBuffer.append(TEXT_154); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_155); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_156); + for (Iterator j=genClass.getAllGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next(); + stringBuffer.append(TEXT_157); + stringBuffer.append(genModel.getImportedName("commonj.sdo.Property")); + stringBuffer.append(TEXT_158); + stringBuffer.append(genClass.getSafeUncapName()); + stringBuffer.append(TEXT_159); + stringBuffer.append(genClass.getClassName()); + stringBuffer.append(TEXT_160); + stringBuffer.append(genFeature.getUpperName()); + stringBuffer.append(TEXT_161); + stringBuffer.append(genFeature.getName()); + stringBuffer.append(TEXT_162); + } + } + } + stringBuffer.append(TEXT_163); + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + if (!genClass.isAbstract() && genClass.getClassifierID().equals("DOCUMENT_ROOT")) { + stringBuffer.append(TEXT_164); + for (Iterator j=genClass.getAllGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next(); + if (!genFeature.getName().equals("mixed") && !genFeature.getName().equals("xMLNSPrefixMap") && !genFeature.getName().equals("xSISchemaLocation")){ + stringBuffer.append(TEXT_165); + stringBuffer.append(genFeature.getName()); + stringBuffer.append(TEXT_166); + stringBuffer.append(genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage())); + stringBuffer.append(TEXT_167); + stringBuffer.append(genFeature.getTypeClassifierAccessorName()); + stringBuffer.append(TEXT_168); + stringBuffer.append(genFeature.getName()); + stringBuffer.append(TEXT_169); + } + } + } + } + stringBuffer.append(TEXT_170); + for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next(); + if (genDataType.isSerializable()) { + if (genPackage.isDataTypeConverters()) { String eDataType = genDataType.getQualifiedClassifierAccessor(); + stringBuffer.append(TEXT_171); + stringBuffer.append(genDataType.getImportedInstanceClassName()); + stringBuffer.append(TEXT_172); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_173); + if (genDataType instanceof GenEnum) { + stringBuffer.append(TEXT_174); + stringBuffer.append(genDataType.getImportedInstanceClassName()); + stringBuffer.append(TEXT_175); + stringBuffer.append(genDataType.getImportedInstanceClassName()); + stringBuffer.append(TEXT_176); + stringBuffer.append(eDataType); + stringBuffer.append(TEXT_177); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(genModel.getNonNLS(2)); + stringBuffer.append(genModel.getNonNLS(3)); + stringBuffer.append(TEXT_178); + } else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); boolean isPrimitiveConversion = !genDataType.isPrimitiveType() && genBaseType.isPrimitiveType(); + if (genBaseType.getGenPackage() == genPackage) { + if (isPrimitiveConversion) { + stringBuffer.append(TEXT_179); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_180); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_181); + } else { + stringBuffer.append(TEXT_182); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_183); + } + } else if (genBaseType.getGenPackage().isDataTypeConverters()) { + if (isPrimitiveConversion) { + stringBuffer.append(TEXT_184); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_185); + stringBuffer.append(genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_186); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_187); + } else { + stringBuffer.append(TEXT_188); + stringBuffer.append(genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_189); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_190); + } + } else { + stringBuffer.append(TEXT_191); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_192); + stringBuffer.append(genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_193); + stringBuffer.append(genBaseType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_194); + } + } else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); + stringBuffer.append(TEXT_195); + stringBuffer.append(genModel.getImportedName("java.util.List")); + stringBuffer.append(TEXT_196); + stringBuffer.append(genModel.getImportedName("java.util.ArrayList")); + stringBuffer.append(TEXT_197); + stringBuffer.append(genModel.getImportedName("java.util.StringTokenizer")); + stringBuffer.append(TEXT_198); + stringBuffer.append(genModel.getImportedName("java.util.StringTokenizer")); + stringBuffer.append(TEXT_199); + if (genItemType.getGenPackage() == genPackage) { + if (genPackage.isDataTypeConverters()) { genItemType = genItemType.getObjectType(); + stringBuffer.append(TEXT_200); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_201); + } else { + stringBuffer.append(TEXT_202); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_203); + stringBuffer.append(genItemType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_204); + } + } else { + if (genItemType.getGenPackage().isDataTypeConverters()) { genItemType = genItemType.getObjectType(); + stringBuffer.append(TEXT_205); + stringBuffer.append(genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_206); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_207); + } else { + stringBuffer.append(TEXT_208); + stringBuffer.append(genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_209); + stringBuffer.append(genItemType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_210); + } + } + stringBuffer.append(TEXT_211); + } else if (!genDataType.getMemberTypes().isEmpty()) { + stringBuffer.append(TEXT_212); + stringBuffer.append(genDataType.getStaticValue(null)); + stringBuffer.append(TEXT_213); + stringBuffer.append(genDataType.getImportedInstanceClassName()); + stringBuffer.append(TEXT_214); + stringBuffer.append(genDataType.getStaticValue(null)); + stringBuffer.append(TEXT_215); + for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next(); + stringBuffer.append(TEXT_216); + if (genMemberType.getGenPackage() == genPackage) { + if (genPackage.isDataTypeConverters()) { if (!genDataType.isPrimitiveType()) genMemberType = genMemberType.getObjectType(); + stringBuffer.append(TEXT_217); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_218); + } else { + stringBuffer.append(TEXT_219); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_220); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_221); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_222); + } + } else { + if (genPackage.isDataTypeConverters()) { if (!genDataType.isPrimitiveType()) genMemberType = genMemberType.getObjectType(); + stringBuffer.append(TEXT_223); + stringBuffer.append(genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_224); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_225); + } else { + stringBuffer.append(TEXT_226); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_227); + stringBuffer.append(genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_228); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_229); + } + } + stringBuffer.append(TEXT_230); + if (!genDataType.isPrimitiveType()) { + stringBuffer.append(TEXT_231); + } + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.Diagnostician")); + stringBuffer.append(TEXT_232); + stringBuffer.append(eDataType); + stringBuffer.append(TEXT_233); + if (genDataType.isPrimitiveType()) { + stringBuffer.append(TEXT_234); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_235); + } else { + stringBuffer.append(TEXT_236); + } + stringBuffer.append(TEXT_237); + } + stringBuffer.append(TEXT_238); + if (!genDataType.isPrimitiveType()) { + stringBuffer.append(TEXT_239); + } + stringBuffer.append(TEXT_240); + } else if (genDataType.isArrayType()) { + stringBuffer.append(TEXT_241); + stringBuffer.append(genModel.getImportedName("java.lang.UnsupportedOperationException")); + stringBuffer.append(TEXT_242); + } else if (genDataType.isPrimitiveType()) { + stringBuffer.append(TEXT_243); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_244); + stringBuffer.append(eDataType); + stringBuffer.append(TEXT_245); + stringBuffer.append(genDataType.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_246); + } else { + stringBuffer.append(TEXT_247); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_248); + stringBuffer.append(eDataType); + stringBuffer.append(TEXT_249); + } + stringBuffer.append(TEXT_250); + } + stringBuffer.append(TEXT_251); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_252); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_253); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EDataType")); + stringBuffer.append(TEXT_254); + if (genDataType instanceof GenEnum) { + if (genPackage.isDataTypeConverters()) { + stringBuffer.append(TEXT_255); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_256); + } else { + stringBuffer.append(TEXT_257); + stringBuffer.append(((GenEnum)genDataType).getImportedInstanceClassName()); + stringBuffer.append(TEXT_258); + stringBuffer.append(((GenEnum)genDataType).getImportedInstanceClassName()); + stringBuffer.append(TEXT_259); + stringBuffer.append(genModel.getNonNLS()); + stringBuffer.append(genModel.getNonNLS(2)); + stringBuffer.append(genModel.getNonNLS(3)); + stringBuffer.append(TEXT_260); + } + } else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); + if (genBaseType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_261); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_262); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_263); + stringBuffer.append(genBaseType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_264); + } else { + stringBuffer.append(TEXT_265); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_266); + stringBuffer.append(genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_267); + stringBuffer.append(genBaseType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_268); + } + } else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); + if (genPackage.isDataTypeConverters()) { + stringBuffer.append(TEXT_269); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_270); + } else { + stringBuffer.append(TEXT_271); + stringBuffer.append(genModel.getImportedName("java.util.List")); + stringBuffer.append(TEXT_272); + stringBuffer.append(genModel.getImportedName("java.util.ArrayList")); + stringBuffer.append(TEXT_273); + stringBuffer.append(genModel.getImportedName("java.util.StringTokenizer")); + stringBuffer.append(TEXT_274); + stringBuffer.append(genModel.getImportedName("java.util.StringTokenizer")); + stringBuffer.append(TEXT_275); + if (genItemType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_276); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_277); + stringBuffer.append(genItemType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_278); + } else { + stringBuffer.append(TEXT_279); + stringBuffer.append(genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_280); + stringBuffer.append(genItemType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_281); + } + stringBuffer.append(TEXT_282); + } + } else if (!genDataType.getMemberTypes().isEmpty()) { + if (genPackage.isDataTypeConverters()) { + if (genDataType.isPrimitiveType()) { + stringBuffer.append(TEXT_283); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_284); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_285); + } else { + stringBuffer.append(TEXT_286); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_287); + } + } else { + stringBuffer.append(TEXT_288); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_289); + for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next(); + stringBuffer.append(TEXT_290); + if (genMemberType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_291); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_292); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_293); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_294); + } else { + stringBuffer.append(TEXT_295); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_296); + stringBuffer.append(genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_297); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_298); + } + stringBuffer.append(TEXT_299); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.Diagnostician")); + stringBuffer.append(TEXT_300); + } + stringBuffer.append(TEXT_301); + } + } else if (genDataType.isArrayType()) { + stringBuffer.append(TEXT_302); + stringBuffer.append(genModel.getImportedName("java.lang.UnsupportedOperationException")); + stringBuffer.append(TEXT_303); + } else { + stringBuffer.append(TEXT_304); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_305); + } + stringBuffer.append(TEXT_306); + if (genPackage.isDataTypeConverters()) { String eDataType = genDataType.getQualifiedClassifierAccessor(); + stringBuffer.append(TEXT_307); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_308); + stringBuffer.append(genDataType.getImportedInstanceClassName()); + stringBuffer.append(TEXT_309); + if (genDataType instanceof GenEnum) { + stringBuffer.append(TEXT_310); + } else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); boolean isPrimitiveConversion = !genDataType.isPrimitiveType() && genBaseType.isPrimitiveType(); + if (genBaseType.getGenPackage() == genPackage) { + if (isPrimitiveConversion) { + stringBuffer.append(TEXT_311); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_312); + stringBuffer.append(genBaseType.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_313); + } else { + stringBuffer.append(TEXT_314); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_315); + } + } else if (genBaseType.getGenPackage().isDataTypeConverters()) { + stringBuffer.append(TEXT_316); + stringBuffer.append(genBaseType.getGenPackage().getQualifiedFactoryInstanceAccessor()); + stringBuffer.append(TEXT_317); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_318); + } else { + stringBuffer.append(TEXT_319); + stringBuffer.append(genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_320); + stringBuffer.append(genBaseType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_321); + } + } else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); + stringBuffer.append(TEXT_322); + stringBuffer.append(genModel.getImportedName("java.lang.StringBuffer")); + stringBuffer.append(TEXT_323); + stringBuffer.append(genModel.getImportedName("java.lang.StringBuffer")); + stringBuffer.append(TEXT_324); + stringBuffer.append(genModel.getImportedName("java.util.Iterator")); + stringBuffer.append(TEXT_325); + if (genItemType.getGenPackage() == genPackage) { + if (genPackage.isDataTypeConverters()) { genItemType = genItemType.getObjectType(); + stringBuffer.append(TEXT_326); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_327); + stringBuffer.append(genItemType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_328); + } else { + stringBuffer.append(TEXT_329); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_330); + stringBuffer.append(genItemType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_331); + } + } else { + if (genItemType.getGenPackage().isDataTypeConverters()) { genItemType = genItemType.getObjectType(); + stringBuffer.append(TEXT_332); + stringBuffer.append(genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_333); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_334); + stringBuffer.append(genItemType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_335); + } else { + stringBuffer.append(TEXT_336); + stringBuffer.append(genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_337); + stringBuffer.append(genItemType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_338); + } + } + stringBuffer.append(TEXT_339); + } else if (!genDataType.getMemberTypes().isEmpty()) { + if (!genDataType.isPrimitiveType()) { + stringBuffer.append(TEXT_340); + for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next(); + stringBuffer.append(TEXT_341); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_342); + if (genMemberType.getGenPackage() == genPackage) { + if (genPackage.isDataTypeConverters()) { + stringBuffer.append(TEXT_343); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_344); + } else { + stringBuffer.append(TEXT_345); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_346); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_347); + } + } else { + if (genMemberType.getGenPackage().isDataTypeConverters()) { genMemberType = genMemberType.getObjectType(); + stringBuffer.append(TEXT_348); + stringBuffer.append(genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_349); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_350); + stringBuffer.append(genMemberType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_351); + } else { + stringBuffer.append(TEXT_352); + stringBuffer.append(genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_353); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_354); + } + } + stringBuffer.append(TEXT_355); + } + } else { + for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next(); + stringBuffer.append(TEXT_356); + if (genMemberType.getGenPackage() == genPackage) { + if (genPackage.isDataTypeConverters()) { + stringBuffer.append(TEXT_357); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_358); + } else { + stringBuffer.append(TEXT_359); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_360); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_361); + stringBuffer.append(genMemberType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_362); + } + } else { + if (genMemberType.getGenPackage().isDataTypeConverters()) { + stringBuffer.append(TEXT_363); + stringBuffer.append(genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_364); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_365); + } else { + stringBuffer.append(TEXT_366); + stringBuffer.append(genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_367); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_368); + stringBuffer.append(genMemberType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_369); + } + } + stringBuffer.append(TEXT_370); + } + } + stringBuffer.append(TEXT_371); + stringBuffer.append(eDataType); + stringBuffer.append(TEXT_372); + } else if (genDataType.isArrayType()) { + stringBuffer.append(TEXT_373); + stringBuffer.append(genModel.getImportedName("java.lang.UnsupportedOperationException")); + stringBuffer.append(TEXT_374); + } else if (genDataType.isPrimitiveType()) { + stringBuffer.append(TEXT_375); + stringBuffer.append(eDataType); + stringBuffer.append(TEXT_376); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_377); + } else { + stringBuffer.append(TEXT_378); + stringBuffer.append(eDataType); + stringBuffer.append(TEXT_379); + } + stringBuffer.append(TEXT_380); + } + stringBuffer.append(TEXT_381); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_382); + stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EDataType")); + stringBuffer.append(TEXT_383); + if (genDataType instanceof GenEnum) { + stringBuffer.append(TEXT_384); + } else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); + if (genBaseType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_385); + stringBuffer.append(genBaseType.getName()); + stringBuffer.append(TEXT_386); + stringBuffer.append(genBaseType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_387); + } else { + stringBuffer.append(TEXT_388); + stringBuffer.append(genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_389); + stringBuffer.append(genBaseType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_390); + } + } else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); + if (genPackage.isDataTypeConverters()) { + stringBuffer.append(TEXT_391); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_392); + stringBuffer.append(genModel.getImportedName("java.util.List")); + stringBuffer.append(TEXT_393); + } else { + stringBuffer.append(TEXT_394); + stringBuffer.append(genModel.getImportedName("java.util.List")); + stringBuffer.append(TEXT_395); + stringBuffer.append(genModel.getImportedName("java.util.List")); + stringBuffer.append(TEXT_396); + stringBuffer.append(genModel.getImportedName("java.lang.StringBuffer")); + stringBuffer.append(TEXT_397); + stringBuffer.append(genModel.getImportedName("java.lang.StringBuffer")); + stringBuffer.append(TEXT_398); + stringBuffer.append(genModel.getImportedName("java.util.Iterator")); + stringBuffer.append(TEXT_399); + if (genItemType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_400); + stringBuffer.append(genItemType.getName()); + stringBuffer.append(TEXT_401); + stringBuffer.append(genItemType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_402); + } else { + stringBuffer.append(TEXT_403); + stringBuffer.append(genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_404); + stringBuffer.append(genItemType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_405); + } + stringBuffer.append(TEXT_406); + } + } else if (!genDataType.getMemberTypes().isEmpty()) { + if (genPackage.isDataTypeConverters()) { + if (genDataType.isPrimitiveType()) { + stringBuffer.append(TEXT_407); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_408); + stringBuffer.append(genDataType.getObjectInstanceClassName()); + stringBuffer.append(TEXT_409); + stringBuffer.append(genDataType.getPrimitiveValueFunction()); + stringBuffer.append(TEXT_410); + } else { + stringBuffer.append(TEXT_411); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_412); + } + } else { + stringBuffer.append(TEXT_413); + for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next(); + stringBuffer.append(TEXT_414); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_415); + if (genMemberType.getGenPackage() == genPackage) { + stringBuffer.append(TEXT_416); + stringBuffer.append(genMemberType.getName()); + stringBuffer.append(TEXT_417); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_418); + } else { + stringBuffer.append(TEXT_419); + stringBuffer.append(genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()); + stringBuffer.append(TEXT_420); + stringBuffer.append(genMemberType.getQualifiedClassifierAccessor()); + stringBuffer.append(TEXT_421); + } + stringBuffer.append(TEXT_422); + } + stringBuffer.append(TEXT_423); + } + } else if (genDataType.isArrayType()) { + stringBuffer.append(TEXT_424); + stringBuffer.append(genModel.getImportedName("java.lang.UnsupportedOperationException")); + stringBuffer.append(TEXT_425); + } else { + stringBuffer.append(TEXT_426); + } + stringBuffer.append(TEXT_427); + } + } + } else { + for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next(); + if (genClass.hasFactoryInterfaceCreateMethod()) { + stringBuffer.append(TEXT_428); + stringBuffer.append(genClass.getFormattedName()); + stringBuffer.append(TEXT_429); + stringBuffer.append(genClass.getFormattedName()); + stringBuffer.append(TEXT_430); + stringBuffer.append(genClass.getImportedInterfaceName()); + stringBuffer.append(TEXT_431); + stringBuffer.append(genClass.getName()); + stringBuffer.append(TEXT_432); + } + } + if (genPackage.isDataTypeConverters()) { + for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next(); + if (genDataType.isSerializable()) { + stringBuffer.append(TEXT_433); + stringBuffer.append(genDataType.getFormattedName()); + stringBuffer.append(TEXT_434); + stringBuffer.append(genDataType.getImportedInstanceClassName()); + stringBuffer.append(TEXT_435); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_436); + stringBuffer.append(genDataType.getFormattedName()); + stringBuffer.append(TEXT_437); + stringBuffer.append(genDataType.getName()); + stringBuffer.append(TEXT_438); + stringBuffer.append(genDataType.getImportedInstanceClassName()); + stringBuffer.append(TEXT_439); + } + } + } + } + stringBuffer.append(TEXT_440); + stringBuffer.append(isInterface ? genPackage.getFactoryInterfaceName() : genPackage.getFactoryClassName()); + genModel.emitSortedImports(); + stringBuffer.append(TEXT_441); + return stringBuffer.toString(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/eclipse/jdt/core/formatter/CodeFormatter.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/eclipse/jdt/core/formatter/CodeFormatter.java new file mode 100644 index 0000000000..99c9191a34 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/java/org/eclipse/jdt/core/formatter/CodeFormatter.java @@ -0,0 +1,24 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * 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. + */ +/******************************************************************************* + * TEMPORARY dummy file to work around EMF generator dependency problem. + * This file will be deleted as soon as the EMF generator is fixed. + *******************************************************************************/ +package org.eclipse.jdt.core.formatter; + +public abstract class CodeFormatter { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/MixedQuote.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/MixedQuote.java new file mode 100644 index 0000000000..8ec83abfdb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/MixedQuote.java @@ -0,0 +1,323 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences; + +import commonj.sdo.Sequence; + +import java.math.BigDecimal; + +import java.util.List; + +/** + * + * A representation of the model object 'Mixed Quote'. + * + * + *

      + * The following features are supported: + *

        + *
      • {@link com.example.sequences.MixedQuote#getMixed Mixed}
      • + *
      • {@link com.example.sequences.MixedQuote#getSymbol Symbol}
      • + *
      • {@link com.example.sequences.MixedQuote#getCompanyName Company Name}
      • + *
      • {@link com.example.sequences.MixedQuote#getPrice Price}
      • + *
      • {@link com.example.sequences.MixedQuote#getOpen1 Open1}
      • + *
      • {@link com.example.sequences.MixedQuote#getHigh High}
      • + *
      • {@link com.example.sequences.MixedQuote#getLow Low}
      • + *
      • {@link com.example.sequences.MixedQuote#getVolume Volume}
      • + *
      • {@link com.example.sequences.MixedQuote#getChange1 Change1}
      • + *
      • {@link com.example.sequences.MixedQuote#getQuotes Quotes}
      • + *
      + *

      + * + * @generated + */ +public interface MixedQuote +{ + /** + * Returns the value of the 'Mixed' attribute list. + * + *

      + * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Symbol' attribute. + * + *

      + * If the meaning of the 'Symbol' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Symbol' attribute. + * @see #setSymbol(String) + * @generated + */ + String getSymbol(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getSymbol Symbol}' attribute. + * + * + * @param value the new value of the 'Symbol' attribute. + * @see #getSymbol() + * @generated + */ + void setSymbol(String value); + + /** + * Returns the value of the 'Company Name' attribute. + * + *

      + * If the meaning of the 'Company Name' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Company Name' attribute. + * @see #setCompanyName(String) + * @generated + */ + String getCompanyName(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getCompanyName Company Name}' attribute. + * + * + * @param value the new value of the 'Company Name' attribute. + * @see #getCompanyName() + * @generated + */ + void setCompanyName(String value); + + /** + * Returns the value of the 'Price' attribute. + * + *

      + * If the meaning of the 'Price' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Price' attribute. + * @see #setPrice(BigDecimal) + * @generated + */ + BigDecimal getPrice(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getPrice Price}' attribute. + * + * + * @param value the new value of the 'Price' attribute. + * @see #getPrice() + * @generated + */ + void setPrice(BigDecimal value); + + /** + * Returns the value of the 'Open1' attribute. + * + *

      + * If the meaning of the 'Open1' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Open1' attribute. + * @see #setOpen1(BigDecimal) + * @generated + */ + BigDecimal getOpen1(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getOpen1 Open1}' attribute. + * + * + * @param value the new value of the 'Open1' attribute. + * @see #getOpen1() + * @generated + */ + void setOpen1(BigDecimal value); + + /** + * Returns the value of the 'High' attribute. + * + *

      + * If the meaning of the 'High' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'High' attribute. + * @see #setHigh(BigDecimal) + * @generated + */ + BigDecimal getHigh(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getHigh High}' attribute. + * + * + * @param value the new value of the 'High' attribute. + * @see #getHigh() + * @generated + */ + void setHigh(BigDecimal value); + + /** + * Returns the value of the 'Low' attribute. + * + *

      + * If the meaning of the 'Low' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Low' attribute. + * @see #setLow(BigDecimal) + * @generated + */ + BigDecimal getLow(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getLow Low}' attribute. + * + * + * @param value the new value of the 'Low' attribute. + * @see #getLow() + * @generated + */ + void setLow(BigDecimal value); + + /** + * Returns the value of the 'Volume' attribute. + * + *

      + * If the meaning of the 'Volume' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Volume' attribute. + * @see #isSetVolume() + * @see #unsetVolume() + * @see #setVolume(double) + * @generated + */ + double getVolume(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getVolume Volume}' attribute. + * + * + * @param value the new value of the 'Volume' attribute. + * @see #isSetVolume() + * @see #unsetVolume() + * @see #getVolume() + * @generated + */ + void setVolume(double value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getVolume Volume}' attribute. + * + * + * @see #isSetVolume() + * @see #getVolume() + * @see #setVolume(double) + * @generated + */ + void unsetVolume(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getVolume Volume}' attribute is set. + * + * + * @return whether the value of the 'Volume' attribute is set. + * @see #unsetVolume() + * @see #getVolume() + * @see #setVolume(double) + * @generated + */ + boolean isSetVolume(); + + /** + * Returns the value of the 'Change1' attribute. + * + *

      + * If the meaning of the 'Change1' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Change1' attribute. + * @see #isSetChange1() + * @see #unsetChange1() + * @see #setChange1(double) + * @generated + */ + double getChange1(); + + /** + * Sets the value of the '{@link com.example.sequences.MixedQuote#getChange1 Change1}' attribute. + * + * + * @param value the new value of the 'Change1' attribute. + * @see #isSetChange1() + * @see #unsetChange1() + * @see #getChange1() + * @generated + */ + void setChange1(double value); + + /** + * Unsets the value of the '{@link com.example.sequences.MixedQuote#getChange1 Change1}' attribute. + * + * + * @see #isSetChange1() + * @see #getChange1() + * @see #setChange1(double) + * @generated + */ + void unsetChange1(); + + /** + * Returns whether the value of the '{@link com.example.sequences.MixedQuote#getChange1 Change1}' attribute is set. + * + * + * @return whether the value of the 'Change1' attribute is set. + * @see #unsetChange1() + * @see #getChange1() + * @see #setChange1(double) + * @generated + */ + boolean isSetChange1(); + + /** + * Returns the value of the 'Quotes' containment reference list. + * The list contents are of type {@link com.example.sequences.MixedQuote}. + * + *

      + * If the meaning of the 'Quotes' containment reference list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Quotes' containment reference list. + * @generated + */ + List getQuotes(); + +} // MixedQuote diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java new file mode 100644 index 0000000000..f92285c048 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/MixedRepeatingChoice.java @@ -0,0 +1,96 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences; + +import commonj.sdo.Sequence; + +import java.util.List; + +/** + * + * A representation of the model object 'Mixed Repeating Choice'. + * + * + *

      + * The following features are supported: + *

        + *
      • {@link com.example.sequences.MixedRepeatingChoice#getMixed Mixed}
      • + *
      • {@link com.example.sequences.MixedRepeatingChoice#getGroup Group}
      • + *
      • {@link com.example.sequences.MixedRepeatingChoice#getA A}
      • + *
      • {@link com.example.sequences.MixedRepeatingChoice#getB B}
      • + *
      + *

      + * + * @generated + */ +public interface MixedRepeatingChoice +{ + /** + * Returns the value of the 'Mixed' attribute list. + * + *

      + * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Group' attribute list. + * + *

      + * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

      + * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

      + * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + +} // MixedRepeatingChoice diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/RepeatingChoice.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/RepeatingChoice.java new file mode 100644 index 0000000000..ab5b144e09 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/RepeatingChoice.java @@ -0,0 +1,82 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences; + +import commonj.sdo.Sequence; + +import java.util.List; + +/** + * + * A representation of the model object 'Repeating Choice'. + * + * + *

      + * The following features are supported: + *

        + *
      • {@link com.example.sequences.RepeatingChoice#getGroup Group}
      • + *
      • {@link com.example.sequences.RepeatingChoice#getA A}
      • + *
      • {@link com.example.sequences.RepeatingChoice#getB B}
      • + *
      + *

      + * + * @generated + */ +public interface RepeatingChoice +{ + /** + * Returns the value of the 'Group' attribute list. + * + *

      + * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

      + * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

      + * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + +} // RepeatingChoice diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/SequencesFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/SequencesFactory.java new file mode 100644 index 0000000000..c73310b5b5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/SequencesFactory.java @@ -0,0 +1,83 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface SequencesFactory +{ + + /** + * The singleton instance of the factory. + * + * + * @generated + */ + SequencesFactory INSTANCE = com.example.sequences.impl.SequencesFactoryImpl.init(); + + /** + * Returns a new object of class 'Mixed Quote'. + * + * + * @return a new object of class 'Mixed Quote'. + * @generated + */ + MixedQuote createMixedQuote(); + + /** + * Returns a new object of class 'Mixed Repeating Choice'. + * + * + * @return a new object of class 'Mixed Repeating Choice'. + * @generated + */ + MixedRepeatingChoice createMixedRepeatingChoice(); + + /** + * Returns a new object of class 'Repeating Choice'. + * + * + * @return a new object of class 'Repeating Choice'. + * @generated + */ + RepeatingChoice createRepeatingChoice(); + + /** + * Returns a new object of class 'Two RCs'. + * + * + * @return a new object of class 'Two RCs'. + * @generated + */ + TwoRCs createTwoRCs(); + + /** + * Returns a new object of class 'Two RCs Mixed'. + * + * + * @return a new object of class 'Two RCs Mixed'. + * @generated + */ + TwoRCsMixed createTwoRCsMixed(); + +} //SequencesFactory diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/TwoRCs.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/TwoRCs.java new file mode 100644 index 0000000000..9615d2a0ef --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/TwoRCs.java @@ -0,0 +1,151 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences; + +import commonj.sdo.Sequence; + +import java.util.List; + +/** + * + * A representation of the model object 'Two RCs'. + * + * + *

      + * The following features are supported: + *

        + *
      • {@link com.example.sequences.TwoRCs#getGroup Group}
      • + *
      • {@link com.example.sequences.TwoRCs#getA A}
      • + *
      • {@link com.example.sequences.TwoRCs#getB B}
      • + *
      • {@link com.example.sequences.TwoRCs#getSplit Split}
      • + *
      • {@link com.example.sequences.TwoRCs#getGroup1 Group1}
      • + *
      • {@link com.example.sequences.TwoRCs#getY Y}
      • + *
      • {@link com.example.sequences.TwoRCs#getZ Z}
      • + *
      + *

      + * + * @generated + */ +public interface TwoRCs +{ + /** + * Returns the value of the 'Group' attribute list. + * + *

      + * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

      + * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

      + * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + + /** + * Returns the value of the 'Split' attribute. + * + *

      + * If the meaning of the 'Split' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Split' attribute. + * @see #setSplit(String) + * @generated + */ + String getSplit(); + + /** + * Sets the value of the '{@link com.example.sequences.TwoRCs#getSplit Split}' attribute. + * + * + * @param value the new value of the 'Split' attribute. + * @see #getSplit() + * @generated + */ + void setSplit(String value); + + /** + * Returns the value of the 'Group1' attribute list. + * + *

      + * If the meaning of the 'Group1' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Group1' attribute list. + * @generated + */ + Sequence getGroup1(); + + /** + * Returns the value of the 'Y' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

      + * If the meaning of the 'Y' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Y' attribute list. + * @generated + */ + List getY(); + + /** + * Returns the value of the 'Z' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

      + * If the meaning of the 'Z' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Z' attribute list. + * @generated + */ + List getZ(); + +} // TwoRCs diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/TwoRCsMixed.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/TwoRCsMixed.java new file mode 100644 index 0000000000..0325e2cd9c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/TwoRCsMixed.java @@ -0,0 +1,165 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences; + +import commonj.sdo.Sequence; + +import java.util.List; + +/** + * + * A representation of the model object 'Two RCs Mixed'. + * + * + *

      + * The following features are supported: + *

        + *
      • {@link com.example.sequences.TwoRCsMixed#getMixed Mixed}
      • + *
      • {@link com.example.sequences.TwoRCsMixed#getGroup Group}
      • + *
      • {@link com.example.sequences.TwoRCsMixed#getA A}
      • + *
      • {@link com.example.sequences.TwoRCsMixed#getB B}
      • + *
      • {@link com.example.sequences.TwoRCsMixed#getSplit Split}
      • + *
      • {@link com.example.sequences.TwoRCsMixed#getGroup1 Group1}
      • + *
      • {@link com.example.sequences.TwoRCsMixed#getY Y}
      • + *
      • {@link com.example.sequences.TwoRCsMixed#getZ Z}
      • + *
      + *

      + * + * @generated + */ +public interface TwoRCsMixed +{ + /** + * Returns the value of the 'Mixed' attribute list. + * + *

      + * If the meaning of the 'Mixed' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Mixed' attribute list. + * @generated + */ + Sequence getMixed(); + + /** + * Returns the value of the 'Group' attribute list. + * + *

      + * If the meaning of the 'Group' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Group' attribute list. + * @generated + */ + Sequence getGroup(); + + /** + * Returns the value of the 'A' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

      + * If the meaning of the 'A' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'A' attribute list. + * @generated + */ + List getA(); + + /** + * Returns the value of the 'B' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

      + * If the meaning of the 'B' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'B' attribute list. + * @generated + */ + List getB(); + + /** + * Returns the value of the 'Split' attribute. + * + *

      + * If the meaning of the 'Split' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Split' attribute. + * @see #setSplit(String) + * @generated + */ + String getSplit(); + + /** + * Sets the value of the '{@link com.example.sequences.TwoRCsMixed#getSplit Split}' attribute. + * + * + * @param value the new value of the 'Split' attribute. + * @see #getSplit() + * @generated + */ + void setSplit(String value); + + /** + * Returns the value of the 'Group1' attribute list. + * + *

      + * If the meaning of the 'Group1' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Group1' attribute list. + * @generated + */ + Sequence getGroup1(); + + /** + * Returns the value of the 'Y' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

      + * If the meaning of the 'Y' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Y' attribute list. + * @generated + */ + List getY(); + + /** + * Returns the value of the 'Z' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

      + * If the meaning of the 'Z' attribute list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Z' attribute list. + * @generated + */ + List getZ(); + +} // TwoRCsMixed diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java new file mode 100644 index 0000000000..b3381cda76 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/MixedQuoteImpl.java @@ -0,0 +1,657 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences.impl; + +import com.example.sequences.MixedQuote; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import commonj.sdo.helper.TypeHelper; + +import java.math.BigDecimal; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +import org.apache.tuscany.sdo.util.BasicSequence; + +/** + * + * An implementation of the model object 'Mixed Quote'. + * + *

      + * The following features are implemented: + *

        + *
      • {@link com.example.sequences.impl.MixedQuoteImpl#getMixed Mixed}
      • + *
      • {@link com.example.sequences.impl.MixedQuoteImpl#getSymbol Symbol}
      • + *
      • {@link com.example.sequences.impl.MixedQuoteImpl#getCompanyName Company Name}
      • + *
      • {@link com.example.sequences.impl.MixedQuoteImpl#getPrice Price}
      • + *
      • {@link com.example.sequences.impl.MixedQuoteImpl#getOpen1 Open1}
      • + *
      • {@link com.example.sequences.impl.MixedQuoteImpl#getHigh High}
      • + *
      • {@link com.example.sequences.impl.MixedQuoteImpl#getLow Low}
      • + *
      • {@link com.example.sequences.impl.MixedQuoteImpl#getVolume Volume}
      • + *
      • {@link com.example.sequences.impl.MixedQuoteImpl#getChange1 Change1}
      • + *
      • {@link com.example.sequences.impl.MixedQuoteImpl#getQuotes Quotes}
      • + *
      + *

      + * + * @generated + */ +public class MixedQuoteImpl extends DataObjectBase implements MixedQuote +{ + /** + * The feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public final static int MIXED = 0; + + /** + * The cached value of the '{@link #getMixed() Mixed}' attribute list. + * + * + * @see #getMixed() + * @generated + * @ordered + */ + + // How to get BasicSequence from Sequence? + + protected BasicSequence mixed = null; + + /** + * The feature id for the 'Symbol' attribute. + * + * + * @generated + * @ordered + */ + public final static int SYMBOL = 1; + + /** + * The default value of the '{@link #getSymbol() Symbol}' attribute. + * + * + * @see #getSymbol() + * @generated + * @ordered + */ + protected static final String SYMBOL_DEFAULT_ = null; + + /** + * The feature id for the 'Company Name' attribute. + * + * + * @generated + * @ordered + */ + public final static int COMPANY_NAME = 2; + + /** + * The default value of the '{@link #getCompanyName() Company Name}' attribute. + * + * + * @see #getCompanyName() + * @generated + * @ordered + */ + protected static final String COMPANY_NAME_DEFAULT_ = null; + + /** + * The feature id for the 'Price' attribute. + * + * + * @generated + * @ordered + */ + public final static int PRICE = 3; + + /** + * The default value of the '{@link #getPrice() Price}' attribute. + * + * + * @see #getPrice() + * @generated + * @ordered + */ + protected static final BigDecimal PRICE_DEFAULT_ = null; + + /** + * The feature id for the 'Open1' attribute. + * + * + * @generated + * @ordered + */ + public final static int OPEN1 = 4; + + /** + * The default value of the '{@link #getOpen1() Open1}' attribute. + * + * + * @see #getOpen1() + * @generated + * @ordered + */ + protected static final BigDecimal OPEN1_DEFAULT_ = null; + + /** + * The feature id for the 'High' attribute. + * + * + * @generated + * @ordered + */ + public final static int HIGH = 5; + + /** + * The default value of the '{@link #getHigh() High}' attribute. + * + * + * @see #getHigh() + * @generated + * @ordered + */ + protected static final BigDecimal HIGH_DEFAULT_ = null; + + /** + * The feature id for the 'Low' attribute. + * + * + * @generated + * @ordered + */ + public final static int LOW = 6; + + /** + * The default value of the '{@link #getLow() Low}' attribute. + * + * + * @see #getLow() + * @generated + * @ordered + */ + protected static final BigDecimal LOW_DEFAULT_ = null; + + /** + * The feature id for the 'Volume' attribute. + * + * + * @generated + * @ordered + */ + public final static int VOLUME = 7; + + /** + * The feature id for the 'Change1' attribute. + * + * + * @generated + * @ordered + */ + public final static int CHANGE1 = 8; + + /** + * The feature id for the 'Quotes' containment reference list. + * + * + * @generated + * @ordered + */ + public final static int QUOTES = 9; + + /** + * + * + * @generated + */ + protected MixedQuoteImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getType() + { + return TypeHelper.INSTANCE.getType(MixedQuote.class); //TBD Generate a more efficient implementation + } + + /** + * + * + * @generated + */ + public Sequence getMixed() + { + if (mixed == null) + { + mixed = createSequence(MIXED); + + } + return mixed; + } + + /** + * + * + * @generated + */ + public String getSymbol() + { + return (String)get(getMixed(), getType(), SYMBOL); + } + + /** + * + * + * @generated + */ + public void setSymbol(String newSymbol) + { + set(getMixed(), getType(), SYMBOL, newSymbol); + } + + /** + * + * + * @generated + */ + public String getCompanyName() + { + return (String)get(getMixed(), getType(), COMPANY_NAME); + } + + /** + * + * + * @generated + */ + public void setCompanyName(String newCompanyName) + { + set(getMixed(), getType(), COMPANY_NAME, newCompanyName); + } + + /** + * + * + * @generated + */ + public BigDecimal getPrice() + { + return (BigDecimal)get(getMixed(), getType(), PRICE); + } + + /** + * + * + * @generated + */ + public void setPrice(BigDecimal newPrice) + { + set(getMixed(), getType(), PRICE, newPrice); + } + + /** + * + * + * @generated + */ + public BigDecimal getOpen1() + { + return (BigDecimal)get(getMixed(), getType(), OPEN1); + } + + /** + * + * + * @generated + */ + public void setOpen1(BigDecimal newOpen1) + { + set(getMixed(), getType(), OPEN1, newOpen1); + } + + /** + * + * + * @generated + */ + public BigDecimal getHigh() + { + return (BigDecimal)get(getMixed(), getType(), HIGH); + } + + /** + * + * + * @generated + */ + public void setHigh(BigDecimal newHigh) + { + set(getMixed(), getType(), HIGH, newHigh); + } + + /** + * + * + * @generated + */ + public BigDecimal getLow() + { + return (BigDecimal)get(getMixed(), getType(), LOW); + } + + /** + * + * + * @generated + */ + public void setLow(BigDecimal newLow) + { + set(getMixed(), getType(), LOW, newLow); + } + + /** + * + * + * @generated + */ + public double getVolume() + { + return ((Double)get(getMixed(), getType(), VOLUME)).doubleValue(); + } + + /** + * + * + * @generated + */ + public void setVolume(double newVolume) + { + set(getMixed(), getType(), VOLUME, new Double(newVolume)); + } + + /** + * + * + * @generated + */ + public void unsetVolume() + { + unset(getMixed(), getType(), VOLUME); + } + + /** + * + * + * @generated + */ + public boolean isSetVolume() + { + return isSet(getMixed(), getType(), VOLUME); + } + + /** + * + * + * @generated + */ + public double getChange1() + { + return ((Double)get(getMixed(), getType(), CHANGE1)).doubleValue(); + } + + /** + * + * + * @generated + */ + public void setChange1(double newChange1) + { + set(getMixed(), getType(), CHANGE1, new Double(newChange1)); + } + + /** + * + * + * @generated + */ + public void unsetChange1() + { + unset(getMixed(), getType(), CHANGE1); + } + + /** + * + * + * @generated + */ + public boolean isSetChange1() + { + return isSet(getMixed(), getType(), CHANGE1); + } + + /** + * + * + * @generated + */ + public List getQuotes() + { + return getList(getMixed(), getType(), QUOTES); + + } + + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case MIXED: + return removeFromSequence(getMixed(), otherEnd, changeContext); + case QUOTES: + return removeFromList(getQuotes(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case MIXED: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getMixed(); + case SYMBOL: + return getSymbol(); + case COMPANY_NAME: + return getCompanyName(); + case PRICE: + return getPrice(); + case OPEN1: + return getOpen1(); + case HIGH: + return getHigh(); + case LOW: + return getLow(); + case VOLUME: + return new Double(getVolume()); + case CHANGE1: + return new Double(getChange1()); + case QUOTES: + return getQuotes(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case MIXED: + setSequence(getMixed(), newValue); + return; + case SYMBOL: + setSymbol((String)newValue); + return; + case COMPANY_NAME: + setCompanyName((String)newValue); + return; + case PRICE: + setPrice((BigDecimal)newValue); + return; + case OPEN1: + setOpen1((BigDecimal)newValue); + return; + case HIGH: + setHigh((BigDecimal)newValue); + return; + case LOW: + setLow((BigDecimal)newValue); + return; + case VOLUME: + setVolume(((Double)newValue).doubleValue()); + return; + case CHANGE1: + setChange1(((Double)newValue).doubleValue()); + return; + case QUOTES: + getQuotes().clear(); + getQuotes().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + unsetSequence(getMixed()); + return; + case SYMBOL: + setSymbol(SYMBOL_DEFAULT_); + return; + case COMPANY_NAME: + setCompanyName(COMPANY_NAME_DEFAULT_); + return; + case PRICE: + setPrice(PRICE_DEFAULT_); + return; + case OPEN1: + setOpen1(OPEN1_DEFAULT_); + return; + case HIGH: + setHigh(HIGH_DEFAULT_); + return; + case LOW: + setLow(LOW_DEFAULT_); + return; + case VOLUME: + unsetVolume(); + return; + case CHANGE1: + unsetChange1(); + return; + case QUOTES: + getQuotes().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + // KDK - should this be !isSequenceEmpty? + return mixed != null && !isSequenceEmpty(getMixed()); + case SYMBOL: + return SYMBOL_DEFAULT_ == null ? getSymbol() != null : !SYMBOL_DEFAULT_.equals(getSymbol()); + case COMPANY_NAME: + return COMPANY_NAME_DEFAULT_ == null ? getCompanyName() != null : !COMPANY_NAME_DEFAULT_.equals(getCompanyName()); + case PRICE: + return PRICE_DEFAULT_ == null ? getPrice() != null : !PRICE_DEFAULT_.equals(getPrice()); + case OPEN1: + return OPEN1_DEFAULT_ == null ? getOpen1() != null : !OPEN1_DEFAULT_.equals(getOpen1()); + case HIGH: + return HIGH_DEFAULT_ == null ? getHigh() != null : !HIGH_DEFAULT_.equals(getHigh()); + case LOW: + return LOW_DEFAULT_ == null ? getLow() != null : !LOW_DEFAULT_.equals(getLow()); + case VOLUME: + return isSetVolume(); + case CHANGE1: + return isSetChange1(); + case QUOTES: + return !getQuotes().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mixed: "); + result.append(mixed); + result.append(')'); + return result.toString(); + } + +} //MixedQuoteImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/MixedRepeatingChoiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/MixedRepeatingChoiceImpl.java new file mode 100644 index 0000000000..7e49e448f8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/MixedRepeatingChoiceImpl.java @@ -0,0 +1,299 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences.impl; + +import com.example.sequences.MixedRepeatingChoice; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import commonj.sdo.helper.TypeHelper; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +import org.apache.tuscany.sdo.util.BasicSequence; + +/** + * + * An implementation of the model object 'Mixed Repeating Choice'. + * + *

      + * The following features are implemented: + *

        + *
      • {@link com.example.sequences.impl.MixedRepeatingChoiceImpl#getMixed Mixed}
      • + *
      • {@link com.example.sequences.impl.MixedRepeatingChoiceImpl#getGroup Group}
      • + *
      • {@link com.example.sequences.impl.MixedRepeatingChoiceImpl#getA A}
      • + *
      • {@link com.example.sequences.impl.MixedRepeatingChoiceImpl#getB B}
      • + *
      + *

      + * + * @generated + */ +public class MixedRepeatingChoiceImpl extends DataObjectBase implements MixedRepeatingChoice +{ + /** + * The feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public final static int MIXED = 0; + + /** + * The cached value of the '{@link #getMixed() Mixed}' attribute list. + * + * + * @see #getMixed() + * @generated + * @ordered + */ + + // How to get BasicSequence from Sequence? + + protected BasicSequence mixed = null; + + /** + * The feature id for the 'Group' attribute list. + * + * + * @generated + * @ordered + */ + public final static int GROUP = 1; + + /** + * The feature id for the 'A' attribute list. + * + * + * @generated + * @ordered + */ + public final static int A = 2; + + /** + * The feature id for the 'B' attribute list. + * + * + * @generated + * @ordered + */ + public final static int B = 3; + + /** + * + * + * @generated + */ + protected MixedRepeatingChoiceImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getType() + { + return TypeHelper.INSTANCE.getType(MixedRepeatingChoice.class); //TBD Generate a more efficient implementation + } + + /** + * + * + * @generated + */ + public Sequence getMixed() + { + if (mixed == null) + { + mixed = createSequence(MIXED); + + } + return mixed; + } + + /** + * + * + * @generated + */ + public Sequence getGroup() + { + return createSequence(getMixed(), getType(), GROUP); + } + + /** + * + * + * @generated + */ + public List getA() + { + return getList(getGroup(), getType(), A); + + } + + /** + * + * + * @generated + */ + public List getB() + { + return getList(getGroup(), getType(), B); + + } + + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case MIXED: + return removeFromSequence(getMixed(), otherEnd, changeContext); + case GROUP: + return removeFromSequence(getGroup(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case MIXED: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getMixed(); + case GROUP: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup(); + case A: + return getA(); + case B: + return getB(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case MIXED: + setSequence(getMixed(), newValue); + return; + case GROUP: + setSequence(getGroup(), newValue); + return; + case A: + getA().clear(); + getA().addAll((Collection)newValue); + return; + case B: + getB().clear(); + getB().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + unsetSequence(getMixed()); + return; + case GROUP: + unsetSequence(getGroup()); + return; + case A: + getA().clear(); + return; + case B: + getB().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + // KDK - should this be !isSequenceEmpty? + return mixed != null && !isSequenceEmpty(getMixed()); + case GROUP: + return !isSequenceEmpty(getGroup()); + case A: + return !getA().isEmpty(); + case B: + return !getB().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mixed: "); + result.append(mixed); + result.append(')'); + return result.toString(); + } + +} //MixedRepeatingChoiceImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/RepeatingChoiceImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/RepeatingChoiceImpl.java new file mode 100644 index 0000000000..f4bc2c301f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/RepeatingChoiceImpl.java @@ -0,0 +1,265 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences.impl; + +import com.example.sequences.RepeatingChoice; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import commonj.sdo.helper.TypeHelper; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +import org.apache.tuscany.sdo.util.BasicSequence; + +/** + * + * An implementation of the model object 'Repeating Choice'. + * + *

      + * The following features are implemented: + *

        + *
      • {@link com.example.sequences.impl.RepeatingChoiceImpl#getGroup Group}
      • + *
      • {@link com.example.sequences.impl.RepeatingChoiceImpl#getA A}
      • + *
      • {@link com.example.sequences.impl.RepeatingChoiceImpl#getB B}
      • + *
      + *

      + * + * @generated + */ +public class RepeatingChoiceImpl extends DataObjectBase implements RepeatingChoice +{ + /** + * The feature id for the 'Group' attribute list. + * + * + * @generated + * @ordered + */ + public final static int GROUP = 0; + + /** + * The cached value of the '{@link #getGroup() Group}' attribute list. + * + * + * @see #getGroup() + * @generated + * @ordered + */ + + // How to get BasicSequence from Sequence? + + protected BasicSequence group = null; + + /** + * The feature id for the 'A' attribute list. + * + * + * @generated + * @ordered + */ + public final static int A = 1; + + /** + * The feature id for the 'B' attribute list. + * + * + * @generated + * @ordered + */ + public final static int B = 2; + + /** + * + * + * @generated + */ + protected RepeatingChoiceImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getType() + { + return TypeHelper.INSTANCE.getType(RepeatingChoice.class); //TBD Generate a more efficient implementation + } + + /** + * + * + * @generated + */ + public Sequence getGroup() + { + if (group == null) + { + group = createSequence(GROUP); + + } + return group; + } + + /** + * + * + * @generated + */ + public List getA() + { + return getList(getGroup(), getType(), A); + + } + + /** + * + * + * @generated + */ + public List getB() + { + return getList(getGroup(), getType(), B); + + } + + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case GROUP: + return removeFromSequence(getGroup(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case GROUP: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup(); + case A: + return getA(); + case B: + return getB(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case GROUP: + setSequence(getGroup(), newValue); + return; + case A: + getA().clear(); + getA().addAll((Collection)newValue); + return; + case B: + getB().clear(); + getB().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case GROUP: + unsetSequence(getGroup()); + return; + case A: + getA().clear(); + return; + case B: + getB().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case GROUP: + // KDK - should this be !isSequenceEmpty? + return group != null && !isSequenceEmpty(getGroup()); + case A: + return !getA().isEmpty(); + case B: + return !getB().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (group: "); + result.append(group); + result.append(')'); + return result.toString(); + } + +} //RepeatingChoiceImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java new file mode 100644 index 0000000000..0cef7a04d1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/SequencesFactoryImpl.java @@ -0,0 +1,692 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences.impl; + +import org.apache.tuscany.sdo.impl.FactoryBase; +import org.apache.tuscany.sdo.impl.SDOFactoryImpl; +import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl; +import org.apache.tuscany.sdo.model.impl.ModelPackageImpl; +import org.apache.tuscany.sdo.util.SDOUtil; + +import com.example.sequences.MixedQuote; +import com.example.sequences.MixedRepeatingChoice; +import com.example.sequences.RepeatingChoice; +import com.example.sequences.SequencesFactory; +import com.example.sequences.TwoRCs; +import com.example.sequences.TwoRCsMixed; +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class SequencesFactoryImpl extends FactoryBase implements SequencesFactory +{ + +/** + * The package namespace URI. + * + * + * @generated + */ +public static final String NAMESPACE_URI = "http://www.example.com/sequences"; + +/** + * The package namespace name. + * + * + * @generated + */ +public static final String NAMESPACE_PREFIX = "sequences"; + + +public static final int MIXED_QUOTE = 1; +public static final int MIXED_REPEATING_CHOICE = 2; +public static final int REPEATING_CHOICE = 3; +public static final int TWO_RCS = 4; +public static final int TWO_RCS_MIXED = 5; + + + /** + * Creates the default factory implementation. + * + * + * @generated + */ + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public SequencesFactoryImpl() + { + super(NAMESPACE_URI, NAMESPACE_PREFIX); + } + + /** + * + * + * @generated + */ + public DataObject create(int typeNumber) + { + switch (typeNumber) + { + // TODO make sure we're supposed to ingore DOCUMENT_ROOT + case MIXED_QUOTE: return (DataObject)createMixedQuote(); + // TODO make sure we're supposed to ingore DOCUMENT_ROOT + case MIXED_REPEATING_CHOICE: return (DataObject)createMixedRepeatingChoice(); + // TODO make sure we're supposed to ingore DOCUMENT_ROOT + case REPEATING_CHOICE: return (DataObject)createRepeatingChoice(); + // TODO make sure we're supposed to ingore DOCUMENT_ROOT + case TWO_RCS: return (DataObject)createTwoRCs(); + // TODO make sure we're supposed to ingore DOCUMENT_ROOT + case TWO_RCS_MIXED: return (DataObject)createTwoRCsMixed(); + default: + return super.create(typeNumber); + } + } + + + /** + * + * + * @generated + */ + public MixedQuote createMixedQuote() + { + MixedQuoteImpl mixedQuote = new MixedQuoteImpl(); + return mixedQuote; + } + + // Following creates and initializes SDO metadata for the supported types. + protected Type mixedQuoteType = null; + + public Type getMixedQuote() + { + // TODO - kdk - verify how to generate quoteType...mixedQuoteType? + return mixedQuoteType; + } + /** + * + * + * @generated + */ + public MixedRepeatingChoice createMixedRepeatingChoice() + { + MixedRepeatingChoiceImpl mixedRepeatingChoice = new MixedRepeatingChoiceImpl(); + return mixedRepeatingChoice; + } + + // Following creates and initializes SDO metadata for the supported types. + protected Type mixedRepeatingChoiceType = null; + + public Type getMixedRepeatingChoice() + { + // TODO - kdk - verify how to generate quoteType...mixedRepeatingChoiceType? + return mixedRepeatingChoiceType; + } + /** + * + * + * @generated + */ + public RepeatingChoice createRepeatingChoice() + { + RepeatingChoiceImpl repeatingChoice = new RepeatingChoiceImpl(); + return repeatingChoice; + } + + // Following creates and initializes SDO metadata for the supported types. + protected Type repeatingChoiceType = null; + + public Type getRepeatingChoice() + { + // TODO - kdk - verify how to generate quoteType...repeatingChoiceType? + return repeatingChoiceType; + } + /** + * + * + * @generated + */ + public TwoRCs createTwoRCs() + { + TwoRCsImpl twoRCs = new TwoRCsImpl(); + return twoRCs; + } + + // Following creates and initializes SDO metadata for the supported types. + protected Type twoRCsType = null; + + public Type getTwoRCs() + { + // TODO - kdk - verify how to generate quoteType...twoRCsType? + return twoRCsType; + } + /** + * + * + * @generated + */ + public TwoRCsMixed createTwoRCsMixed() + { + TwoRCsMixedImpl twoRCsMixed = new TwoRCsMixedImpl(); + return twoRCsMixed; + } + + // Following creates and initializes SDO metadata for the supported types. + protected Type twoRCsMixedType = null; + + public Type getTwoRCsMixed() + { + // TODO - kdk - verify how to generate quoteType...twoRCsMixedType? + return twoRCsMixedType; + } + + private static boolean isInited = false; + + public static SequencesFactoryImpl init() + { + if (isInited) return (SequencesFactoryImpl)FactoryBase.getStaticFactory(SequencesFactoryImpl.NAMESPACE_URI); + SequencesFactoryImpl theSequencesFactoryImpl = new SequencesFactoryImpl(); + isInited = true; + + // Initialize simple dependencies + SDOUtil.registerStaticTypes(SDOFactoryImpl.class); + SDOUtil.registerStaticTypes(ModelPackageImpl.class); + + // Create package meta-data objects + theSequencesFactoryImpl.createMetaData(); + + // Initialize created meta-data + theSequencesFactoryImpl.initializeMetaData(); + + // Mark meta-data to indicate it can't be changed + //theSequencesFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ???? + + return theSequencesFactoryImpl; + } + + private boolean isCreated = false; + + public void createMetaData() + { + if (isCreated) return; + isCreated = true; + + + mixedQuoteType = createType(false, MIXED_QUOTE); + createProperty(true, mixedQuoteType, MixedQuoteImpl.MIXED); + createProperty(true, mixedQuoteType, MixedQuoteImpl.SYMBOL); + createProperty(true, mixedQuoteType, MixedQuoteImpl.COMPANY_NAME); + createProperty(true, mixedQuoteType, MixedQuoteImpl.PRICE); + createProperty(true, mixedQuoteType, MixedQuoteImpl.OPEN1); + createProperty(true, mixedQuoteType, MixedQuoteImpl.HIGH); + createProperty(true, mixedQuoteType, MixedQuoteImpl.LOW); + createProperty(true, mixedQuoteType, MixedQuoteImpl.VOLUME); + createProperty(true, mixedQuoteType, MixedQuoteImpl.CHANGE1); + createProperty(false, mixedQuoteType, MixedQuoteImpl.QUOTES); + + mixedRepeatingChoiceType = createType(false, MIXED_REPEATING_CHOICE); + createProperty(true, mixedRepeatingChoiceType, MixedRepeatingChoiceImpl.MIXED); + createProperty(true, mixedRepeatingChoiceType, MixedRepeatingChoiceImpl.GROUP); + createProperty(true, mixedRepeatingChoiceType, MixedRepeatingChoiceImpl.A); + createProperty(true, mixedRepeatingChoiceType, MixedRepeatingChoiceImpl.B); + + repeatingChoiceType = createType(false, REPEATING_CHOICE); + createProperty(true, repeatingChoiceType, RepeatingChoiceImpl.GROUP); + createProperty(true, repeatingChoiceType, RepeatingChoiceImpl.A); + createProperty(true, repeatingChoiceType, RepeatingChoiceImpl.B); + + twoRCsType = createType(false, TWO_RCS); + createProperty(true, twoRCsType, TwoRCsImpl.GROUP); + createProperty(true, twoRCsType, TwoRCsImpl.A); + createProperty(true, twoRCsType, TwoRCsImpl.B); + createProperty(true, twoRCsType, TwoRCsImpl.SPLIT); + createProperty(true, twoRCsType, TwoRCsImpl.GROUP1); + createProperty(true, twoRCsType, TwoRCsImpl.Y); + createProperty(true, twoRCsType, TwoRCsImpl.Z); + + twoRCsMixedType = createType(false, TWO_RCS_MIXED); + createProperty(true, twoRCsMixedType, TwoRCsMixedImpl.MIXED); + createProperty(true, twoRCsMixedType, TwoRCsMixedImpl.GROUP); + createProperty(true, twoRCsMixedType, TwoRCsMixedImpl.A); + createProperty(true, twoRCsMixedType, TwoRCsMixedImpl.B); + createProperty(true, twoRCsMixedType, TwoRCsMixedImpl.SPLIT); + createProperty(true, twoRCsMixedType, TwoRCsMixedImpl.GROUP1); + createProperty(true, twoRCsMixedType, TwoRCsMixedImpl.Y); + createProperty(true, twoRCsMixedType, TwoRCsMixedImpl.Z); + } + private boolean isInitialized = false; + + public void initializeMetaData() + { + if (isInitialized) return; + isInitialized = true; + + // Obtain other dependent packages + ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)FactoryBase.getStaticFactory(ModelFactoryImpl.NAMESPACE_URI); + + // Add supertypes to classes + // Initialize classes and features; add operations and parameters + + initializeType(mixedQuoteType, MixedQuote.class, "MixedQuote"); + initializeProperty((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.MIXED), getSequence(), "mixed", null, 0, -1, MixedQuote.class, false, false, false); + initializeProperty((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.SYMBOL), theModelPackageImpl.getString(), "symbol", null, 1, 1, MixedQuote.class, false, false, true); + initializeProperty((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.COMPANY_NAME), theModelPackageImpl.getString(), "companyName", null, 1, 1, MixedQuote.class, false, false, true); + initializeProperty((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.PRICE), theModelPackageImpl.getDecimal(), "price", null, 1, 1, MixedQuote.class, false, false, true); + initializeProperty((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.OPEN1), theModelPackageImpl.getDecimal(), "open1", null, 1, 1, MixedQuote.class, false, false, true); + initializeProperty((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.HIGH), theModelPackageImpl.getDecimal(), "high", null, 1, 1, MixedQuote.class, false, false, true); + initializeProperty((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.LOW), theModelPackageImpl.getDecimal(), "low", null, 1, 1, MixedQuote.class, false, false, true); + initializeProperty((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.VOLUME), theModelPackageImpl.getDouble(), "volume", null, 1, 1, MixedQuote.class, false, true, true); + initializeProperty((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.CHANGE1), theModelPackageImpl.getDouble(), "change1", null, 1, 1, MixedQuote.class, false, true, true); + initializeProperty((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.QUOTES), this.getMixedQuote(), "quotes", null, 0, -1, MixedQuote.class, false, false, true, true , null); + + initializeType(mixedRepeatingChoiceType, MixedRepeatingChoice.class, "MixedRepeatingChoice"); + initializeProperty((Property)mixedRepeatingChoiceType.getProperties().get(MixedRepeatingChoiceImpl.MIXED), getSequence(), "mixed", null, 0, -1, MixedRepeatingChoice.class, false, false, false); + initializeProperty((Property)mixedRepeatingChoiceType.getProperties().get(MixedRepeatingChoiceImpl.GROUP), getSequence(), "group", null, 0, -1, MixedRepeatingChoice.class, false, false, true); + initializeProperty((Property)mixedRepeatingChoiceType.getProperties().get(MixedRepeatingChoiceImpl.A), theModelPackageImpl.getString(), "a", null, 0, -1, MixedRepeatingChoice.class, false, false, true); + initializeProperty((Property)mixedRepeatingChoiceType.getProperties().get(MixedRepeatingChoiceImpl.B), theModelPackageImpl.getInt(), "b", null, 0, -1, MixedRepeatingChoice.class, false, false, true); + + initializeType(repeatingChoiceType, RepeatingChoice.class, "RepeatingChoice"); + initializeProperty((Property)repeatingChoiceType.getProperties().get(RepeatingChoiceImpl.GROUP), getSequence(), "group", null, 0, -1, RepeatingChoice.class, false, false, false); + initializeProperty((Property)repeatingChoiceType.getProperties().get(RepeatingChoiceImpl.A), theModelPackageImpl.getString(), "a", null, 0, -1, RepeatingChoice.class, false, false, true); + initializeProperty((Property)repeatingChoiceType.getProperties().get(RepeatingChoiceImpl.B), theModelPackageImpl.getInt(), "b", null, 0, -1, RepeatingChoice.class, false, false, true); + + initializeType(twoRCsType, TwoRCs.class, "TwoRCs"); + initializeProperty((Property)twoRCsType.getProperties().get(TwoRCsImpl.GROUP), getSequence(), "group", null, 0, -1, TwoRCs.class, false, false, false); + initializeProperty((Property)twoRCsType.getProperties().get(TwoRCsImpl.A), theModelPackageImpl.getString(), "a", null, 0, -1, TwoRCs.class, false, false, true); + initializeProperty((Property)twoRCsType.getProperties().get(TwoRCsImpl.B), theModelPackageImpl.getInt(), "b", null, 0, -1, TwoRCs.class, false, false, true); + initializeProperty((Property)twoRCsType.getProperties().get(TwoRCsImpl.SPLIT), theModelPackageImpl.getString(), "split", null, 1, 1, TwoRCs.class, false, false, false); + initializeProperty((Property)twoRCsType.getProperties().get(TwoRCsImpl.GROUP1), getSequence(), "group1", null, 0, -1, TwoRCs.class, false, false, false); + initializeProperty((Property)twoRCsType.getProperties().get(TwoRCsImpl.Y), theModelPackageImpl.getString(), "y", null, 0, -1, TwoRCs.class, false, false, true); + initializeProperty((Property)twoRCsType.getProperties().get(TwoRCsImpl.Z), theModelPackageImpl.getInt(), "z", null, 0, -1, TwoRCs.class, false, false, true); + + initializeType(twoRCsMixedType, TwoRCsMixed.class, "TwoRCsMixed"); + initializeProperty((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.MIXED), getSequence(), "mixed", null, 0, -1, TwoRCsMixed.class, false, false, false); + initializeProperty((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.GROUP), getSequence(), "group", null, 0, -1, TwoRCsMixed.class, false, false, true); + initializeProperty((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.A), theModelPackageImpl.getString(), "a", null, 0, -1, TwoRCsMixed.class, false, false, true); + initializeProperty((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.B), theModelPackageImpl.getInt(), "b", null, 0, -1, TwoRCsMixed.class, false, false, true); + initializeProperty((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.SPLIT), theModelPackageImpl.getString(), "split", null, 1, 1, TwoRCsMixed.class, false, false, true); + initializeProperty((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.GROUP1), getSequence(), "group1", null, 0, -1, TwoRCsMixed.class, false, false, true); + initializeProperty((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.Y), theModelPackageImpl.getString(), "y", null, 0, -1, TwoRCsMixed.class, false, false, true); + initializeProperty((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.Z), theModelPackageImpl.getInt(), "z", null, 0, -1, TwoRCsMixed.class, false, false, true);createXSDMetaData(); + } + + protected void createXSDMetaData() + { + super.createXSDMetaData(); + // TODO - kdk - is the order right? should kind, elementOnly be first + addXSDMapping + (mixedQuoteType, + new String[] + { + "name", "MixedQuote", + "kind", "elementOnly" + }); + addXSDMapping + ((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.MIXED), + new String[] + { + "kind", "element", + "name", "mixed" + }); + + addXSDMapping + ((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.SYMBOL), + new String[] + { + "kind", "element", + "name", "symbol" + }); + + addXSDMapping + ((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.COMPANY_NAME), + new String[] + { + "kind", "element", + "name", "companyName" + }); + + addXSDMapping + ((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.PRICE), + new String[] + { + "kind", "element", + "name", "price" + }); + + addXSDMapping + ((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.OPEN1), + new String[] + { + "kind", "element", + "name", "open1" + }); + + addXSDMapping + ((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.HIGH), + new String[] + { + "kind", "element", + "name", "high" + }); + + addXSDMapping + ((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.LOW), + new String[] + { + "kind", "element", + "name", "low" + }); + + addXSDMapping + ((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.VOLUME), + new String[] + { + "kind", "element", + "name", "volume" + }); + + addXSDMapping + ((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.CHANGE1), + new String[] + { + "kind", "element", + "name", "change1" + }); + + addXSDMapping + ((Property)mixedQuoteType.getProperties().get(MixedQuoteImpl.QUOTES), + new String[] + { + "kind", "element", + "name", "quotes" + }); + + // TODO - kdk - is the order right? should kind, elementOnly be first + addXSDMapping + (mixedRepeatingChoiceType, + new String[] + { + "name", "MixedRepeatingChoice", + "kind", "elementOnly" + }); + addXSDMapping + ((Property)mixedRepeatingChoiceType.getProperties().get(MixedRepeatingChoiceImpl.MIXED), + new String[] + { + "kind", "element", + "name", "mixed" + }); + + addXSDMapping + ((Property)mixedRepeatingChoiceType.getProperties().get(MixedRepeatingChoiceImpl.GROUP), + new String[] + { + "kind", "element", + "name", "group" + }); + + addXSDMapping + ((Property)mixedRepeatingChoiceType.getProperties().get(MixedRepeatingChoiceImpl.A), + new String[] + { + "kind", "element", + "name", "a" + }); + + addXSDMapping + ((Property)mixedRepeatingChoiceType.getProperties().get(MixedRepeatingChoiceImpl.B), + new String[] + { + "kind", "element", + "name", "b" + }); + + // TODO - kdk - is the order right? should kind, elementOnly be first + addXSDMapping + (repeatingChoiceType, + new String[] + { + "name", "RepeatingChoice", + "kind", "elementOnly" + }); + addXSDMapping + ((Property)repeatingChoiceType.getProperties().get(RepeatingChoiceImpl.GROUP), + new String[] + { + "kind", "element", + "name", "group" + }); + + addXSDMapping + ((Property)repeatingChoiceType.getProperties().get(RepeatingChoiceImpl.A), + new String[] + { + "kind", "element", + "name", "a" + }); + + addXSDMapping + ((Property)repeatingChoiceType.getProperties().get(RepeatingChoiceImpl.B), + new String[] + { + "kind", "element", + "name", "b" + }); + + // TODO - kdk - is the order right? should kind, elementOnly be first + addXSDMapping + (twoRCsType, + new String[] + { + "name", "TwoRCs", + "kind", "elementOnly" + }); + addXSDMapping + ((Property)twoRCsType.getProperties().get(TwoRCsImpl.GROUP), + new String[] + { + "kind", "element", + "name", "group" + }); + + addXSDMapping + ((Property)twoRCsType.getProperties().get(TwoRCsImpl.A), + new String[] + { + "kind", "element", + "name", "a" + }); + + addXSDMapping + ((Property)twoRCsType.getProperties().get(TwoRCsImpl.B), + new String[] + { + "kind", "element", + "name", "b" + }); + + addXSDMapping + ((Property)twoRCsType.getProperties().get(TwoRCsImpl.SPLIT), + new String[] + { + "kind", "element", + "name", "split" + }); + + addXSDMapping + ((Property)twoRCsType.getProperties().get(TwoRCsImpl.GROUP1), + new String[] + { + "kind", "element", + "name", "group1" + }); + + addXSDMapping + ((Property)twoRCsType.getProperties().get(TwoRCsImpl.Y), + new String[] + { + "kind", "element", + "name", "y" + }); + + addXSDMapping + ((Property)twoRCsType.getProperties().get(TwoRCsImpl.Z), + new String[] + { + "kind", "element", + "name", "z" + }); + + // TODO - kdk - is the order right? should kind, elementOnly be first + addXSDMapping + (twoRCsMixedType, + new String[] + { + "name", "TwoRCsMixed", + "kind", "elementOnly" + }); + addXSDMapping + ((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.MIXED), + new String[] + { + "kind", "element", + "name", "mixed" + }); + + addXSDMapping + ((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.GROUP), + new String[] + { + "kind", "element", + "name", "group" + }); + + addXSDMapping + ((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.A), + new String[] + { + "kind", "element", + "name", "a" + }); + + addXSDMapping + ((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.B), + new String[] + { + "kind", "element", + "name", "b" + }); + + addXSDMapping + ((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.SPLIT), + new String[] + { + "kind", "element", + "name", "split" + }); + + addXSDMapping + ((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.GROUP1), + new String[] + { + "kind", "element", + "name", "group1" + }); + + addXSDMapping + ((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.Y), + new String[] + { + "kind", "element", + "name", "y" + }); + + addXSDMapping + ((Property)twoRCsMixedType.getProperties().get(TwoRCsMixedImpl.Z), + new String[] + { + "kind", "element", + "name", "z" + }); + + + // TODO - kdk - how do I filter out mixed, xMLNSPrefixMap, and xSISchemaLocation without hardcoding it + // TODO - kdk - can I hardcode ##targetNamespace? + + createGlobalProperty + ("mixedStockQuote", + this.getMixedQuote(), + new String[] + { + "kind", "element", + "name", "mixedStockQuote", + "namespace", "##targetNamespace" + }); + + createGlobalProperty + ("mrc", + this.getMixedRepeatingChoice(), + new String[] + { + "kind", "element", + "name", "mrc", + "namespace", "##targetNamespace" + }); + + createGlobalProperty + ("mrc2", + this.getTwoRCsMixed(), + new String[] + { + "kind", "element", + "name", "mrc2", + "namespace", "##targetNamespace" + }); + + createGlobalProperty + ("rc", + this.getRepeatingChoice(), + new String[] + { + "kind", "element", + "name", "rc", + "namespace", "##targetNamespace" + }); + + createGlobalProperty + ("rc2", + this.getTwoRCs(), + new String[] + { + "kind", "element", + "name", "rc2", + "namespace", "##targetNamespace" + }); + + } + +} //SequencesFactoryImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/TwoRCsImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/TwoRCsImpl.java new file mode 100644 index 0000000000..c29eae934d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/TwoRCsImpl.java @@ -0,0 +1,449 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences.impl; + +import com.example.sequences.TwoRCs; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import commonj.sdo.helper.TypeHelper; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +import org.apache.tuscany.sdo.util.BasicSequence; + +/** + * + * An implementation of the model object 'Two RCs'. + * + *

      + * The following features are implemented: + *

        + *
      • {@link com.example.sequences.impl.TwoRCsImpl#getGroup Group}
      • + *
      • {@link com.example.sequences.impl.TwoRCsImpl#getA A}
      • + *
      • {@link com.example.sequences.impl.TwoRCsImpl#getB B}
      • + *
      • {@link com.example.sequences.impl.TwoRCsImpl#getSplit Split}
      • + *
      • {@link com.example.sequences.impl.TwoRCsImpl#getGroup1 Group1}
      • + *
      • {@link com.example.sequences.impl.TwoRCsImpl#getY Y}
      • + *
      • {@link com.example.sequences.impl.TwoRCsImpl#getZ Z}
      • + *
      + *

      + * + * @generated + */ +public class TwoRCsImpl extends DataObjectBase implements TwoRCs +{ + /** + * The feature id for the 'Group' attribute list. + * + * + * @generated + * @ordered + */ + public final static int GROUP = 0; + + /** + * The cached value of the '{@link #getGroup() Group}' attribute list. + * + * + * @see #getGroup() + * @generated + * @ordered + */ + + // How to get BasicSequence from Sequence? + + protected BasicSequence group = null; + + /** + * The feature id for the 'A' attribute list. + * + * + * @generated + * @ordered + */ + public final static int A = 1; + + /** + * The feature id for the 'B' attribute list. + * + * + * @generated + * @ordered + */ + public final static int B = 2; + + /** + * The feature id for the 'Split' attribute. + * + * + * @generated + * @ordered + */ + public final static int SPLIT = 3; + + /** + * The default value of the '{@link #getSplit() Split}' attribute. + * + * + * @see #getSplit() + * @generated + * @ordered + */ + protected static final String SPLIT_DEFAULT_ = null; + + /** + * The cached value of the '{@link #getSplit() Split}' attribute. + * + * + * @see #getSplit() + * @generated + * @ordered + */ + protected String split = SPLIT_DEFAULT_; + + /** + * The feature id for the 'Group1' attribute list. + * + * + * @generated + * @ordered + */ + public final static int GROUP1 = 4; + + /** + * The cached value of the '{@link #getGroup1() Group1}' attribute list. + * + * + * @see #getGroup1() + * @generated + * @ordered + */ + + // How to get BasicSequence from Sequence? + + protected BasicSequence group1 = null; + + /** + * The feature id for the 'Y' attribute list. + * + * + * @generated + * @ordered + */ + public final static int Y = 5; + + /** + * The feature id for the 'Z' attribute list. + * + * + * @generated + * @ordered + */ + public final static int Z = 6; + + /** + * + * + * @generated + */ + protected TwoRCsImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getType() + { + return TypeHelper.INSTANCE.getType(TwoRCs.class); //TBD Generate a more efficient implementation + } + + /** + * + * + * @generated + */ + public Sequence getGroup() + { + if (group == null) + { + group = createSequence(GROUP); + + } + return group; + } + + /** + * + * + * @generated + */ + public List getA() + { + return getList(getGroup(), getType(), A); + + } + + /** + * + * + * @generated + */ + public List getB() + { + return getList(getGroup(), getType(), B); + + } + + /** + * + * + * @generated + */ + public String getSplit() + { + return split; + } + + /** + * + * + * @generated + */ + public void setSplit(String newSplit) + { + String oldSplit = split; + split = newSplit; + if (isNotifying()) + notify(ChangeKind.SET, SPLIT, oldSplit, split); + } + + /** + * + * + * @generated + */ + public Sequence getGroup1() + { + if (group1 == null) + { + group1 = createSequence(GROUP1); + + } + return group1; + } + + /** + * + * + * @generated + */ + public List getY() + { + return getList(getGroup1(), getType(), Y); + + } + + /** + * + * + * @generated + */ + public List getZ() + { + return getList(getGroup1(), getType(), Z); + + } + + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case GROUP: + return removeFromSequence(getGroup(), otherEnd, changeContext); + case GROUP1: + return removeFromSequence(getGroup1(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case GROUP: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup(); + case A: + return getA(); + case B: + return getB(); + case SPLIT: + return getSplit(); + case GROUP1: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup1(); + case Y: + return getY(); + case Z: + return getZ(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case GROUP: + setSequence(getGroup(), newValue); + return; + case A: + getA().clear(); + getA().addAll((Collection)newValue); + return; + case B: + getB().clear(); + getB().addAll((Collection)newValue); + return; + case SPLIT: + setSplit((String)newValue); + return; + case GROUP1: + setSequence(getGroup1(), newValue); + return; + case Y: + getY().clear(); + getY().addAll((Collection)newValue); + return; + case Z: + getZ().clear(); + getZ().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case GROUP: + unsetSequence(getGroup()); + return; + case A: + getA().clear(); + return; + case B: + getB().clear(); + return; + case SPLIT: + setSplit(SPLIT_DEFAULT_); + return; + case GROUP1: + unsetSequence(getGroup1()); + return; + case Y: + getY().clear(); + return; + case Z: + getZ().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case GROUP: + // KDK - should this be !isSequenceEmpty? + return group != null && !isSequenceEmpty(getGroup()); + case A: + return !getA().isEmpty(); + case B: + return !getB().isEmpty(); + case SPLIT: + return SPLIT_DEFAULT_ == null ? split != null : !SPLIT_DEFAULT_.equals(split); + case GROUP1: + // KDK - should this be !isSequenceEmpty? + return group1 != null && !isSequenceEmpty(getGroup1()); + case Y: + return !getY().isEmpty(); + case Z: + return !getZ().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (group: "); + result.append(group); + result.append(", split: "); + result.append(split); + result.append(", group1: "); + result.append(group1); + result.append(')'); + return result.toString(); + } + +} //TwoRCsImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/TwoRCsMixedImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/TwoRCsMixedImpl.java new file mode 100644 index 0000000000..a8c3186088 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/sequences/impl/TwoRCsMixedImpl.java @@ -0,0 +1,447 @@ +/** + * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.sequences.impl; + +import com.example.sequences.TwoRCsMixed; + +import commonj.sdo.Sequence; +import commonj.sdo.Type; + +import commonj.sdo.helper.TypeHelper; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectBase; + +import org.apache.tuscany.sdo.util.BasicSequence; + +/** + * + * An implementation of the model object 'Two RCs Mixed'. + * + *

      + * The following features are implemented: + *

        + *
      • {@link com.example.sequences.impl.TwoRCsMixedImpl#getMixed Mixed}
      • + *
      • {@link com.example.sequences.impl.TwoRCsMixedImpl#getGroup Group}
      • + *
      • {@link com.example.sequences.impl.TwoRCsMixedImpl#getA A}
      • + *
      • {@link com.example.sequences.impl.TwoRCsMixedImpl#getB B}
      • + *
      • {@link com.example.sequences.impl.TwoRCsMixedImpl#getSplit Split}
      • + *
      • {@link com.example.sequences.impl.TwoRCsMixedImpl#getGroup1 Group1}
      • + *
      • {@link com.example.sequences.impl.TwoRCsMixedImpl#getY Y}
      • + *
      • {@link com.example.sequences.impl.TwoRCsMixedImpl#getZ Z}
      • + *
      + *

      + * + * @generated + */ +public class TwoRCsMixedImpl extends DataObjectBase implements TwoRCsMixed +{ + /** + * The feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public final static int MIXED = 0; + + /** + * The cached value of the '{@link #getMixed() Mixed}' attribute list. + * + * + * @see #getMixed() + * @generated + * @ordered + */ + + // How to get BasicSequence from Sequence? + + protected BasicSequence mixed = null; + + /** + * The feature id for the 'Group' attribute list. + * + * + * @generated + * @ordered + */ + public final static int GROUP = 1; + + /** + * The feature id for the 'A' attribute list. + * + * + * @generated + * @ordered + */ + public final static int A = 2; + + /** + * The feature id for the 'B' attribute list. + * + * + * @generated + * @ordered + */ + public final static int B = 3; + + /** + * The feature id for the 'Split' attribute. + * + * + * @generated + * @ordered + */ + public final static int SPLIT = 4; + + /** + * The default value of the '{@link #getSplit() Split}' attribute. + * + * + * @see #getSplit() + * @generated + * @ordered + */ + protected static final String SPLIT_DEFAULT_ = null; + + /** + * The feature id for the 'Group1' attribute list. + * + * + * @generated + * @ordered + */ + public final static int GROUP1 = 5; + + /** + * The feature id for the 'Y' attribute list. + * + * + * @generated + * @ordered + */ + public final static int Y = 6; + + /** + * The feature id for the 'Z' attribute list. + * + * + * @generated + * @ordered + */ + public final static int Z = 7; + + /** + * + * + * @generated + */ + protected TwoRCsMixedImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public Type getType() + { + return TypeHelper.INSTANCE.getType(TwoRCsMixed.class); //TBD Generate a more efficient implementation + } + + /** + * + * + * @generated + */ + public Sequence getMixed() + { + if (mixed == null) + { + mixed = createSequence(MIXED); + + } + return mixed; + } + + /** + * + * + * @generated + */ + public Sequence getGroup() + { + return createSequence(getMixed(), getType(), GROUP); + } + + /** + * + * + * @generated + */ + public List getA() + { + return getList(getGroup(), getType(), A); + + } + + /** + * + * + * @generated + */ + public List getB() + { + return getList(getGroup(), getType(), B); + + } + + /** + * + * + * @generated + */ + public String getSplit() + { + return (String)get(getMixed(), getType(), SPLIT); + } + + /** + * + * + * @generated + */ + public void setSplit(String newSplit) + { + set(getMixed(), getType(), SPLIT, newSplit); + } + + /** + * + * + * @generated + */ + public Sequence getGroup1() + { + return createSequence(getMixed(), getType(), GROUP1); + } + + /** + * + * + * @generated + */ + public List getY() + { + return getList(getGroup1(), getType(), Y); + + } + + /** + * + * + * @generated + */ + public List getZ() + { + return getList(getGroup1(), getType(), Z); + + } + + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { + case MIXED: + return removeFromSequence(getMixed(), otherEnd, changeContext); + case GROUP: + return removeFromSequence(getGroup(), otherEnd, changeContext); + case GROUP1: + return removeFromSequence(getGroup1(), otherEnd, changeContext); + } + return super.inverseRemove(otherEnd, propertyIndex, changeContext); + } + + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { + case MIXED: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getMixed(); + case GROUP: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup(); + case A: + return getA(); + case B: + return getB(); + case SPLIT: + return getSplit(); + case GROUP1: + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return getGroup1(); + case Y: + return getY(); + case Z: + return getZ(); + } + return super.get(propertyIndex, resolve); + } + + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { + case MIXED: + setSequence(getMixed(), newValue); + return; + case GROUP: + setSequence(getGroup(), newValue); + return; + case A: + getA().clear(); + getA().addAll((Collection)newValue); + return; + case B: + getB().clear(); + getB().addAll((Collection)newValue); + return; + case SPLIT: + setSplit((String)newValue); + return; + case GROUP1: + setSequence(getGroup1(), newValue); + return; + case Y: + getY().clear(); + getY().addAll((Collection)newValue); + return; + case Z: + getZ().clear(); + getZ().addAll((Collection)newValue); + return; + } + super.set(propertyIndex, newValue); + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + unsetSequence(getMixed()); + return; + case GROUP: + unsetSequence(getGroup()); + return; + case A: + getA().clear(); + return; + case B: + getB().clear(); + return; + case SPLIT: + setSplit(SPLIT_DEFAULT_); + return; + case GROUP1: + unsetSequence(getGroup1()); + return; + case Y: + getY().clear(); + return; + case Z: + getZ().clear(); + return; + } + super.unset(propertyIndex); + } + + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { + case MIXED: + // KDK - should this be !isSequenceEmpty? + return mixed != null && !isSequenceEmpty(getMixed()); + case GROUP: + return !isSequenceEmpty(getGroup()); + case A: + return !getA().isEmpty(); + case B: + return !getB().isEmpty(); + case SPLIT: + return SPLIT_DEFAULT_ == null ? getSplit() != null : !SPLIT_DEFAULT_.equals(getSplit()); + case GROUP1: + return !isSequenceEmpty(getGroup1()); + case Y: + return !getY().isEmpty(); + case Z: + return !getZ().isEmpty(); + } + return super.isSet(propertyIndex); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mixed: "); + result.append(mixed); + result.append(')'); + return result.toString(); + } + +} //TwoRCsMixedImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/Quote.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/Quote.java new file mode 100644 index 0000000000..57b12ef331 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/Quote.java @@ -0,0 +1,307 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.simple; + +import java.math.BigDecimal; + +import java.util.List; + +/** + * + * A representation of the model object 'Quote'. + * + * + *

      + * The following features are supported: + *

        + *
      • {@link com.example.simple.Quote#getSymbol Symbol}
      • + *
      • {@link com.example.simple.Quote#getCompanyName Company Name}
      • + *
      • {@link com.example.simple.Quote#getPrice Price}
      • + *
      • {@link com.example.simple.Quote#getOpen1 Open1}
      • + *
      • {@link com.example.simple.Quote#getHigh High}
      • + *
      • {@link com.example.simple.Quote#getLow Low}
      • + *
      • {@link com.example.simple.Quote#getVolume Volume}
      • + *
      • {@link com.example.simple.Quote#getChange1 Change1}
      • + *
      • {@link com.example.simple.Quote#getQuotes Quotes}
      • + *
      + *

      + * + * @generated + */ +public interface Quote +{ + /** + * Returns the value of the 'Symbol' attribute. + * + *

      + * If the meaning of the 'Symbol' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Symbol' attribute. + * @see #setSymbol(String) + * @generated + */ + String getSymbol(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getSymbol Symbol}' attribute. + * + * + * @param value the new value of the 'Symbol' attribute. + * @see #getSymbol() + * @generated + */ + void setSymbol(String value); + + /** + * Returns the value of the 'Company Name' attribute. + * + *

      + * If the meaning of the 'Company Name' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Company Name' attribute. + * @see #setCompanyName(String) + * @generated + */ + String getCompanyName(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getCompanyName Company Name}' attribute. + * + * + * @param value the new value of the 'Company Name' attribute. + * @see #getCompanyName() + * @generated + */ + void setCompanyName(String value); + + /** + * Returns the value of the 'Price' attribute. + * + *

      + * If the meaning of the 'Price' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Price' attribute. + * @see #setPrice(BigDecimal) + * @generated + */ + BigDecimal getPrice(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getPrice Price}' attribute. + * + * + * @param value the new value of the 'Price' attribute. + * @see #getPrice() + * @generated + */ + void setPrice(BigDecimal value); + + /** + * Returns the value of the 'Open1' attribute. + * + *

      + * If the meaning of the 'Open1' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Open1' attribute. + * @see #setOpen1(BigDecimal) + * @generated + */ + BigDecimal getOpen1(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getOpen1 Open1}' attribute. + * + * + * @param value the new value of the 'Open1' attribute. + * @see #getOpen1() + * @generated + */ + void setOpen1(BigDecimal value); + + /** + * Returns the value of the 'High' attribute. + * + *

      + * If the meaning of the 'High' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'High' attribute. + * @see #setHigh(BigDecimal) + * @generated + */ + BigDecimal getHigh(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getHigh High}' attribute. + * + * + * @param value the new value of the 'High' attribute. + * @see #getHigh() + * @generated + */ + void setHigh(BigDecimal value); + + /** + * Returns the value of the 'Low' attribute. + * + *

      + * If the meaning of the 'Low' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Low' attribute. + * @see #setLow(BigDecimal) + * @generated + */ + BigDecimal getLow(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getLow Low}' attribute. + * + * + * @param value the new value of the 'Low' attribute. + * @see #getLow() + * @generated + */ + void setLow(BigDecimal value); + + /** + * Returns the value of the 'Volume' attribute. + * + *

      + * If the meaning of the 'Volume' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Volume' attribute. + * @see #isSetVolume() + * @see #unsetVolume() + * @see #setVolume(double) + * @generated + */ + double getVolume(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getVolume Volume}' attribute. + * + * + * @param value the new value of the 'Volume' attribute. + * @see #isSetVolume() + * @see #unsetVolume() + * @see #getVolume() + * @generated + */ + void setVolume(double value); + + /** + * Unsets the value of the '{@link com.example.simple.Quote#getVolume Volume}' attribute. + * + * + * @see #isSetVolume() + * @see #getVolume() + * @see #setVolume(double) + * @generated + */ + void unsetVolume(); + + /** + * Returns whether the value of the '{@link com.example.simple.Quote#getVolume Volume}' attribute is set. + * + * + * @return whether the value of the 'Volume' attribute is set. + * @see #unsetVolume() + * @see #getVolume() + * @see #setVolume(double) + * @generated + */ + boolean isSetVolume(); + + /** + * Returns the value of the 'Change1' attribute. + * + *

      + * If the meaning of the 'Change1' attribute isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Change1' attribute. + * @see #isSetChange1() + * @see #unsetChange1() + * @see #setChange1(double) + * @generated + */ + double getChange1(); + + /** + * Sets the value of the '{@link com.example.simple.Quote#getChange1 Change1}' attribute. + * + * + * @param value the new value of the 'Change1' attribute. + * @see #isSetChange1() + * @see #unsetChange1() + * @see #getChange1() + * @generated + */ + void setChange1(double value); + + /** + * Unsets the value of the '{@link com.example.simple.Quote#getChange1 Change1}' attribute. + * + * + * @see #isSetChange1() + * @see #getChange1() + * @see #setChange1(double) + * @generated + */ + void unsetChange1(); + + /** + * Returns whether the value of the '{@link com.example.simple.Quote#getChange1 Change1}' attribute is set. + * + * + * @return whether the value of the 'Change1' attribute is set. + * @see #unsetChange1() + * @see #getChange1() + * @see #setChange1(double) + * @generated + */ + boolean isSetChange1(); + + /** + * Returns the value of the 'Quotes' containment reference list. + * The list contents are of type {@link com.example.simple.Quote}. + * + *

      + * If the meaning of the 'Quotes' containment reference list isn't clear, + * there really should be more of a description here... + *

      + * + * @return the value of the 'Quotes' containment reference list. + * @generated + */ + List getQuotes(); + +} // Quote diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/SimpleFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/SimpleFactory.java new file mode 100644 index 0000000000..9203976521 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/SimpleFactory.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.simple; + + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @generated + */ +public interface SimpleFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + SimpleFactory INSTANCE = com.example.simple.impl.SimpleFactoryImpl.eINSTANCE; + + /** + * Returns a new object of class 'Quote'. + * + * + * @return a new object of class 'Quote'. + * @generated + */ + Quote createQuote(); + +} //SimpleFactory diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/QuoteImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/QuoteImpl.java new file mode 100644 index 0000000000..5b407dd311 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/QuoteImpl.java @@ -0,0 +1,712 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.simple.impl; + +import com.example.simple.Quote; + +import java.math.BigDecimal; + +import java.util.Collection; +import java.util.List; + +import org.apache.tuscany.sdo.impl.DataObjectImpl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Quote'. + * + *

      + * The following features are implemented: + *

        + *
      • {@link com.example.simple.impl.QuoteImpl#getSymbol Symbol}
      • + *
      • {@link com.example.simple.impl.QuoteImpl#getCompanyName Company Name}
      • + *
      • {@link com.example.simple.impl.QuoteImpl#getPrice Price}
      • + *
      • {@link com.example.simple.impl.QuoteImpl#getOpen1 Open1}
      • + *
      • {@link com.example.simple.impl.QuoteImpl#getHigh High}
      • + *
      • {@link com.example.simple.impl.QuoteImpl#getLow Low}
      • + *
      • {@link com.example.simple.impl.QuoteImpl#getVolume Volume}
      • + *
      • {@link com.example.simple.impl.QuoteImpl#getChange1 Change1}
      • + *
      • {@link com.example.simple.impl.QuoteImpl#getQuotes Quotes}
      • + *
      + *

      + * + * @generated + */ +public class QuoteImpl extends DataObjectImpl implements Quote +{ + /** + * The default value of the '{@link #getSymbol() Symbol}' attribute. + * + * + * @see #getSymbol() + * @generated + * @ordered + */ + protected static final String SYMBOL_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSymbol() Symbol}' attribute. + * + * + * @see #getSymbol() + * @generated + * @ordered + */ + protected String symbol = SYMBOL_EDEFAULT; + + /** + * The default value of the '{@link #getCompanyName() Company Name}' attribute. + * + * + * @see #getCompanyName() + * @generated + * @ordered + */ + protected static final String COMPANY_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getCompanyName() Company Name}' attribute. + * + * + * @see #getCompanyName() + * @generated + * @ordered + */ + protected String companyName = COMPANY_NAME_EDEFAULT; + + /** + * The default value of the '{@link #getPrice() Price}' attribute. + * + * + * @see #getPrice() + * @generated + * @ordered + */ + protected static final BigDecimal PRICE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getPrice() Price}' attribute. + * + * + * @see #getPrice() + * @generated + * @ordered + */ + protected BigDecimal price = PRICE_EDEFAULT; + + /** + * The default value of the '{@link #getOpen1() Open1}' attribute. + * + * + * @see #getOpen1() + * @generated + * @ordered + */ + protected static final BigDecimal OPEN1_EDEFAULT = null; + + /** + * The cached value of the '{@link #getOpen1() Open1}' attribute. + * + * + * @see #getOpen1() + * @generated + * @ordered + */ + protected BigDecimal open1 = OPEN1_EDEFAULT; + + /** + * The default value of the '{@link #getHigh() High}' attribute. + * + * + * @see #getHigh() + * @generated + * @ordered + */ + protected static final BigDecimal HIGH_EDEFAULT = null; + + /** + * The cached value of the '{@link #getHigh() High}' attribute. + * + * + * @see #getHigh() + * @generated + * @ordered + */ + protected BigDecimal high = HIGH_EDEFAULT; + + /** + * The default value of the '{@link #getLow() Low}' attribute. + * + * + * @see #getLow() + * @generated + * @ordered + */ + protected static final BigDecimal LOW_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLow() Low}' attribute. + * + * + * @see #getLow() + * @generated + * @ordered + */ + protected BigDecimal low = LOW_EDEFAULT; + + /** + * The default value of the '{@link #getVolume() Volume}' attribute. + * + * + * @see #getVolume() + * @generated + * @ordered + */ + protected static final double VOLUME_EDEFAULT = 0.0; + + /** + * The cached value of the '{@link #getVolume() Volume}' attribute. + * + * + * @see #getVolume() + * @generated + * @ordered + */ + protected double volume = VOLUME_EDEFAULT; + + /** + * This is true if the Volume attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean volumeESet = false; + + /** + * The default value of the '{@link #getChange1() Change1}' attribute. + * + * + * @see #getChange1() + * @generated + * @ordered + */ + protected static final double CHANGE1_EDEFAULT = 0.0; + + /** + * The cached value of the '{@link #getChange1() Change1}' attribute. + * + * + * @see #getChange1() + * @generated + * @ordered + */ + protected double change1 = CHANGE1_EDEFAULT; + + /** + * This is true if the Change1 attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean change1ESet = false; + + /** + * The cached value of the '{@link #getQuotes() Quotes}' containment reference list. + * + * + * @see #getQuotes() + * @generated + * @ordered + */ + protected EList quotes = null; + + /** + * + * + * @generated + */ + protected QuoteImpl() + { + super(); + } + + /** + * + * + * @generated + */ + protected EClass eStaticClass() + { + return SimplePackageImpl.Literals.QUOTE; + } + + /** + * + * + * @generated + */ + public String getSymbol() + { + return symbol; + } + + /** + * + * + * @generated + */ + public void setSymbol(String newSymbol) + { + String oldSymbol = symbol; + symbol = newSymbol; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplePackageImpl.QUOTE__SYMBOL, oldSymbol, symbol)); + } + + /** + * + * + * @generated + */ + public String getCompanyName() + { + return companyName; + } + + /** + * + * + * @generated + */ + public void setCompanyName(String newCompanyName) + { + String oldCompanyName = companyName; + companyName = newCompanyName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplePackageImpl.QUOTE__COMPANY_NAME, oldCompanyName, companyName)); + } + + /** + * + * + * @generated + */ + public BigDecimal getPrice() + { + return price; + } + + /** + * + * + * @generated + */ + public void setPrice(BigDecimal newPrice) + { + BigDecimal oldPrice = price; + price = newPrice; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplePackageImpl.QUOTE__PRICE, oldPrice, price)); + } + + /** + * + * + * @generated + */ + public BigDecimal getOpen1() + { + return open1; + } + + /** + * + * + * @generated + */ + public void setOpen1(BigDecimal newOpen1) + { + BigDecimal oldOpen1 = open1; + open1 = newOpen1; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplePackageImpl.QUOTE__OPEN1, oldOpen1, open1)); + } + + /** + * + * + * @generated + */ + public BigDecimal getHigh() + { + return high; + } + + /** + * + * + * @generated + */ + public void setHigh(BigDecimal newHigh) + { + BigDecimal oldHigh = high; + high = newHigh; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplePackageImpl.QUOTE__HIGH, oldHigh, high)); + } + + /** + * + * + * @generated + */ + public BigDecimal getLow() + { + return low; + } + + /** + * + * + * @generated + */ + public void setLow(BigDecimal newLow) + { + BigDecimal oldLow = low; + low = newLow; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplePackageImpl.QUOTE__LOW, oldLow, low)); + } + + /** + * + * + * @generated + */ + public double getVolume() + { + return volume; + } + + /** + * + * + * @generated + */ + public void setVolume(double newVolume) + { + double oldVolume = volume; + volume = newVolume; + boolean oldVolumeESet = volumeESet; + volumeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplePackageImpl.QUOTE__VOLUME, oldVolume, volume, !oldVolumeESet)); + } + + /** + * + * + * @generated + */ + public void unsetVolume() + { + double oldVolume = volume; + boolean oldVolumeESet = volumeESet; + volume = VOLUME_EDEFAULT; + volumeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, SimplePackageImpl.QUOTE__VOLUME, oldVolume, VOLUME_EDEFAULT, oldVolumeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetVolume() + { + return volumeESet; + } + + /** + * + * + * @generated + */ + public double getChange1() + { + return change1; + } + + /** + * + * + * @generated + */ + public void setChange1(double newChange1) + { + double oldChange1 = change1; + change1 = newChange1; + boolean oldChange1ESet = change1ESet; + change1ESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SimplePackageImpl.QUOTE__CHANGE1, oldChange1, change1, !oldChange1ESet)); + } + + /** + * + * + * @generated + */ + public void unsetChange1() + { + double oldChange1 = change1; + boolean oldChange1ESet = change1ESet; + change1 = CHANGE1_EDEFAULT; + change1ESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, SimplePackageImpl.QUOTE__CHANGE1, oldChange1, CHANGE1_EDEFAULT, oldChange1ESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetChange1() + { + return change1ESet; + } + + /** + * + * + * @generated + */ + public List getQuotes() + { + if (quotes == null) + { + quotes = new EObjectContainmentEList(Quote.class, this, SimplePackageImpl.QUOTE__QUOTES); + } + return quotes; + } + + /** + * + * + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) + { + switch (featureID) + { + case SimplePackageImpl.QUOTE__QUOTES: + return ((InternalEList)getQuotes()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case SimplePackageImpl.QUOTE__SYMBOL: + return getSymbol(); + case SimplePackageImpl.QUOTE__COMPANY_NAME: + return getCompanyName(); + case SimplePackageImpl.QUOTE__PRICE: + return getPrice(); + case SimplePackageImpl.QUOTE__OPEN1: + return getOpen1(); + case SimplePackageImpl.QUOTE__HIGH: + return getHigh(); + case SimplePackageImpl.QUOTE__LOW: + return getLow(); + case SimplePackageImpl.QUOTE__VOLUME: + return new Double(getVolume()); + case SimplePackageImpl.QUOTE__CHANGE1: + return new Double(getChange1()); + case SimplePackageImpl.QUOTE__QUOTES: + return getQuotes(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case SimplePackageImpl.QUOTE__SYMBOL: + setSymbol((String)newValue); + return; + case SimplePackageImpl.QUOTE__COMPANY_NAME: + setCompanyName((String)newValue); + return; + case SimplePackageImpl.QUOTE__PRICE: + setPrice((BigDecimal)newValue); + return; + case SimplePackageImpl.QUOTE__OPEN1: + setOpen1((BigDecimal)newValue); + return; + case SimplePackageImpl.QUOTE__HIGH: + setHigh((BigDecimal)newValue); + return; + case SimplePackageImpl.QUOTE__LOW: + setLow((BigDecimal)newValue); + return; + case SimplePackageImpl.QUOTE__VOLUME: + setVolume(((Double)newValue).doubleValue()); + return; + case SimplePackageImpl.QUOTE__CHANGE1: + setChange1(((Double)newValue).doubleValue()); + return; + case SimplePackageImpl.QUOTE__QUOTES: + getQuotes().clear(); + getQuotes().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case SimplePackageImpl.QUOTE__SYMBOL: + setSymbol(SYMBOL_EDEFAULT); + return; + case SimplePackageImpl.QUOTE__COMPANY_NAME: + setCompanyName(COMPANY_NAME_EDEFAULT); + return; + case SimplePackageImpl.QUOTE__PRICE: + setPrice(PRICE_EDEFAULT); + return; + case SimplePackageImpl.QUOTE__OPEN1: + setOpen1(OPEN1_EDEFAULT); + return; + case SimplePackageImpl.QUOTE__HIGH: + setHigh(HIGH_EDEFAULT); + return; + case SimplePackageImpl.QUOTE__LOW: + setLow(LOW_EDEFAULT); + return; + case SimplePackageImpl.QUOTE__VOLUME: + unsetVolume(); + return; + case SimplePackageImpl.QUOTE__CHANGE1: + unsetChange1(); + return; + case SimplePackageImpl.QUOTE__QUOTES: + getQuotes().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case SimplePackageImpl.QUOTE__SYMBOL: + return SYMBOL_EDEFAULT == null ? symbol != null : !SYMBOL_EDEFAULT.equals(symbol); + case SimplePackageImpl.QUOTE__COMPANY_NAME: + return COMPANY_NAME_EDEFAULT == null ? companyName != null : !COMPANY_NAME_EDEFAULT.equals(companyName); + case SimplePackageImpl.QUOTE__PRICE: + return PRICE_EDEFAULT == null ? price != null : !PRICE_EDEFAULT.equals(price); + case SimplePackageImpl.QUOTE__OPEN1: + return OPEN1_EDEFAULT == null ? open1 != null : !OPEN1_EDEFAULT.equals(open1); + case SimplePackageImpl.QUOTE__HIGH: + return HIGH_EDEFAULT == null ? high != null : !HIGH_EDEFAULT.equals(high); + case SimplePackageImpl.QUOTE__LOW: + return LOW_EDEFAULT == null ? low != null : !LOW_EDEFAULT.equals(low); + case SimplePackageImpl.QUOTE__VOLUME: + return isSetVolume(); + case SimplePackageImpl.QUOTE__CHANGE1: + return isSetChange1(); + case SimplePackageImpl.QUOTE__QUOTES: + return quotes != null && !quotes.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (symbol: "); + result.append(symbol); + result.append(", companyName: "); + result.append(companyName); + result.append(", price: "); + result.append(price); + result.append(", open1: "); + result.append(open1); + result.append(", high: "); + result.append(high); + result.append(", low: "); + result.append(low); + result.append(", volume: "); + if (volumeESet) result.append(volume); else result.append(""); + result.append(", change1: "); + if (change1ESet) result.append(change1); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //QuoteImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/SimpleFactoryImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/SimpleFactoryImpl.java new file mode 100644 index 0000000000..06b0e3891e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/SimpleFactoryImpl.java @@ -0,0 +1,138 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.simple.impl; + +import com.example.simple.*; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class SimpleFactoryImpl extends EFactoryImpl implements SimpleFactory +{ + /** + * The singleton instance of the factory. + * + * + * @generated + */ + public static final SimpleFactoryImpl eINSTANCE = init(); + + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static SimpleFactoryImpl init() + { + try + { + SimpleFactoryImpl theSimpleFactory = (SimpleFactoryImpl)EPackage.Registry.INSTANCE.getEFactory("http://www.example.com/simple"); + if (theSimpleFactory != null) + { + return theSimpleFactory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new SimpleFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public SimpleFactoryImpl() + { + super(); + } + + /** + * + * + * @generated + */ + public EObject create(EClass eClass) + { + switch (eClass.getClassifierID()) + { + case SimplePackageImpl.DOCUMENT_ROOT: return (EObject)createDocumentRoot(); + case SimplePackageImpl.QUOTE: return (EObject)createQuote(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public EObject createDocumentRoot() + { + EObject documentRoot = super.create(SimplePackageImpl.Literals.DOCUMENT_ROOT); + return documentRoot; + } + + /** + * + * + * @generated + */ + public Quote createQuote() + { + QuoteImpl quote = new QuoteImpl(); + return quote; + } + + /** + * + * + * @generated + */ + public SimplePackageImpl getSimplePackageImpl() + { + return (SimplePackageImpl)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + public static SimplePackageImpl getPackage() + { + return SimplePackageImpl.eINSTANCE; + } + +} //SimpleFactoryImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/SimplePackageImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/SimplePackageImpl.java new file mode 100644 index 0000000000..e8fe40c24d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/com/example/simple/impl/SimplePackageImpl.java @@ -0,0 +1,908 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.simple.impl; + +import com.example.simple.Quote; +import com.example.simple.SimpleFactory; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EFactory; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.eclipse.emf.ecore.xml.type.XMLTypePackage; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
        + *
      • each class,
      • + *
      • each feature of each class,
      • + *
      • each enum,
      • + *
      • and each data type
      • + *
      + * + * @see com.example.simple.SimpleFactory + * @generated + */ +public class SimplePackageImpl extends EPackageImpl +{ + /** + * The package name. + * + * + * @generated + */ + public static final String eNAME = "simple"; + + /** + * The package namespace URI. + * + * + * @generated + */ + public static final String eNS_URI = "http://www.example.com/simple"; + + /** + * The package namespace name. + * + * + * @generated + */ + public static final String eNS_PREFIX = "simple"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + public static final SimplePackageImpl eINSTANCE = com.example.simple.impl.SimplePackageImpl.init(); + + /** + * The meta object id for the '{@link com.example.simple.impl.DocumentRootImpl Document Root}' class. + * + * + * @see com.example.simple.impl.DocumentRootImpl + * @see com.example.simple.impl.SimplePackageImpl#getDocumentRoot() + * @generated + */ + public static final int DOCUMENT_ROOT = 0; + + /** + * The feature id for the 'Mixed' attribute list. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__MIXED = 0; + + /** + * The feature id for the 'XMLNS Prefix Map' map. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__XMLNS_PREFIX_MAP = 1; + + /** + * The feature id for the 'XSI Schema Location' map. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = 2; + + /** + * The feature id for the 'Stock Quote' containment reference. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT__STOCK_QUOTE = 3; + + /** + * The number of structural features of the 'Document Root' class. + * + * + * @generated + * @ordered + */ + public static final int DOCUMENT_ROOT_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link com.example.simple.impl.QuoteImpl Quote}' class. + * + * + * @see com.example.simple.impl.QuoteImpl + * @see com.example.simple.impl.SimplePackageImpl#getQuote() + * @generated + */ + public static final int QUOTE = 1; + + /** + * The feature id for the 'Symbol' attribute. + * + * + * @generated + * @ordered + */ + public static final int QUOTE__SYMBOL = 0; + + /** + * The feature id for the 'Company Name' attribute. + * + * + * @generated + * @ordered + */ + public static final int QUOTE__COMPANY_NAME = 1; + + /** + * The feature id for the 'Price' attribute. + * + * + * @generated + * @ordered + */ + public static final int QUOTE__PRICE = 2; + + /** + * The feature id for the 'Open1' attribute. + * + * + * @generated + * @ordered + */ + public static final int QUOTE__OPEN1 = 3; + + /** + * The feature id for the 'High' attribute. + * + * + * @generated + * @ordered + */ + public static final int QUOTE__HIGH = 4; + + /** + * The feature id for the 'Low' attribute. + * + * + * @generated + * @ordered + */ + public static final int QUOTE__LOW = 5; + + /** + * The feature id for the 'Volume' attribute. + * + * + * @generated + * @ordered + */ + public static final int QUOTE__VOLUME = 6; + + /** + * The feature id for the 'Change1' attribute. + * + * + * @generated + * @ordered + */ + public static final int QUOTE__CHANGE1 = 7; + + /** + * The feature id for the 'Quotes' containment reference list. + * + * + * @generated + * @ordered + */ + public static final int QUOTE__QUOTES = 8; + + /** + * The number of structural features of the 'Quote' class. + * + * + * @generated + * @ordered + */ + public static final int QUOTE_FEATURE_COUNT = 9; + + /** + * + * + * @generated + */ + private EClass documentRootEClass = null; + + /** + * + * + * @generated + */ + private EClass quoteEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

      Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see com.example.simple.impl.SimplePackageImpl#eNS_URI + * @see #init() + * @generated + */ + private SimplePackageImpl() + { + super(eNS_URI, ((EFactory)SimpleFactory.INSTANCE)); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + *

      Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + *

      Invocation of this method will not affect any packages that have + * already been initialized. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static SimplePackageImpl init() + { + if (isInited) return (SimplePackageImpl)EPackage.Registry.INSTANCE.getEPackage(SimplePackageImpl.eNS_URI); + + // Obtain or create and register package + SimplePackageImpl theSimplePackageImpl = (SimplePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof SimplePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new SimplePackageImpl()); + + isInited = true; + + // Initialize simple dependencies + XMLTypePackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theSimplePackageImpl.createPackageContents(); + + // Initialize created meta-data + theSimplePackageImpl.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theSimplePackageImpl.freeze(); + + return theSimplePackageImpl; + } + + + /** + * Returns the meta object for class '{@link org.eclipse.emf.ecore.EObject Document Root}'. + * + * + * @return the meta object for class 'Document Root'. + * @see org.eclipse.emf.ecore.EObject + * @generated + */ + public EClass getDocumentRoot() + { + return documentRootEClass; + } + + /** + * Returns the meta object for the attribute list '{@link org.eclipse.emf.ecore.EObject#getMixed Mixed}'. + * + * + * @return the meta object for the attribute list 'Mixed'. + * @see org.eclipse.emf.ecore.EObject#getMixed() + * @see #getDocumentRoot() + * @generated + */ + public EAttribute getDocumentRoot_Mixed() + { + return (EAttribute)documentRootEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap XMLNS Prefix Map}'. + * + * + * @return the meta object for the map 'XMLNS Prefix Map'. + * @see org.eclipse.emf.ecore.EObject#getXMLNSPrefixMap() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_XMLNSPrefixMap() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the map '{@link org.eclipse.emf.ecore.EObject#getXSISchemaLocation XSI Schema Location}'. + * + * + * @return the meta object for the map 'XSI Schema Location'. + * @see org.eclipse.emf.ecore.EObject#getXSISchemaLocation() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_XSISchemaLocation() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the containment reference '{@link org.eclipse.emf.ecore.EObject#getStockQuote Stock Quote}'. + * + * + * @return the meta object for the containment reference 'Stock Quote'. + * @see org.eclipse.emf.ecore.EObject#getStockQuote() + * @see #getDocumentRoot() + * @generated + */ + public EReference getDocumentRoot_StockQuote() + { + return (EReference)documentRootEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for class '{@link com.example.simple.Quote Quote}'. + * + * + * @return the meta object for class 'Quote'. + * @see com.example.simple.Quote + * @generated + */ + public EClass getQuote() + { + return quoteEClass; + } + + /** + * Returns the meta object for the attribute '{@link com.example.simple.Quote#getSymbol Symbol}'. + * + * + * @return the meta object for the attribute 'Symbol'. + * @see com.example.simple.Quote#getSymbol() + * @see #getQuote() + * @generated + */ + public EAttribute getQuote_Symbol() + { + return (EAttribute)quoteEClass.getEStructuralFeatures().get(0); + } + + /** + * Returns the meta object for the attribute '{@link com.example.simple.Quote#getCompanyName Company Name}'. + * + * + * @return the meta object for the attribute 'Company Name'. + * @see com.example.simple.Quote#getCompanyName() + * @see #getQuote() + * @generated + */ + public EAttribute getQuote_CompanyName() + { + return (EAttribute)quoteEClass.getEStructuralFeatures().get(1); + } + + /** + * Returns the meta object for the attribute '{@link com.example.simple.Quote#getPrice Price}'. + * + * + * @return the meta object for the attribute 'Price'. + * @see com.example.simple.Quote#getPrice() + * @see #getQuote() + * @generated + */ + public EAttribute getQuote_Price() + { + return (EAttribute)quoteEClass.getEStructuralFeatures().get(2); + } + + /** + * Returns the meta object for the attribute '{@link com.example.simple.Quote#getOpen1 Open1}'. + * + * + * @return the meta object for the attribute 'Open1'. + * @see com.example.simple.Quote#getOpen1() + * @see #getQuote() + * @generated + */ + public EAttribute getQuote_Open1() + { + return (EAttribute)quoteEClass.getEStructuralFeatures().get(3); + } + + /** + * Returns the meta object for the attribute '{@link com.example.simple.Quote#getHigh High}'. + * + * + * @return the meta object for the attribute 'High'. + * @see com.example.simple.Quote#getHigh() + * @see #getQuote() + * @generated + */ + public EAttribute getQuote_High() + { + return (EAttribute)quoteEClass.getEStructuralFeatures().get(4); + } + + /** + * Returns the meta object for the attribute '{@link com.example.simple.Quote#getLow Low}'. + * + * + * @return the meta object for the attribute 'Low'. + * @see com.example.simple.Quote#getLow() + * @see #getQuote() + * @generated + */ + public EAttribute getQuote_Low() + { + return (EAttribute)quoteEClass.getEStructuralFeatures().get(5); + } + + /** + * Returns the meta object for the attribute '{@link com.example.simple.Quote#getVolume Volume}'. + * + * + * @return the meta object for the attribute 'Volume'. + * @see com.example.simple.Quote#getVolume() + * @see #getQuote() + * @generated + */ + public EAttribute getQuote_Volume() + { + return (EAttribute)quoteEClass.getEStructuralFeatures().get(6); + } + + /** + * Returns the meta object for the attribute '{@link com.example.simple.Quote#getChange1 Change1}'. + * + * + * @return the meta object for the attribute 'Change1'. + * @see com.example.simple.Quote#getChange1() + * @see #getQuote() + * @generated + */ + public EAttribute getQuote_Change1() + { + return (EAttribute)quoteEClass.getEStructuralFeatures().get(7); + } + + /** + * Returns the meta object for the containment reference list '{@link com.example.simple.Quote#getQuotes Quotes}'. + * + * + * @return the meta object for the containment reference list 'Quotes'. + * @see com.example.simple.Quote#getQuotes() + * @see #getQuote() + * @generated + */ + public EReference getQuote_Quotes() + { + return (EReference)quoteEClass.getEStructuralFeatures().get(8); + } + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + public SimpleFactory getSimpleFactory() + { + return (SimpleFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() + { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + documentRootEClass = createEClass(DOCUMENT_ROOT); + createEAttribute(documentRootEClass, DOCUMENT_ROOT__MIXED); + createEReference(documentRootEClass, DOCUMENT_ROOT__XMLNS_PREFIX_MAP); + createEReference(documentRootEClass, DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); + createEReference(documentRootEClass, DOCUMENT_ROOT__STOCK_QUOTE); + + quoteEClass = createEClass(QUOTE); + createEAttribute(quoteEClass, QUOTE__SYMBOL); + createEAttribute(quoteEClass, QUOTE__COMPANY_NAME); + createEAttribute(quoteEClass, QUOTE__PRICE); + createEAttribute(quoteEClass, QUOTE__OPEN1); + createEAttribute(quoteEClass, QUOTE__HIGH); + createEAttribute(quoteEClass, QUOTE__LOW); + createEAttribute(quoteEClass, QUOTE__VOLUME); + createEAttribute(quoteEClass, QUOTE__CHANGE1); + createEReference(quoteEClass, QUOTE__QUOTES); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() + { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(documentRootEClass, null, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, !IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDocumentRoot_StockQuote(), this.getQuote(), null, "stockQuote", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + + initEClass(quoteEClass, Quote.class, "Quote", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getQuote_Symbol(), theXMLTypePackage.getString(), "symbol", null, 1, 1, Quote.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getQuote_CompanyName(), theXMLTypePackage.getString(), "companyName", null, 1, 1, Quote.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getQuote_Price(), theXMLTypePackage.getDecimal(), "price", null, 1, 1, Quote.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getQuote_Open1(), theXMLTypePackage.getDecimal(), "open1", null, 1, 1, Quote.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getQuote_High(), theXMLTypePackage.getDecimal(), "high", null, 1, 1, Quote.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getQuote_Low(), theXMLTypePackage.getDecimal(), "low", null, 1, 1, Quote.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getQuote_Volume(), theXMLTypePackage.getDouble(), "volume", null, 1, 1, Quote.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getQuote_Change1(), theXMLTypePackage.getDouble(), "change1", null, 1, 1, Quote.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getQuote_Quotes(), this.getQuote(), null, "quotes", null, 0, -1, Quote.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http:///org/eclipse/emf/ecore/util/ExtendedMetaData + createExtendedMetaDataAnnotations(); + } + + /** + * Initializes the annotations for http:///org/eclipse/emf/ecore/util/ExtendedMetaData. + * + * + * @generated + */ + protected void createExtendedMetaDataAnnotations() + { + String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; + addAnnotation + (documentRootEClass, + source, + new String[] + { + "name", "", + "kind", "mixed" + }); + addAnnotation + (getDocumentRoot_Mixed(), + source, + new String[] + { + "kind", "elementWildcard", + "name", ":mixed" + }); + addAnnotation + (getDocumentRoot_XMLNSPrefixMap(), + source, + new String[] + { + "kind", "attribute", + "name", "xmlns:prefix" + }); + addAnnotation + (getDocumentRoot_XSISchemaLocation(), + source, + new String[] + { + "kind", "attribute", + "name", "xsi:schemaLocation" + }); + addAnnotation + (getDocumentRoot_StockQuote(), + source, + new String[] + { + "kind", "element", + "name", "stockQuote", + "namespace", "##targetNamespace" + }); + addAnnotation + (quoteEClass, + source, + new String[] + { + "name", "Quote", + "kind", "elementOnly" + }); + addAnnotation + (getQuote_Symbol(), + source, + new String[] + { + "kind", "element", + "name", "symbol" + }); + addAnnotation + (getQuote_CompanyName(), + source, + new String[] + { + "kind", "element", + "name", "companyName" + }); + addAnnotation + (getQuote_Price(), + source, + new String[] + { + "kind", "element", + "name", "price" + }); + addAnnotation + (getQuote_Open1(), + source, + new String[] + { + "kind", "element", + "name", "open1" + }); + addAnnotation + (getQuote_High(), + source, + new String[] + { + "kind", "element", + "name", "high" + }); + addAnnotation + (getQuote_Low(), + source, + new String[] + { + "kind", "element", + "name", "low" + }); + addAnnotation + (getQuote_Volume(), + source, + new String[] + { + "kind", "element", + "name", "volume" + }); + addAnnotation + (getQuote_Change1(), + source, + new String[] + { + "kind", "element", + "name", "change1" + }); + addAnnotation + (getQuote_Quotes(), + source, + new String[] + { + "kind", "element", + "name", "quotes" + }); + } + + /** + * + * Defines literals for the meta objects that represent + *

        + *
      • each class,
      • + *
      • each feature of each class,
      • + *
      • each enum,
      • + *
      • and each data type
      • + *
      + * + * @generated + */ + public interface Literals + { + /** + * The meta object literal for the '{@link com.example.simple.impl.DocumentRootImpl Document Root}' class. + * + * + * @see com.example.simple.impl.DocumentRootImpl + * @see com.example.simple.impl.SimplePackageImpl#getDocumentRoot() + * @generated + */ + public static final EClass DOCUMENT_ROOT = eINSTANCE.getDocumentRoot(); + + /** + * The meta object literal for the 'Mixed' attribute list feature. + * + * + * @generated + */ + public static final EAttribute DOCUMENT_ROOT__MIXED = eINSTANCE.getDocumentRoot_Mixed(); + + /** + * The meta object literal for the 'XMLNS Prefix Map' map feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__XMLNS_PREFIX_MAP = eINSTANCE.getDocumentRoot_XMLNSPrefixMap(); + + /** + * The meta object literal for the 'XSI Schema Location' map feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__XSI_SCHEMA_LOCATION = eINSTANCE.getDocumentRoot_XSISchemaLocation(); + + /** + * The meta object literal for the 'Stock Quote' containment reference feature. + * + * + * @generated + */ + public static final EReference DOCUMENT_ROOT__STOCK_QUOTE = eINSTANCE.getDocumentRoot_StockQuote(); + + /** + * The meta object literal for the '{@link com.example.simple.impl.QuoteImpl Quote}' class. + * + * + * @see com.example.simple.impl.QuoteImpl + * @see com.example.simple.impl.SimplePackageImpl#getQuote() + * @generated + */ + public static final EClass QUOTE = eINSTANCE.getQuote(); + + /** + * The meta object literal for the 'Symbol' attribute feature. + * + * + * @generated + */ + public static final EAttribute QUOTE__SYMBOL = eINSTANCE.getQuote_Symbol(); + + /** + * The meta object literal for the 'Company Name' attribute feature. + * + * + * @generated + */ + public static final EAttribute QUOTE__COMPANY_NAME = eINSTANCE.getQuote_CompanyName(); + + /** + * The meta object literal for the 'Price' attribute feature. + * + * + * @generated + */ + public static final EAttribute QUOTE__PRICE = eINSTANCE.getQuote_Price(); + + /** + * The meta object literal for the 'Open1' attribute feature. + * + * + * @generated + */ + public static final EAttribute QUOTE__OPEN1 = eINSTANCE.getQuote_Open1(); + + /** + * The meta object literal for the 'High' attribute feature. + * + * + * @generated + */ + public static final EAttribute QUOTE__HIGH = eINSTANCE.getQuote_High(); + + /** + * The meta object literal for the 'Low' attribute feature. + * + * + * @generated + */ + public static final EAttribute QUOTE__LOW = eINSTANCE.getQuote_Low(); + + /** + * The meta object literal for the 'Volume' attribute feature. + * + * + * @generated + */ + public static final EAttribute QUOTE__VOLUME = eINSTANCE.getQuote_Volume(); + + /** + * The meta object literal for the 'Change1' attribute feature. + * + * + * @generated + */ + public static final EAttribute QUOTE__CHANGE1 = eINSTANCE.getQuote_Change1(); + + /** + * The meta object literal for the 'Quotes' containment reference list feature. + * + * + * @generated + */ + public static final EReference QUOTE__QUOTES = eINSTANCE.getQuote_Quotes(); + + } + +} //SimplePackageImpl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/SimpleStaticTest.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/SimpleStaticTest.java new file mode 100644 index 0000000000..520cf707e7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/SimpleStaticTest.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + +import java.math.BigDecimal; + +import org.apache.tuscany.sdo.util.SDOUtil; + +import com.example.simple.Quote; +import com.example.simple.SimpleFactory; +import commonj.sdo.DataObject; +import commonj.sdo.helper.XMLHelper; + + +public class SimpleStaticTest +{ + /** + * Simple Static SDO 2 test. + */ + public static void main(String[] args) + { + try + { + SDOUtil.registerStaticTypes(SimpleFactory.class); + + //Quote quote = (Quote)DataFactory.INSTANCE.create(Quote.class); + Quote quote = SimpleFactory.INSTANCE.createQuote(); + + quote.setSymbol("fbnt"); + quote.setCompanyName("FlyByNightTechnology"); + quote.setPrice(new BigDecimal("1000.0")); + quote.setOpen1(new BigDecimal("1000.0")); + quote.setHigh(new BigDecimal("1000.0")); + quote.setLow(new BigDecimal("1000.0")); + quote.setVolume(1000); + quote.setChange1(1000); + + //Quote child = (Quote)((DataObject)quote).createDataObject(8); + Quote child = SimpleFactory.INSTANCE.createQuote(); + quote.getQuotes().add(child); + child.setPrice(new BigDecimal("2000.0")); + + XMLHelper.INSTANCE.save((DataObject)quote, "http://www.example.com/simple", "stockQuote", System.out); + } + catch (Exception e) + { + e.printStackTrace(); + } + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/StaticSequenceNoEmfTest.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/StaticSequenceNoEmfTest.java new file mode 100644 index 0000000000..ef6544bdb8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/StaticSequenceNoEmfTest.java @@ -0,0 +1,249 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.List; + +import junit.framework.TestCase; + +import org.apache.tuscany.sdo.util.SDOUtil; + +import com.example.sequences.MixedQuote; +import com.example.sequences.MixedRepeatingChoice; +import com.example.sequences.RepeatingChoice; +import com.example.sequences.SequencesFactory; +import com.example.sequences.TwoRCs; +import com.example.sequences.TwoRCsMixed; +import commonj.sdo.DataObject; +import commonj.sdo.Sequence; +import commonj.sdo.Type; +import commonj.sdo.helper.XMLHelper; + + +public class StaticSequenceNoEmfTest extends TestCase { + private final String TEST_NAMESPACE = "http://www.example.com/sequences"; + private final String MQ_TEST_DATA = "/mixedStaticTestResult.xml"; + private final String RC_TEST_DATA = "/repeatingChoiceTestResult.xml"; + private final String MRC_TEST_DATA = "/mixedRepeatingChoiceTestResult.xml"; + private final String RC2_TEST_DATA = "/twoRepeatingChoicesTestResult.xml"; + private final String RC2M_TEST_DATA = "/twoRepeatingChoicesMixedTestResult.xml"; + + /** + * Sequenced type SDO 2 test. + */ + public void testMixedQuoteType() throws IOException { + MixedQuote quote = SequencesFactory.INSTANCE.createMixedQuote(); + + Type t = ((DataObject)quote).getType(); + List ps = t.getProperties(); + + + Sequence sequence = quote.getMixed(); + + sequence.add("\n "); + + quote.setSymbol("fbnt"); + + sequence.add("\n "); + + quote.setCompanyName("FlyByNightTechnology"); + + sequence.add("\n some text\n "); + + List quotes = quote.getQuotes(); + MixedQuote child = SequencesFactory.INSTANCE.createMixedQuote(); + quotes.add(child); + + child.setPrice(new BigDecimal("2000.0")); + + sequence.add("\n more text\n "); + + sequence.add("price", new BigDecimal("1000.0")); + + sequence.add("\n"); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + XMLHelper.INSTANCE.save((DataObject)quote, TEST_NAMESPACE, "mixedStockQuote", baos); + assertTrue(baos.toString(), TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(MQ_TEST_DATA))); + } + + public void testRepeatingChoice() throws IOException + { + RepeatingChoice rc = SequencesFactory.INSTANCE.createRepeatingChoice(); + + List as = rc.getA(); + List bs = rc.getB(); + + bs.add(new Integer(1)); + as.add("foo"); + as.add("bar"); + bs.add(new Integer(2)); + + + + + Sequence group = rc.getGroup(); + assertEquals(group.size(), 4); + assertEquals(rc.getA().size(), 2); + assertEquals(rc.getB().size(),2); + + assertEquals(group.getValue(0), new Integer(1)); + assertEquals(group.getValue(1), "foo"); + assertEquals(group.getValue(2), "bar"); + assertEquals(group.getValue(3), new Integer(2)); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + XMLHelper.INSTANCE.save((DataObject)rc, TEST_NAMESPACE, "rc", baos); + assertTrue(baos.toString(), TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(RC_TEST_DATA))); + } + + public void testMixedRepeatingChoice() throws Exception { + MixedRepeatingChoice mrc = SequencesFactory.INSTANCE.createMixedRepeatingChoice(); + + List as = mrc.getA(); + List bs = mrc.getB(); + + + bs.add(new Integer(1)); + as.add("foo"); + Sequence mixed = mrc.getMixed(); + mixed.add("some mixed text"); + as.add("bar"); + bs.add(new Integer(2)); + + // FIXME reintroduce check + // assertEquals(4, mrc.getGroup().size()); + assertEquals(5, mrc.getMixed().size()); + assertEquals(2, mrc.getA().size()); + assertEquals(2, mrc.getB().size(),2); + + + + assertEquals(mixed.getValue(0), new Integer(1)); + assertEquals(mixed.getValue(1), "foo"); + assertEquals(mixed.getValue(3), "bar"); + assertEquals(mixed.getValue(4), new Integer(2)); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + + XMLHelper.INSTANCE.save((DataObject)mrc, TEST_NAMESPACE, "mrc", baos); + assertTrue(baos.toString(), TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(MRC_TEST_DATA))); + } + + public void test2RepeatingChoices() throws Exception { + TwoRCs rc2 = SequencesFactory.INSTANCE.createTwoRCs(); + + List as = rc2.getA(); + List bs = rc2.getB(); + List ys = rc2.getY(); + List zs = rc2.getZ(); + + zs.add(new Integer(99)); + bs.add(new Integer(1)); + ys.add("fred"); + as.add("foo"); + as.add("bar"); + bs.add(new Integer(2)); + rc2.setSplit("banana"); + + + Sequence group = rc2.getGroup(); + assertEquals(group.size(), 4); + assertEquals(rc2.getA().size(), 2); + assertEquals(rc2.getB().size(),2); + + Sequence group1 = rc2.getGroup1(); + assertEquals(group1.size(), 2); + assertEquals(rc2.getY().size(), 1); + assertEquals(rc2.getZ().size(),1); + + assertEquals(group.getValue(0), new Integer(1)); + assertEquals(group.getValue(1), "foo"); + assertEquals(group.getValue(2), "bar"); + assertEquals(group.getValue(3), new Integer(2)); + assertEquals(group1.getValue(0), new Integer(99)); + assertEquals(group1.getValue(1), "fred"); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + + XMLHelper.INSTANCE.save((DataObject)rc2, TEST_NAMESPACE, "rc2", baos); + assertTrue(baos.toString(), TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(RC2_TEST_DATA))); + } + + protected void setUp() throws Exception { + super.setUp(); + SDOUtil.registerStaticTypes(SequencesFactory.class); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + public void test2RepeatingChoicesMixed() throws Exception { + TwoRCsMixed rc2m = SequencesFactory.INSTANCE.createTwoRCsMixed(); + + List as = rc2m.getA(); + List bs = rc2m.getB(); + List ys = rc2m.getY(); + List zs = rc2m.getZ(); + Sequence mixed = rc2m.getMixed(); + + bs.add(new Integer(1)); + mixed.add("where will this appear?"); + as.add("foo"); + as.add("bar"); + bs.add(new Integer(2)); + rc2m.setSplit("pea"); + zs.add(new Integer(99)); + ys.add("fred"); + + + assertEquals(8, mixed.size()); + + Sequence group = rc2m.getGroup(); + // FIXME reintroduce test assertEquals(4, group.size()); + assertEquals(rc2m.getA().size(), 2); + assertEquals(rc2m.getB().size(),2); + + Sequence group1 = rc2m.getGroup1(); + // FIXME ditto assertEquals(group1.size(), 2); + assertEquals(rc2m.getY().size(), 1); + assertEquals(rc2m.getZ().size(),1); + + int i = 0; + assertEquals(mixed.getValue(i++), new Integer(1)); + assertEquals(mixed.getValue(i++), "where will this appear?"); + assertEquals(mixed.getValue(i++), "foo"); + assertEquals(mixed.getValue(i++), "bar"); + assertEquals(mixed.getValue(i++), new Integer(2)); + assertEquals(mixed.getValue(i++), "pea"); + assertEquals(mixed.getValue(i++), new Integer(99)); + assertEquals(mixed.getValue(i++), "fred"); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + XMLHelper.INSTANCE.save((DataObject)rc2m, TEST_NAMESPACE, "rc2m", baos); + assertTrue(baos.toString(), TestUtil.equalXmlFiles(new ByteArrayInputStream(baos.toByteArray()), getClass().getResource(RC2M_TEST_DATA))); + } + + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java new file mode 100644 index 0000000000..c5bc850e16 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/TestUtil.java @@ -0,0 +1,282 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.sdo.test; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.FactoryConfigurationError; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +public class TestUtil +{ + private static void getAllNodes(NodeList nodeList, List nodes) + { + int length = nodeList.getLength(); + if (length == 0) + { + return; + } + + for (int i=0; i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/mixedRepeatingChoiceTestResult.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/mixedRepeatingChoiceTestResult.xml new file mode 100644 index 0000000000..6564fe6112 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/mixedRepeatingChoiceTestResult.xml @@ -0,0 +1,22 @@ + + + + 1 + foo +some mixed text bar + 2 + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/mixedStaticTestResult.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/mixedStaticTestResult.xml new file mode 100644 index 0000000000..f68e456a0e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/mixedStaticTestResult.xml @@ -0,0 +1,31 @@ + + + + + fbnt + + FlyByNightTechnology + + some text + + 2000.0 + + + more text + 1000.0 + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/repeatingChoice.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/repeatingChoice.xsd new file mode 100644 index 0000000000..b7aef69735 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/repeatingChoice.xsd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/repeatingChoiceTestResult.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/repeatingChoiceTestResult.xml new file mode 100644 index 0000000000..1b2281f7d3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/repeatingChoiceTestResult.xml @@ -0,0 +1,22 @@ + + + + 1 + foo + bar + 2 + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/sequences.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/sequences.xsd new file mode 100644 index 0000000000..6e70ad528c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/sequences.xsd @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/simple.xsd b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/simple.xsd new file mode 100644 index 0000000000..37b1773859 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/simple.xsd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/twoRepeatingChoicesMixedTestResult.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/twoRepeatingChoicesMixedTestResult.xml new file mode 100644 index 0000000000..2a53982a8f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/twoRepeatingChoicesMixedTestResult.xml @@ -0,0 +1,25 @@ + + + + 1 +where will this appear? foo + bar + 2 + pea + 99 + fred + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/twoRepeatingChoicesTestResult.xml b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/twoRepeatingChoicesTestResult.xml new file mode 100644 index 0000000000..2679d973c5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/src/test/resources/twoRepeatingChoicesTestResult.xml @@ -0,0 +1,25 @@ + + + + 1 + foo + bar + 2 + banana + 99 + fred + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/Header.javajetinc b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/Header.javajetinc new file mode 100644 index 0000000000..27becf3645 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/Header.javajetinc @@ -0,0 +1,6 @@ +/** + * + * + * + * <%="$"%>Id<%="$"%> + */ diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/models/SDOClass.javajet b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/models/SDOClass.javajet new file mode 100644 index 0000000000..9acd32751b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/models/SDOClass.javajet @@ -0,0 +1,1813 @@ +<%@ jet package="org.apache.tuscany.sdo.generate.templates.model" imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="SDOClass" version="$Id: Class.javajet,v 1.41 2006/02/15 19:58:39 emerks Exp $" %> +<% +/** + * + * + * Copyright (c) 2002-2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + * + * + */ +%> +<%GenClass genClass = (GenClass)((Object[])argument)[0]; GenPackage genPackage = genClass.getGenPackage(); GenModel genModel=genPackage.getGenModel();%> +<%boolean isInterface = Boolean.TRUE.equals(((Object[])argument)[1]); boolean isImplementation = Boolean.TRUE.equals(((Object[])argument)[2]);%> +<%String publicStaticFinalFlag = isImplementation ? "public static final " : "";%> +<%@ include file="../Header.javajetinc"%> +<%if (isInterface) {%> +package <%=genPackage.getInterfacePackageName()%>; +<%} else {%> +package <%=genPackage.getClassPackageName()%>; +<%}%> + +<%genModel.markImportLocation(stringBuffer, genPackage);%> + +<%if (isInterface) {%> +/** + * + * A representation of the model object '<%=genClass.getFormattedName()%>'. + * +<%if (genClass.hasDocumentation()) {%> + * + * + * <%=genClass.getDocumentation(genModel.getIndentation(stringBuffer))%> + * +<%}%> + * +<%if (!genClass.getGenFeatures().isEmpty()) {%> + *

      + * The following features are supported: + *

        +<%for (Iterator i=genClass.getGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genFeature.isSuppressedGetVisibility()) {%> + *
      • {@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}
      • + <%}%> +<%}%> + *
      + *

      +<%}%> + * +<%if (!genModel.isSuppressEMFMetaData()) {%> + * @see <%=genPackage.getQualifiedPackageInterfaceName()%>#get<%=genClass.getClassifierAccessorName()%>() +<%}%> +<%if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genClass.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%> + * @model <%=modelInfo%> +<%} else {%> + * <%=modelInfo%> +<%}} if (first) {%> + * @model +<%}}%> +<%if (genClass.needsRootExtendsInterfaceExtendsTag()) {%> + * @extends <%=genModel.getImportedName(genModel.getRootExtendsInterface())%> +<%}%> + * @generated + */ +<%} else {%> +/** + * + * An implementation of the model object '<%=genClass.getFormattedName()%>'. + * + *

      +<%if (!genClass.getImplementedGenFeatures().isEmpty()) {%> + * The following features are implemented: + *

        +<%for (Iterator i=genClass.getImplementedGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + *
      • {@link <%=genClass.getQualifiedClassName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}
      • +<%}%> + *
      +<%}%> + *

      + * + * @generated + */ +<%}%> +<%if (isImplementation) {%> +public<%if (genClass.isAbstract()) {%> abstract<%}%> class <%=genClass.getClassName()%><%=genClass.getClassExtends()%><%=genClass.getClassImplements()%> +<%} else {%> +public interface <%=genClass.getInterfaceName()%><%=genClass.getInterfaceExtends()%> +<%}%> +{ +<%if (genModel.getCopyrightText() != null) {%> + /** + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> copyright = "<%=genModel.getCopyrightText()%>";<%=genModel.getNonNLS()%> + +<%}%> +<%if (isImplementation && genModel.getDriverNumber() != null) {%> + /** + * + * + * @generated + */ + public static final <%=genModel.getImportedName("java.lang.String")%> mofDriverNumber = "<%=genModel.getDriverNumber()%>";<%=genModel.getNonNLS()%> + +<%}%> +<%if (isImplementation && genClass.isJavaIOSerializable()) {%> + /** + * + * + * @generated + */ + private static final long serialVersionUID = 1L; + +<%}%> +<%if (isImplementation && genModel.isVirtualDelegation()) { String eVirtualValuesField = genClass.getEVirtualValuesField();%> + <%if (eVirtualValuesField != null) {%> + /** + * An array of objects representing the values of non-primitive features. + * + * + * @generated + */ + protected Object[] <%=eVirtualValuesField%> = null; + + <%}%> + <%{ List eVirtualIndexBitFields = genClass.getEVirtualIndexBitFields(new ArrayList());%> + <%if (!eVirtualIndexBitFields.isEmpty()) {%> + <%for (Iterator i = eVirtualIndexBitFields.iterator(); i.hasNext();) { String eVirtualIndexBitField = (String)i.next();%> + /** + * A bit field representing the indices of non-primitive feature values. + * + * + * @generated + */ + protected int <%=eVirtualIndexBitField%> = 0; + + <%}%> + <%}%> + <%}%> +<%}%> +<%if (isImplementation && genClass.isModelRoot() && genModel.isBooleanFlagsEnabled() && genModel.getBooleanFlagsReservedBits() == -1) {%> + /** + * A set of bit flags representing the values of boolean attributes and whether unsettable features have been set. + * + * + * @generated + * @ordered + */ + protected int <%=genModel.getBooleanFlagsField()%> = 0; + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation()) {%> + <%for (Iterator i=genClass.getDeclaredFieldGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> +<%@ include file="Class/declaredFieldGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * The feature id for the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>. + * + * + * @generated + * @ordered + */ + public final static int <%=genFeature.getUpperName()%> = <%=genClass.getFeatureValue(genFeature)%>; + + <%if (genFeature.isListType() || genFeature.isReferenceType()) {%> + <%if (genClass.isField(genFeature)) {%> + /** + * The cached value of the '{@link #<%=genFeature.getGetAccessor()%>() <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + * @ordered + */ + + // How to get BasicSequence from Sequence? + <%if (genFeature.getImportedType().equals("Sequence")){%> + protected <%=genFeature.getImportedEffectiveFeatureMapWrapperClass()%> <%=genFeature.getSafeName()%> = null; + <%}else{%> + protected <%=genModel.getImportedName(genFeature.getType())%> <%=genFeature.getSafeName()%> = null; + <%}%> + <%}%> + <%if (genModel.isArrayAccessors() && !genFeature.isFeatureMapType() && !genFeature.isMapType()) {%> + /** + * The empty value for the '{@link #<%=genFeature.getGetArrayAccessor()%>() <%=genFeature.getFormattedName()%>}' array accessor. + * + * + * @see #<%=genFeature.getGetArrayAccessor()%>() + * @generated + * @ordered + */ + protected static final <%=genFeature.getListItemType()%>[] <%=genFeature.getUpperName()%>_EEMPTY_ARRAY = new <%=genFeature.getListItemType()%> [0]; + + <%}%> + <%} else {%> + <%if (!genFeature.isVolatile() || !genModel.isReflectiveDelegation() && (!genFeature.hasDelegateFeature() || !genFeature.isUnsettable())) {%> + /** + * The default value of the '{@link #<%=genFeature.getGetAccessor()%>() <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + * @ordered + */ + protected static final <%=genFeature.getImportedType()%> <%=genFeature.getUpperName()%>_DEFAULT_ = <%=genFeature.getStaticDefaultValue()%>;<%=genModel.getNonNLS(genFeature.getStaticDefaultValue())%> + + <%}%> + <%if (genClass.isField(genFeature)) {%> + <%if (genClass.isFlag(genFeature)) {%> + <%if (genClass.getFlagIndex(genFeature) > 31 && genClass.getFlagIndex(genFeature) % 32 == 0) {%> + /** + * An additional set of bit flags representing the values of boolean attributes and whether unsettable features have been set. + * + * + * @generated + * @ordered + */ + protected int <%=genClass.getFlagsField(genFeature)%> = 0; + + <%}%> + /** + * The flag representing the value of the '{@link #<%=genFeature.getGetAccessor()%>() <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + * @ordered + */ + protected static final int <%=genFeature.getUpperName()%>_EFLAG = 1 <%="<< " + genClass.getFlagIndex(genFeature) % 32 %>; + + <%} else {%> + /** + * The cached value of the '{@link #<%=genFeature.getGetAccessor()%>() <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + * @ordered + */ + protected <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = <%=genFeature.getUpperName()%>_DEFAULT_; + + <%}%> + <%}%> + <%}%> + <%if (genClass.isESetField(genFeature)) {%> + <%if (genClass.isESetFlag(genFeature)) {%> + <%if (genClass.getESetFlagIndex(genFeature) > 31 && genClass.getESetFlagIndex(genFeature) % 32 == 0) {%> + /** + * An additional set of bit flags representing the values of boolean attributes and whether unsettable features have been set. + * + * + * @generated + * @ordered + */ + protected int <%=genClass.getESetFlagsField(genFeature)%> = 0; + + <%}%> + /** + * The flag representing whether the <%=genFeature.getFormattedName()%> <%=genFeature.getFeatureKind()%> has been set. + * + * + * @generated + * @ordered + */ + protected static final int <%=genFeature.getUpperName()%>_ESETFLAG = 1 <%="<< " + genClass.getESetFlagIndex(genFeature) % 32 %>; + + <%} else {%> + /** + * This is true if the <%=genFeature.getFormattedName()%> <%=genFeature.getFeatureKind()%> has been set. + * + * + * @generated + * @ordered + */ + protected boolean <%=genFeature.getUncapName()%>_set_ = false; + + <%}%> + <%}%> + <%}%> +<%@ include file="Class/declaredFieldGenFeature.insert.javajetinc" fail="silent" %> +<%@ end %><%//Class/declaredFieldGenFeature.override.javajetinc%> +<%}%> +<%if (isImplementation) {%> + /** + * + * + * @generated + */ + protected <%=genClass.getClassName()%>() + { + super(); + <%for (Iterator i=genClass.getFlagGenFeatures("true").iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%=genClass.getFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_EFLAG; + <%}%> + } + + /** + * + * + * @generated + */ + public <%=genModel.getImportedName("commonj.sdo.Type")%> getType() + { + return <%=genModel.getImportedName("commonj.sdo.helper.TypeHelper")%>.INSTANCE.getType(<%=genClass.getImportedInterfaceName()%>.class); //TBD Generate a more efficient implementation + } + +<%}%> +<%for (Iterator i=(isImplementation ? genClass.getImplementedGenFeatures() : genClass.getDeclaredGenFeatures()).iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> +<%@ include file="Class/genFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + <%if (genModel.isArrayAccessors() && genFeature.isListType() && !genFeature.isFeatureMapType() && !genFeature.isMapType()) {%> + /** + * + * + * @generated + */ + <%if (!isImplementation) {%> + <%=genFeature.getListItemType()%>[] <%=genFeature.getGetArrayAccessor()%>(); + + <%} else {%> + public <%=genFeature.getListItemType()%>[] <%=genFeature.getGetArrayAccessor()%>() + { + <%if (genFeature.isVolatile()) {%> + <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")%> list = (<%=genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")%>)<%=genFeature.getGetAccessor()%>(); + if (list.isEmpty()) return <%=genFeature.getUpperName()%>_EEMPTY_ARRAY; + <%} else {%> + if (<%=genFeature.getSafeName()%> == null || <%=genFeature.getSafeName()%>.isEmpty()) return <%=genFeature.getUpperName()%>_EEMPTY_ARRAY; + <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")%> list = (<%=genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")%>)<%=genFeature.getSafeName()%>; + <%}%> + list.shrink(); + return (<%=genFeature.getListItemType()%>[])list.data(); + } + + <%}%> + /** + * + * + * @generated + */ + <%if (!isImplementation) {%> + <%=genFeature.getListItemType()%> get<%=genFeature.getAccessorName()%>(int index); + + <%} else {%> + public <%=genFeature.getListItemType()%> get<%=genFeature.getAccessorName()%>(int index) + { + return (<%=genFeature.getListItemType()%>)<%=genFeature.getGetAccessor()%>().get(index); + } + + <%}%> + /** + * + * + * @generated + */ + <%if (!isImplementation) {%> + int get<%=genFeature.getAccessorName()%>Length(); + + <%} else {%> + public int get<%=genFeature.getAccessorName()%>Length() + { + <%if (genFeature.isVolatile()) {%> + return <%=genFeature.getGetAccessor()%>().size(); + <%} else {%> + return <%=genFeature.getSafeName()%> == null ? 0 : <%=genFeature.getSafeName()%>.size(); + <%}%> + } + + <%}%> + /** + * + * + * @generated + */ + <%if (!isImplementation) {%> + void set<%=genFeature.getAccessorName()%>(<%=genFeature.getListItemType()%>[] new<%=genFeature.getCapName()%>); + + <%} else {%> + public void set<%=genFeature.getAccessorName()%>(<%=genFeature.getListItemType()%>[] new<%=genFeature.getCapName()%>) + { + ((<%=genModel.getImportedName("org.eclipse.emf.common.util.BasicEList")%>)<%=genFeature.getGetAccessor()%>()).setData(new<%=genFeature.getCapName()%>.length, new<%=genFeature.getCapName()%>); + } + + <%}%> + /** + * + * + * @generated + */ + <%if (!isImplementation) {%> + void set<%=genFeature.getAccessorName()%>(int index, <%=genFeature.getListItemType()%> element); + + <%} else {%> + public void set<%=genFeature.getAccessorName()%>(int index, <%=genFeature.getListItemType()%> element) + { + <%=genFeature.getGetAccessor()%>().set(index, element); + } + + <%}%> + <%}%> + <%if (genFeature.isGet() && (isImplementation || !genFeature.isSuppressedGetVisibility())) {%> +<%@ include file="Class/getGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * Returns the value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>. + <%if (genFeature.isListType()) {%> + <%if (genFeature.isMapType()) { GenFeature keyFeature = genFeature.getMapEntryTypeGenClass().getMapEntryKeyFeature(); GenFeature valueFeature = genFeature.getMapEntryTypeGenClass().getMapEntryValueFeature(); %> + * The key is of type <%if (keyFeature.isListType()) {%>list of {@link <%=keyFeature.getQualifiedListItemType()%>}<%} else {%>{@link <%=keyFeature.getType()%>}<%}%>, + * and the value is of type <%if (valueFeature.isListType()) {%>list of {@link <%=valueFeature.getQualifiedListItemType()%>}<%} else {%>{@link <%=valueFeature.getType()%>}<%}%>, + <%} else if (!genFeature.isWrappedFeatureMapType() && !(genModel.isSuppressEMFMetaData() && "org.eclipse.emf.ecore.EObject".equals(genFeature.getQualifiedListItemType()))) {%> + * The list contents are of type {@link <%=genFeature.getQualifiedListItemType()%>}. + <%}%> + <%} else if (genFeature.isSetDefaultValue()) {%> + * The default value is <%=genFeature.getDefaultValue()%>. + <%}%> + <%if (genFeature.getTypeGenEnum() != null) {%> + * The literals are from the enumeration {@link <%=genFeature.getTypeGenEnum().getQualifiedName()%>}. + <%}%> + <%if (genFeature.isBidirectional() && !genFeature.getReverse().getGenClass().isMapEntry()) { GenFeature reverseGenFeature = genFeature.getReverse(); %> + <%if (!reverseGenFeature.isSuppressedGetVisibility()) {%> + * It is bidirectional and its opposite is '{@link <%=reverseGenFeature.getGenClass().getQualifiedInterfaceName()%>#<%=reverseGenFeature.getGetAccessor()%> <%=reverseGenFeature.getFormattedName()%>}'. + <%}%> + <%}%> + * + <%if (!genFeature.hasDocumentation()) {%> + *

      + * If the meaning of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> isn't clear, + * there really should be more of a description here... + *

      + <%}%> + * + <%if (genFeature.hasDocumentation()) {%> + * + * <%=genFeature.getDocumentation(genModel.getIndentation(stringBuffer))%> + * + <%}%> + * @return the value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>. + <%if (genFeature.getTypeGenEnum() != null) {%> + * @see <%=genFeature.getTypeGenEnum().getQualifiedName()%> + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (!genFeature.isSuppressedIsSetVisibility()) {%> + * @see #isSet<%=genFeature.getAccessorName()%>() + <%}%> + <%if (genFeature.isChangeable() && !genFeature.isSuppressedUnsetVisibility()) {%> + * @see #unset<%=genFeature.getAccessorName()%>() + <%}%> + <%}%> + <%if (genFeature.isChangeable() && !genFeature.isListType() && !genFeature.isSuppressedSetVisibility()) {%> + * @see #set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%>) + <%}%> + <%if (!genModel.isSuppressEMFMetaData()) {%> + * @see <%=genPackage.getQualifiedPackageInterfaceName()%>#get<%=genFeature.getFeatureAccessorName()%>() + <%}%> + <%if (genFeature.isBidirectional() && !genFeature.getReverse().getGenClass().isMapEntry()) { GenFeature reverseGenFeature = genFeature.getReverse(); %> + <%if (!reverseGenFeature.isSuppressedGetVisibility()) {%> + * @see <%=reverseGenFeature.getGenClass().getQualifiedInterfaceName()%>#<%=reverseGenFeature.getGetAccessor()%> + <%}%> + <%}%> + <%if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genFeature.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%> + * @model <%=modelInfo%> + <%} else {%> + * <%=modelInfo%> + <%}} if (first) {%> + * @model + <%}}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getGetAccessor()%>(); + +<%} else {%> + public <%=genFeature.getImportedType()%> <%=genFeature.getGetAccessor()%>() + { +<%@ include file="Class/getGenFeature.pre.insert.javajetinc" fail="silent" %> + <%if (genModel.isReflectiveDelegation()) {%> + return <%if (genFeature.isPrimitiveType()) {%>(<%}%>(<%=genFeature.getObjectType()%>)get(<%=genFeature.getQualifiedFeatureAccessor()%>, true)<%if (genFeature.isPrimitiveType()) {%>).<%=genFeature.getPrimitiveValueFunction()%>()<%}%>; + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isListType()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (<%=genFeature.getSafeName()%> == null) + { + <%if (genModel.isVirtualDelegation()) {%> + eVirtualSet(<%=genFeature.getUpperName()%>, <%=genFeature.getSafeName()%> = new <%=genClass.getListConstructor(genFeature)%>); + <%} else { + if (genFeature.getImportedType().equals("Sequence")){%> + <%=genFeature.getSafeName()%> = createSequence(<%=genFeature.getUpperName()%>); + <%} else {%> + <%=genFeature.getSafeName()%> = createPropertyList(ListKind.CONTAINMENT, <%=genClass.getName()%>.class, <%=genFeature.getUpperName()%>); + <%}%> + <%}%> + } + return <%=genFeature.getSafeName()%><%=genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes() ? ".map()" : ""%>; + <%} else if (genFeature.isContainer()) {%> + if (eContainerFeatureID != <%=genFeature.getUpperName()%>) return null; + return (<%=genFeature.getImportedType()%>)eContainer(); + <%} else {%> + <%if (genFeature.isResolveProxies()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%><%if (!genFeature.isReferenceType()) {%>, <%=genFeature.getUpperName()%>_DEFAULT_<%}%>); + <%}%> + if (<%=genFeature.getSafeName()%> != null && <%=genFeature.getSafeNameAsEObject()%>.isProxy()) + { + <%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%> old<%=genFeature.getCapName()%> = (<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>; + <%=genFeature.getSafeName()%> = <%=genFeature.getNonEObjectInternalTypeCast()%>eResolveProxy(old<%=genFeature.getCapName()%>); + if (<%=genFeature.getSafeName()%> != old<%=genFeature.getCapName()%>) + { + <%if (genFeature.isEffectiveContains()) {%> + <%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%> new<%=genFeature.getCapName()%> = (<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>; + <%if (!genFeature.isBidirectional()) {%> + ChangeContext changeContext = old<%=genFeature.getCapName()%>.inverseRemove(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, null); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + <%=genModel.getImportedName("org.eclipse.emf.common.notify.ChangeContext")%> changeContext = old<%=genFeature.getCapName()%>.inverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, null); + <%}%> + if (new<%=genFeature.getCapName()%>.eInternalContainer() == null) + { + <%if (!genFeature.isBidirectional()) {%> + changeContext = new<%=genFeature.getCapName()%>.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = new<%=genFeature.getCapName()%>.eInverseAdd(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + } + if (changeContext != null) changeContext.dispatch(); + <%} else if (genModel.isVirtualDelegation()) {%> + eVirtualSet(<%=genFeature.getUpperName()%>, <%=genFeature.getSafeName()%>); + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.RESOLVE, <%=genFeature.getUpperName()%>, old<%=genFeature.getCapName()%>, <%=genFeature.getSafeName()%>); + <%}%> + } + } + <%}%> + <%if (!genFeature.isResolveProxies() && genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + return (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%><%if (!genFeature.isReferenceType()) {%>, <%=genFeature.getUpperName()%>_DEFAULT_<%}%>); + <%} else if (genClass.isFlag(genFeature)) {%> + return (<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0; + <%} else {%> + return <%=genFeature.getSafeName()%>; + <%}%> + <%}%> + <%} else {//volatile%> + <%if (genFeature.isResolveProxies() && !genFeature.isListType()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = basicGet<%=genFeature.getAccessorName()%>(); + return <%=genFeature.getSafeName()%> != null && <%=genFeature.getSafeName()%>.isProxy() ? <%=genFeature.getNonEObjectInternalTypeCast()%>eResolveProxy((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>) : <%=genFeature.getSafeName()%>; + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature();%> + <%if (genFeature.isFeatureMapType()) {%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return create<%=genFeature.getImportedType()%>(get<%=delegateFeature.getAccessorName()%>(), getType(), <%=genFeature.getUpperName()%>); + <%} else {%> + return (<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>)((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>)get<%=delegateFeature.getAccessorName()%>()).list(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%}%> + <%} else if (genFeature.isListType()) {%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return get<%=genFeature.getImportedType()%>(get<%=delegateFeature.getAccessorName()%>(), getType(), <%=genFeature.getUpperName()%>); + + <%} else {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>)get<%=delegateFeature.getAccessorName()%>()).list(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%}%> + <%} else {%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return <%if (genFeature.isPrimitiveType()) {%>(<%}%>(<%=genFeature.getObjectType()%>)get(get<%=delegateFeature.getAccessorName()%>(), getType(), <%=genFeature.getUpperName()%>)<%if (genFeature.isPrimitiveType()) {%>).<%=genFeature.getPrimitiveValueFunction()%>()<%}%>; + <%} else {%> + return <%if (genFeature.isPrimitiveType()) {%>(<%}%>(<%=genFeature.getObjectType()%>)get(get<%=delegateFeature.getAccessorName()%>(), getType(), <%=genFeature.getUpperName()%>);<%if (genFeature.isPrimitiveType()) {%>).<%=genFeature.getPrimitiveValueFunction()%>()<%}%>; + <%}%> + <%}%> + <%} else {%> +<%@ include file="Class/getGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to return the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/getGenFeature.todo.override.javajetinc%> + <%}%> + <%}%> + } + +<%}%> +<%@ end %><%//Class/getGenFeature.override.javajetinc%> + <%}%> + <%if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicGet()) {%> +<%@ include file="Class/basicGetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public <%=genFeature.getImportedType()%> basicGet<%=genFeature.getAccessorName()%>() + { +<%@ include file="Class/basicGetGenFeature.pre.insert.javajetinc" fail="silent" %> + <%if (genFeature.isContainer()) {%> + if (eContainerFeatureID != <%=genFeature.getUpperName()%>) return null; + return (<%=genFeature.getImportedType()%>)eInternalContainer(); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genModel.isVirtualDelegation()) {%> + return (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%} else {%> + return <%=genFeature.getSafeName()%>; + <%}%> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature();%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return (<%=genFeature.getImportedType()%>)get(get<%=delegateFeature.getAccessorName()%>(), getType(), <%=genFeature.getUpperName()%>); + <%} else {%> + return (<%=genFeature.getImportedType()%>)get<%=delegateFeature.getAccessorName()%>().get(<%=genFeature.getQualifiedFeatureAccessor()%>, false); + <%}%> + <%} else {%> +<%@ include file="Class/basicGetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to return the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // -> do not perform proxy resolution + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/basicGetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%@ end %><%//Class/basicGetGenFeature.override.javajetinc%> + <%}%> + <%if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicSet()) {%> +<%@ include file="Class/basicSetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public ChangeContext basicSet<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedInternalType()%> new<%=genFeature.getCapName()%>, ChangeContext changeContext) + { + <%if (!genFeature.isVolatile()) {%> +<%@ include file="Class/basicSetGenFeature.pre.insert.javajetinc" fail="silent" %> + <%if (genModel.isVirtualDelegation()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualSet(<%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>); + <%} else {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%=genFeature.getSafeName()%> = new<%=genFeature.getCapName()%>; + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (genModel.isVirtualDelegation()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%=genClass.getESetFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%=genFeature.getUncapName()%>_set_ = true; + <%}%> + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + { + <%if (genFeature.isUnsettable()) {%> + <%=genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")%> notification = new <%=genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")%>(this, <%=genModel.getImportedName("org.eclipse.emf.common.notify.Notification")%>.SET, <%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange ? null : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, new<%=genFeature.getCapName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange<%} else {%>!old<%=genFeature.getCapName()%>_set_<%}%>); + <%} else {%> + <%=genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")%> notification = new <%=genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")%>(this, <%=genModel.getImportedName("org.eclipse.emf.common.notify.Notification")%>.SET, <%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE ? null : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, new<%=genFeature.getCapName()%>); + <%}%> + if (changeContext == null) changeContext = notification; else changeContext.add(notification); + } + <%}%> +<%@ include file="Class/basicSetGenFeature.post.insert.javajetinc" fail="silent" %> + return changeContext; + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature();%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal.Wrapper)get<%=delegateFeature.getAccessorName()%>()).featureMap()).basicAdd(<%=genFeature.getQualifiedFeatureAccessor()%>, new<%=genFeature.getCapName()%>, changeContext); + <%} else {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)get<%=delegateFeature.getAccessorName()%>()).basicAdd(<%=genFeature.getQualifiedFeatureAccessor()%>, new<%=genFeature.getCapName()%>, changeContext); + <%}%> + <%} else {%> +<%@ include file="Class/basicSetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to set the contained '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // -> this method is automatically invoked to keep the containment relationship in synch + // -> do not modify other features + // -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first) + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/basicSetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%@ end %><%//Class/basicSetGenFeature.override.javajetinc%> + <%}%> + <%if (genFeature.isSet() && (isImplementation || !genFeature.isSuppressedSetVisibility())) {%> +<%@ include file="Class/setGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) { %> + /** + * Sets the value of the '{@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + * @param value the new value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>. + <%if (genFeature.isEnumType()) {%> + * @see <%=genFeature.getTypeGenEnum().getQualifiedName()%> + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (!genFeature.isSuppressedIsSetVisibility()) {%> + * @see #isSet<%=genFeature.getAccessorName()%>() + <%}%> + <%if (!genFeature.isSuppressedUnsetVisibility()) {%> + * @see #unset<%=genFeature.getAccessorName()%>() + <%}%> + <%}%> + * @see #<%=genFeature.getGetAccessor()%>() + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) { %> + void set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%> value); + +<%} else {%> + public void set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%> new<%=genFeature.getCapName()%>) + { +<%@ include file="Class/setGenFeature.pre.insert.javajetinc" fail="alternative" %> + <%if (genModel.isReflectiveDelegation()) {%> + _set_(<%=genFeature.getQualifiedFeatureAccessor()%>, <%if (genFeature.isPrimitiveType()) {%>new <%=genFeature.getObjectType()%>(<%}%>new<%=genFeature.getCapName()%><%if (genFeature.isPrimitiveType()) {%>)<%}%>); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isContainer()) { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + if (new<%=genFeature.getCapName()%> != eInternalContainer() || (eContainerFeatureID != <%=genFeature.getUpperName()%> && new<%=genFeature.getCapName()%> != null)) + { + if (<%=genModel.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil")%>.isAncestor(this, <%=genFeature.getEObjectCast()%>new<%=genFeature.getCapName()%>)) + throw new <%=genModel.getImportedName("java.lang.IllegalArgumentException")%>("Recursive containment not allowed for " + toString());<%=genModel.getNonNLS()%> + ChangeContext changeContext = null; + if (eInternalContainer() != null) + changeContext = eBasicRemoveFromContainer(changeContext); + if (new<%=genFeature.getCapName()%> != null) + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)new<%=genFeature.getCapName()%>).eInverseAdd(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + changeContext = eBasicSetContainer((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)new<%=genFeature.getCapName()%>, <%=genFeature.getUpperName()%>, changeContext); + if (changeContext != null) changeContext.dispatch(); + } + <%if (!genModel.isSuppressNotification()) {%> + else if (isNotifying()) + notify(ChangeKind.SET, <%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, new<%=genFeature.getCapName()%>); + <%}%> + <%} else if (genFeature.isBidirectional() || genFeature.isEffectiveContains()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (new<%=genFeature.getCapName()%> != <%=genFeature.getSafeName()%>) + { + ChangeContext changeContext = null; + if (<%=genFeature.getSafeName()%> != null) + <%if (!genFeature.isBidirectional()) {%> + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>).inverseRemove(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, changeContext); + if (new<%=genFeature.getCapName()%> != null) + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)new<%=genFeature.getCapName()%>).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>).inverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + if (new<%=genFeature.getCapName()%> != null) + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)new<%=genFeature.getCapName()%>).eInverseAdd(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + changeContext = basicSet<%=genFeature.getAccessorName()%>(<%=genFeature.getInternalTypeCast()%>new<%=genFeature.getCapName()%>, changeContext); + if (changeContext != null) changeContext.dispatch(); + } + <%if (genFeature.isUnsettable()) {%> + else + { + <%if (genModel.isVirtualDelegation()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = eVirtualIsSet(<%=genFeature.getUpperName()%>); + <%} else if (genClass.isESetFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%}%> + <%=genClass.getESetFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%=genFeature.getUncapName()%>_set_ = true; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.SET, <%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, new<%=genFeature.getCapName()%>, !old<%=genFeature.getCapName()%>_set_); + <%}%> + } + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + else if (isNotifying()) + notify(ChangeKind.SET, <%=genFeature.getUpperName()%>, new<%=genFeature.getCapName()%>, new<%=genFeature.getCapName()%>); + <%}%> + <%}%> + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = (<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0; + <%}%> + if (new<%=genFeature.getCapName()%>) <%=genClass.getFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_EFLAG; else <%=genClass.getFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_EFLAG; + <%} else {%> + <%if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%}%> + <%}%> + <%if (genFeature.isEnumType()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = new<%=genFeature.getCapName()%> == null ? <%=genFeature.getUpperName()%>_DEFAULT_ : new<%=genFeature.getCapName()%>; + <%} else {%> + <%=genFeature.getSafeName()%> = new<%=genFeature.getCapName()%> == null ? <%=genFeature.getUpperName()%>_DEFAULT_ : new<%=genFeature.getCapName()%>; + <%}%> + <%} else {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = <%=genFeature.getInternalTypeCast()%>new<%=genFeature.getCapName()%>; + <%} else {%> + <%=genFeature.getSafeName()%> = <%=genFeature.getInternalTypeCast()%>new<%=genFeature.getCapName()%>; + <%}%> + <%}%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualSet(<%=genFeature.getUpperName()%>, <%=genFeature.getSafeName()%>); + <%}%> + <%}%> + <%if (genFeature.isUnsettable()) {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%}%> + <%=genClass.getESetFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%=genFeature.getUncapName()%>_set_ = true; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.SET, <%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange ? <%if (genFeature.isReferenceType()) {%>null<%} else {%><%=genFeature.getUpperName()%>_DEFAULT_<%}%> : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, <%if (genClass.isFlag(genFeature)) {%>new<%=genFeature.getCapName()%><%} else {%><%=genFeature.getSafeName()%><%}%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange<%} else {%>!old<%=genFeature.getCapName()%>_set_<%}%>); + <%}%> + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.SET, <%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>old<%=genFeature.getCapName()%> == EVIRTUAL_NO_VALUE ? <%if (genFeature.isReferenceType()) {%>null<%} else {%><%=genFeature.getUpperName()%>_DEFAULT_<%}%> : old<%=genFeature.getCapName()%><%} else {%>old<%=genFeature.getCapName()%><%}%>, <%if (genClass.isFlag(genFeature)) {%>new<%=genFeature.getCapName()%><%} else {%><%=genFeature.getSafeName()%><%}%>); + <%}%> + <%}%> + <%}%> +<%@ include file="Class/setGenFeature.post.insert.javajetinc" fail="silent" %> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature();%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + set(get<%=delegateFeature.getAccessorName()%>(), getType(), <%=genFeature.getUpperName()%>, <%if (genFeature.isPrimitiveType()){%> new <%=genFeature.getObjectType()%>(<%}%>new<%=genFeature.getCapName()%><%if (genFeature.isPrimitiveType()){%>)<%}%>); + <%} else {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)get<%=delegateFeature.getAccessorName()%>()).set(<%=genFeature.getQualifiedFeatureAccessor()%>, <%if (genFeature.isPrimitiveType()) {%>new <%=genFeature.getObjectType()%>(<%}%>new<%=genFeature.getCapName()%><%if (genFeature.isPrimitiveType()){%>)<%}%>); + <%}%> + <%} else {%> +<%@ include file="Class/setGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to set the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/setGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ end %><%//Class/setGenFeature.override.javajetinc%> + <%}%> + <%if (isImplementation && !genModel.isReflectiveDelegation() && genFeature.isBasicUnset()) {%> +<%@ include file="Class/basicUnsetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public ChangeContext basicUnset<%=genFeature.getAccessorName()%>(ChangeContext changeContext) + { + <%if (!genFeature.isVolatile()) {%> + <%if (genModel.isVirtualDelegation()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualUnset(<%=genFeature.getUpperName()%>); + <%} else {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%=genFeature.getSafeName()%> = null; + <%}%> + <%if (genModel.isVirtualDelegation()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> != EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + { + <%=genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")%> notification = new <%=genModel.getImportedName("org.eclipse.emf.ecore.impl.ENotificationImpl")%>(this, <%=genModel.getImportedName("org.eclipse.emf.common.notify.Notification")%>.UNSET, <%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange ? old<%=genFeature.getCapName()%> : null<%} else {%>old<%=genFeature.getCapName()%><%}%>, null, <%if (genModel.isVirtualDelegation()) {%>isSetChange<%} else {%>old<%=genFeature.getCapName()%>_set_<%}%>); + if (changeContext == null) changeContext = notification; else changeContext.add(notification); + } + return changeContext; + <%}%> + <%} else {%> +<%@ include file="Class/basicUnsetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to unset the contained '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // -> this method is automatically invoked to keep the containment relationship in synch + // -> do not modify other features + // -> return changeContext, after adding any generated Notification to it (if it is null, a NotificationChain object must be created first) + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/basicUnsetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%@ end %><%//Class.basicUnsetGenFeature.override.javajetinc%> + <%}%> + <%if (genFeature.isUnset() && (isImplementation || !genFeature.isSuppressedUnsetVisibility())) {%> +<%@ include file="Class/unsetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * Unsets the value of the '{@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%>. + * + * + <%if (!genFeature.isSuppressedIsSetVisibility()) {%> + * @see #isSet<%=genFeature.getAccessorName()%>() + <%}%> + * @see #<%=genFeature.getGetAccessor()%>() + <%if (!genFeature.isListType() && !genFeature.isSuppressedSetVisibility()) {%> + * @see #set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%>) + <%}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + void unset<%=genFeature.getAccessorName()%>(); + +<%} else {%> + public void unset<%=genFeature.getAccessorName()%>() + { + <%if (genModel.isReflectiveDelegation()) {%> + unset(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isListType()) {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>.Unsettable)get<%=genFeature.getAccessorName()%>()).unset(); + <%} else if (genFeature.isBidirectional() || genFeature.isEffectiveContains()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (<%=genFeature.getSafeName()%> != null) + { + ChangeContext changeContext = null; + <%if (!genFeature.isBidirectional()) {%> + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>).inverseRemove(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>).inverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + changeContext = basicUnset<%=genFeature.getAccessorName()%>(changeContext); + if (changeContext != null) changeContext.dispatch(); + } + else + { + <%if (genModel.isVirtualDelegation()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = eVirtualIsSet(<%=genFeature.getUpperName()%>); + <%} else if (genClass.isESetFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%}%> + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.UNSET, <%=genFeature.getUpperName()%>, null, null, old<%=genFeature.getCapName()%>_set_); + <%}%> + } + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = (<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0; + <%}%> + <%} else if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + Object old<%=genFeature.getCapName()%> = eVirtualUnset(<%=genFeature.getUpperName()%>); + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + <%=genFeature.getImportedType()%> old<%=genFeature.getCapName()%> = <%=genFeature.getSafeName()%>; + <%}%> + <%}%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + boolean isSetChange = old<%=genFeature.getCapName()%> != EVIRTUAL_NO_VALUE; + <%} else if (genClass.isESetFlag(genFeature)) {%> + boolean old<%=genFeature.getCapName()%>_set_ = (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%} else {%> + <%if (!genModel.isSuppressNotification()) {%> + boolean old<%=genFeature.getCapName()%>_set_ = <%=genFeature.getUncapName()%>_set_; + <%}%> + <%}%> + <%if (genFeature.isReferenceType()) {%> + <%=genFeature.getSafeName()%> = null; + <%if (!genModel.isVirtualDelegation()) {%> + <%if (genClass.isESetFlag(genFeature)) {%> + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.UNSET, <%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation()) {%>isSetChange ? old<%=genFeature.getCapName()%> : null<%} else {%>old<%=genFeature.getCapName()%><%}%>, null, <%if (genModel.isVirtualDelegation()) {%>isSetChange<%} else {%>old<%=genFeature.getCapName()%>_set_<%}%>); + <%}%> + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + if (<%=genFeature.getUpperName()%>_DEFAULT_) <%=genClass.getFlagsField(genFeature)%> |= <%=genFeature.getUpperName()%>_EFLAG; else <%=genClass.getFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_EFLAG; + <%} else if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) {%> + <%=genFeature.getSafeName()%> = <%=genFeature.getUpperName()%>_DEFAULT_; + <%}%> + <%if (!genModel.isVirtualDelegation() || genFeature.isPrimitiveType()) {%> + <%if (genClass.isESetFlag(genFeature)) {%> + <%=genClass.getESetFlagsField(genFeature)%> &= ~<%=genFeature.getUpperName()%>_ESETFLAG; + <%} else {%> + <%=genFeature.getUncapName()%>_set_ = false; + <%}%> + <%}%> + <%if (!genModel.isSuppressNotification()) {%> + if (isNotifying()) + notify(ChangeKind.UNSET, <%=genFeature.getUpperName()%>, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange ? old<%=genFeature.getCapName()%> : <%=genFeature.getUpperName()%>_DEFAULT_<%} else {%>old<%=genFeature.getCapName()%><%}%>, <%=genFeature.getUpperName()%>_DEFAULT_, <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%>isSetChange<%} else {%>old<%=genFeature.getCapName()%>_set_<%}%>); + <%}%> + <%}%> + <%}%> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature();%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + unset(get<%=delegateFeature.getAccessorName()%>(), getType(), <%=genFeature.getUpperName()%>); + <%} else {%> + unset<%=genFeature.getImportedType()%>(get<%=delegateFeature.getAccessorName()%>()); + <%}%> + <%} else {%> +<%@ include file="Class/unsetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to unset the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/unsetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ end %><%//Class/unsetGenFeature.override.javajetinc%> + <%}%> + <%if (genFeature.isIsSet() && (isImplementation || !genFeature.isSuppressedIsSetVisibility())) {%> +<%@ include file="Class/isSetGenFeature.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * Returns whether the value of the '{@link <%=genClass.getQualifiedInterfaceName()%>#<%=genFeature.getGetAccessor()%> <%=genFeature.getFormattedName()%>}' <%=genFeature.getFeatureKind()%> is set. + * + * + * @return whether the value of the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> is set. + <%if (genFeature.isChangeable() && !genFeature.isSuppressedUnsetVisibility()) {%> + * @see #unset<%=genFeature.getAccessorName()%>() + <%}%> + * @see #<%=genFeature.getGetAccessor()%>() + <%if (!genFeature.isListType() && genFeature.isChangeable() && !genFeature.isSuppressedSetVisibility()) {%> + * @see #set<%=genFeature.getAccessorName()%>(<%=genFeature.getImportedType()%>) + <%}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + boolean isSet<%=genFeature.getAccessorName()%>(); + +<%} else {%> + public boolean isSet<%=genFeature.getAccessorName()%>() + { + <%if (genModel.isReflectiveDelegation()) {%> + return isSet(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%} else if (!genFeature.isVolatile()) {%> + <%if (genFeature.isListType()) {%> + <%if (genModel.isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + return <%=genFeature.getSafeName()%> != null && ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>.Unsettable)<%=genFeature.getSafeName()%>).isSet(); + <%} else {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + return eVirtualIsSet(<%=genFeature.getUpperName()%>); + <%} else if (genClass.isESetFlag(genFeature)) {%> + return (<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0; + <%} else {%> + return <%=genFeature.getUncapName()%>_set_; + <%}%> + <%}%> + <%} else if (genFeature.hasDelegateFeature()) { GenFeature delegateFeature = genFeature.getDelegateFeature();%> + <%if (delegateFeature.isWrappedFeatureMapType()) {%> + return isSet(get<%=delegateFeature.getAccessorName()%>(), getType(), <%=genFeature.getUpperName()%>); + <%} else {%> + return !((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)get<%=delegateFeature.getAccessorName()%>()).isEmpty(<%=genFeature.getQualifiedFeatureAccessor()%>); + <%}%> + <%} else {%> +<%@ include file="Class/isSetGenFeature.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method to return whether the '<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%> is set + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/isSetGenFeature.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ end %><%//Class/isSetGenFeature.override.javajetinc%> + <%}%> +<%@ include file="Class/genFeature.insert.javajetinc" fail="silent" %> +<%@ end %><%//Class/genFeature.override.javajetinc%> +<%}//for%> +<%for (Iterator i= (isImplementation ? genClass.getImplementedGenOperations() : genClass.getDeclaredGenOperations()).iterator(); i.hasNext();) { GenOperation genOperation = (GenOperation)i.next();%> +<%@ include file="Class/genOperation.override.javajetinc" fail="alternative" %> +<%@ start %> +<%if (isInterface) {%> + /** + * + * + <%if (genOperation.hasDocumentation()) {%> + * + * <%=genOperation.getDocumentation(genModel.getIndentation(stringBuffer))%> + * + <%}%> + <%if (!genModel.isSuppressEMFModelTags()) { boolean first = true; for (StringTokenizer stringTokenizer = new StringTokenizer(genOperation.getModelInfo(), "\n\r"); stringTokenizer.hasMoreTokens(); ) { String modelInfo = stringTokenizer.nextToken(); if (first) { first = false;%> + * @model <%=modelInfo%> + <%} else {%> + * <%=modelInfo%> + <%}} if (first) {%> + * @model + <%}}%> + * @generated + */ +<%} else {%> + /** + * + * + * @generated + */ +<%}%> +<%if (!isImplementation) {%> + <%=genOperation.getImportedType()%> <%=genOperation.getName()%>(<%=genOperation.getParameters()%>)<%=genOperation.getThrows()%>; + +<%} else {%> + public <%=genOperation.getImportedType()%> <%=genOperation.getName()%>(<%=genOperation.getParameters()%>)<%=genOperation.getThrows()%> + { + <%if (genOperation.hasBody()) {%> + <%=genOperation.getBody(genModel.getIndentation(stringBuffer))%> + <%} else if (genOperation.isInvariant()) {GenClass opClass = genOperation.getGenClass(); String diagnostics = ((GenParameter)genOperation.getGenParameters().get(0)).getName(); String context = ((GenParameter)genOperation.getGenParameters().get(1)).getName();%> + // TODO: implement this method + // -> specify the condition that violates the invariant + // -> verify the details of the diagnostic, including severity and message + // Ensure that you remove @generated or mark it @generated NOT + if (false) + { + if (<%=diagnostics%> != null) + { + <%=diagnostics%>.add + (new <%=genModel.getImportedName("org.eclipse.emf.common.util.BasicDiagnostic")%> + (<%=genModel.getImportedName("org.eclipse.emf.common.util.Diagnostic")%>.ERROR, + <%=opClass.getGenPackage().getImportedValidatorClassName()%>.DIAGNOSTIC_SOURCE, + <%=opClass.getGenPackage().getImportedValidatorClassName()%>.<%=opClass.getOperationID(genOperation)%>, + <%=genModel.getImportedName("org.eclipse.emf.ecore.plugin.EcorePlugin")%>.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "<%=genOperation.getName()%>", <%=genModel.getImportedName("org.eclipse.emf.ecore.util.EObjectValidator")%>.getObjectLabel(this, <%=context%>) }),<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%> + new Object [] { this })); + } + return false; + } + return true; + <%} else {%> +<%@ include file="Class/implementedGenOperation.TODO.override.javajetinc" fail="alternative" %> +<%@ start %> + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); +<%@ end %><%//Class/implementedGenOperation.todo.override.javajetinc%> + <%}%> + } + +<%}%> +<%@ include file="Class/genOperation.insert.javajetinc" fail="silent" %> +<%@ end %><%//Class/implementedGenOperation.override.javajetinc%> +<%}//for%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEInverseAddGenFeatures())) {%> + /** + * + * + * @generated + */ + public ChangeContext eInverseAdd(<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%> otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getEInverseAddGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType()) {%> + <%if (genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes()) {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>)((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap()).basicAdd(otherEnd, changeContext); + <%} else {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>)<%=genFeature.getGetAccessor()%>()).basicAdd(otherEnd, changeContext); + <%}%> + <%} else if (genFeature.isContainer()) {%> + if (eInternalContainer() != null) + changeContext = eBasicRemoveFromContainer(changeContext); + return eBasicSetContainer(otherEnd, <%=genFeature.getUpperName()%>, changeContext); + <%} else {%> + <%if (genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + <%}%> + if (<%=genFeature.getSafeName()%> != null) + <%if (genFeature.isEffectiveContains()) {%> + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>).inverseRemove(this, EOPPOSITE_FEATURE_BASE - <%=genFeature.getUpperName()%>, null, changeContext); + <%} else { GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + changeContext = ((<%=genModel.getImportedName("org.eclipse.emf.ecore.InternalEObject")%>)<%=genFeature.getSafeName()%>).inverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> + return basicSet<%=genFeature.getAccessorName()%>((<%=genFeature.getImportedType()%>)otherEnd, changeContext); + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.eInverseAdd(otherEnd, propertyIndex, changeContext); +<%} else {%> + return eDynamicInverseAdd(otherEnd, propertyIndex, changeContext); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEInverseRemoveGenFeatures())) {%> + /** + * + * + * @generated + */ + public ChangeContext inverseRemove(<%=genModel.getImportedName("java.lang.Object")%> otherEnd, int propertyIndex, ChangeContext changeContext) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getEInverseRemoveGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType()) {%> + <%if (genFeature.isMapType() && genFeature.isEffectiveSuppressEMFTypes()) {%> + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.InternalEList")%>)((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap()).basicRemove(otherEnd, changeContext); + <%} else if (genFeature.isWrappedFeatureMapType()) {%> + return removeFrom<%=genFeature.getImportedType()%>(<%=genFeature.getGetAccessor()%>(), otherEnd, changeContext); + <%} else {%> + return removeFromList(<%=genFeature.getGetAccessor()%>(), otherEnd, changeContext); + <%}%> + <%} else if (genFeature.isContainer()) {%> + return eBasicSetContainer(null, <%=genFeature.getUpperName()%>, changeContext); + <%} else if (genFeature.isUnsettable()) {%> + return basicUnset<%=genFeature.getAccessorName()%>(changeContext); + <%} else {%> + return basicSet<%=genFeature.getAccessorName()%>(null, changeContext); + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.inverseRemove(otherEnd, propertyIndex, changeContext); +<%} else {%> + return eDynamicInverseRemove(otherEnd, propertyIndex, changeContext); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getEBasicRemoveFromContainerGenFeatures())) {%> + /** + * + * + * @generated + */ + public ChangeContext eBasicRemoveFromContainerFeature(ChangeContext changeContext) + { + switch (eContainerFeatureID) + { +<%for (Iterator i=genClass.getEBasicRemoveFromContainerGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%GenFeature reverseFeature = genFeature.getReverse(); GenClass targetClass = reverseFeature.getGenClass();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + return eInternalContainer().inverseRemove(this, <%=targetClass.getQualifiedFeatureID(reverseFeature)%>, <%=targetClass.getImportedInterfaceName()%>.class, changeContext); + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.eBasicRemoveFromContainerFeature(changeContext); +<%} else {%> + return eDynamicBasicRemoveFromContainer(changeContext); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getImplementedGenFeatures().isEmpty()) {%> + /** + * + * + * @generated + */ + public Object get(int propertyIndex, boolean resolve) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isPrimitiveType()) {%> + <%if (genFeature.isBooleanType()) {%> + return <%=genFeature.getGetAccessor()%>() ? Boolean.TRUE : Boolean.FALSE; + <%} else {%> + return new <%=genFeature.getObjectType()%>(<%=genFeature.getGetAccessor()%>()); + <%}%> + <%} else if (genFeature.isResolveProxies() && !genFeature.isListType()) {%> + if (resolve) return <%=genFeature.getGetAccessor()%>(); + return basicGet<%=genFeature.getAccessorName()%>(); + <%} else if (genFeature.isMapType()) {%> + <%if (genFeature.isEffectiveSuppressEMFTypes()) {%> + if (coreType) return ((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap(); + else return <%=genFeature.getGetAccessor()%>(); + <%} else {%> + if (coreType) return <%=genFeature.getGetAccessor()%>(); + else return <%=genFeature.getGetAccessor()%>().map(); + <%}%> + <%} else if (genFeature.isWrappedFeatureMapType()) {%> + // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view + //if (coreType) + return <%=genFeature.getGetAccessor()%>(); + <%} else if (genFeature.isFeatureMapType()) {%> + if (coreType) return <%=genFeature.getGetAccessor()%>(); + return ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)<%=genFeature.getGetAccessor()%>()).getWrapper(); + <%} else {%> + return <%=genFeature.getGetAccessor()%>(); + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.get(propertyIndex, resolve); +<%} else {%> + return eDynamicGet(propertyIndex, resolve, coreType); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && genClass.implementsAny(genClass.getESetGenFeatures())) {%> + /** + * + * + * @generated + */ + public void set(int propertyIndex, Object newValue) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getESetGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType()) {%> + <%if (genFeature.isWrappedFeatureMapType()) {%> + set<%=genFeature.getImportedType()%>(<%=genFeature.getGetAccessor()%>(), newValue); + <%} else if (genFeature.isFeatureMapType()) {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Internal)<%=genFeature.getGetAccessor()%>()).set(newValue); + <%} else if (genFeature.isMapType()) {%> + <%if (genFeature.isEffectiveSuppressEMFTypes()) {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%>.Setting)((<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>.InternalMapView)<%=genFeature.getGetAccessor()%>()).eMap()).set(newValue); + <%} else {%> + ((<%=genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature")%>.Setting)<%=genFeature.getGetAccessor()%>()).set(newValue); + <%}%> + <%} else {%> + <%=genFeature.getGetAccessor()%>().clear(); + <%=genFeature.getGetAccessor()%>().addAll((<%=genModel.getImportedName("java.util.Collection")%>)newValue); + <%}%> + <%} else if (genFeature.isPrimitiveType()) {%> + set<%=genFeature.getAccessorName()%>(((<%=genFeature.getObjectType()%>)newValue).<%=genFeature.getPrimitiveValueFunction()%>()); + <%} else {%> + set<%=genFeature.getAccessorName()%>((<%=genFeature.getImportedType()%>)newValue); + <%}%> + return; + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + super.set(propertyIndex, newValue); +<%} else {%> + eDynamicSet(propertyIndex, newValue); +<%}%> + } + + /** + * + * + * @generated + */ + public void unset(int propertyIndex) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getESetGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType() && !genFeature.isUnsettable()) {%> + <%if (genFeature.isWrappedFeatureMapType()) {%> + unset<%=genFeature.getImportedType()%>(<%=genFeature.getGetAccessor()%>()); + <%} else {%> + <%=genFeature.getGetAccessor()%>().clear(); + <%}%> + <%} else if (genFeature.isUnsettable()) {%> + unset<%=genFeature.getAccessorName()%>(); + <%} else if (genFeature.isReferenceType()) {%> + set<%=genFeature.getAccessorName()%>((<%=genFeature.getImportedType()%>)null); + <%} else {%> + set<%=genFeature.getAccessorName()%>(<%=genFeature.getUpperName()%>_DEFAULT_); + <%}%> + return; + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + super.unset(propertyIndex); +<%} else {%> + eDynamicUnset(propertyIndex); +<%}%> + } + +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getImplementedGenFeatures().isEmpty()) {%> +<%@ include file="Class/eIsSet.override.javajetinc" fail="alternative" %> +<%@ start %> + /** + * + * + * @generated + */ + public boolean isSet(int propertyIndex) + { + switch (propertyIndex) + { +<%for (Iterator i=genClass.getAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (!genModel.isMinimalReflectiveMethods() || genClass.getImplementedGenFeatures().contains(genFeature)) {%> + case <%=genFeature.getUpperName()%>: + <%if (genFeature.isListType() && !genFeature.isUnsettable()) {%> + <%if (genFeature.isWrappedFeatureMapType()) {%> + <%if (genFeature.isVolatile()) {%> + return !is<%=genFeature.getImportedType()%>Empty(<%=genFeature.getGetAccessor()%>()); + <%} else {%> + // KDK - should this be !isSequenceEmpty? + return <%=genFeature.getSafeName()%> != null && !is<%=genFeature.getImportedType()%>Empty(<%=genFeature.getGetAccessor()%>()); + <%}%> + <%} else {%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getSafeName()%> != null && !<%=genFeature.getSafeName()%>.isEmpty(); + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>); + return <%=genFeature.getSafeName()%> != null && !<%=genFeature.getSafeName()%>.isEmpty(); + <%} else {%> + return !<%=genFeature.getGetAccessor()%>().isEmpty(); + <%}%> + <%}%> + <%}%> + <%} else if (genFeature.isUnsettable()) {%> + return isSet<%=genFeature.getAccessorName()%>(); + <%} else if (genFeature.isResolveProxies()) {%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getSafeName()%> != null; + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + return eVirtualGet(<%=genFeature.getUpperName()%>) != null; + <%} else {%> + return basicGet<%=genFeature.getAccessorName()%>() != null; + <%}%> + <%}%> + <%} else if (genFeature.isReferenceType()) {%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getSafeName()%> != null; + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + return eVirtualGet(<%=genFeature.getUpperName()%>) != null; + <%} else {%> + return <%=genFeature.getGetAccessor()%>() != null; + <%}%> + <%}%> + <%} else if (genFeature.isPrimitiveType() || genFeature.isEnumType()) {%> + <%if (genClass.isField(genFeature)) {%> + <%if (genClass.isFlag(genFeature)) {%> + return ((<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0) != <%=genFeature.getUpperName()%>_DEFAULT_; + <%} else {%> + return <%=genFeature.getSafeName()%> != <%=genFeature.getUpperName()%>_DEFAULT_; + <%}%> + <%} else {%> + <%if (genFeature.isEnumType() && genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + return eVirtualGet(<%=genFeature.getUpperName()%>, <%=genFeature.getUpperName()%>_DEFAULT_) != <%=genFeature.getUpperName()%>_DEFAULT_; + <%} else {%> + return <%=genFeature.getGetAccessor()%>() != <%=genFeature.getUpperName()%>_DEFAULT_; + <%}%> + <%}%> + <%} else {//datatype%> + <%if (genClass.isField(genFeature)) {%> + return <%=genFeature.getUpperName()%>_DEFAULT_ == null ? <%=genFeature.getSafeName()%> != null : !<%=genFeature.getUpperName()%>_DEFAULT_.equals(<%=genFeature.getSafeName()%>); + <%} else {%> + <%if (genFeature.isField() && genClass.getImplementingGenModel(genFeature).isVirtualDelegation()) {%> + <%=genFeature.getImportedType()%> <%=genFeature.getSafeName()%> = (<%=genFeature.getImportedType()%>)eVirtualGet(<%=genFeature.getUpperName()%>, <%=genFeature.getUpperName()%>_DEFAULT_); + return <%=genFeature.getUpperName()%>_DEFAULT_ == null ? <%=genFeature.getSafeName()%> != null : !<%=genFeature.getUpperName()%>_DEFAULT_.equals(<%=genFeature.getSafeName()%>); + <%} else {%> + return <%=genFeature.getUpperName()%>_DEFAULT_ == null ? <%=genFeature.getGetAccessor()%>() != null : !<%=genFeature.getUpperName()%>_DEFAULT_.equals(<%=genFeature.getGetAccessor()%>()); + <%}%> + <%}%> + <%}%> + <%}%> +<%}%> + } +<%if (genModel.isMinimalReflectiveMethods()) {%> + return super.isSet(propertyIndex); +<%} else {%> + return eDynamicIsSet(propertyIndex); +<%}%> + } + +<%@ end %><%//Class/eIsSet.override.javajetinc%> +<%}%> +<%if (isImplementation && !genClass.getMixinGenFeatures().isEmpty()) {%> + /** + * + * + * @generated + */ + public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) + { + <%for (Iterator m=genClass.getMixinGenClasses().iterator(); m.hasNext();) { GenClass mixinGenClass = (GenClass)m.next(); %> + if (baseClass == <%=mixinGenClass.getImportedInterfaceName()%>.class) + { + switch (derivedFeatureID) + { + <%for (Iterator f=mixinGenClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); %> + case <%=genFeature.getUpperName()%>: return <%=mixinGenClass.getQualifiedFeatureID(genFeature)%>; + <%}%> + default: return -1; + } + } + <%}%> + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * + * + * @generated + */ + public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) + { + <%for (Iterator m=genClass.getMixinGenClasses().iterator(); m.hasNext();) { GenClass mixinGenClass = (GenClass)m.next(); %> + if (baseClass == <%=mixinGenClass.getImportedInterfaceName()%>.class) + { + switch (baseFeatureID) + { + <%for (Iterator f=mixinGenClass.getGenFeatures().iterator(); f.hasNext();) { GenFeature genFeature = (GenFeature)f.next(); %> + case <%=mixinGenClass.getQualifiedFeatureID(genFeature)%>: return <%=genFeature.getUpperName()%>; + <%}%> + default: return -1; + } + } + <%}%> + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + +<%}%> +<%if (isImplementation && genModel.isVirtualDelegation()) { String eVirtualValuesField = genClass.getEVirtualValuesField();%> + <%if (eVirtualValuesField != null) {%> + /** + * + * + * @generated + */ + protected Object[] eVirtualValues() + { + return <%=eVirtualValuesField%>; + } + + /** + * + * + * @generated + */ + protected void setVirtualValues(Object[] newValues) + { + <%=eVirtualValuesField%> = newValues; + } + + <%}%> + <%{ List eVirtualIndexBitFields = genClass.getEVirtualIndexBitFields(new ArrayList());%> + <%if (!eVirtualIndexBitFields.isEmpty()) { List allEVirtualIndexBitFields = genClass.getAllEVirtualIndexBitFields(new ArrayList());%> + /** + * + * + * @generated + */ + protected int eVirtualIndexBits(int offset) + { + switch (offset) + { + <%for (int i = 0; i < allEVirtualIndexBitFields.size(); i++) {%> + case <%=i%> : + return <%=allEVirtualIndexBitFields.get(i)%>; + <%}%> + default : + throw new IndexOutOfBoundsException(); + } + } + + /** + * + * + * @generated + */ + protected void setVirtualIndexBits(int offset, int newIndexBits) + { + switch (offset) + { + <%for (int i = 0; i < allEVirtualIndexBitFields.size(); i++) {%> + case <%=i%> : + <%=allEVirtualIndexBitFields.get(i)%> = newIndexBits; + break; + <%}%> + default : + throw new IndexOutOfBoundsException(); + } + } + + <%}%> + <%}%> +<%}%> +<%if (isImplementation && !genModel.isReflectiveDelegation() && !genClass.getToStringGenFeatures().isEmpty()) {%> + /** + * + * + * @generated + */ + public String toString() + { + if (isProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + <%{ boolean first = true;%> + <%for (Iterator i=genClass.getToStringGenFeatures().iterator(); i.hasNext(); ) { GenFeature genFeature = (GenFeature)i.next();%> + <%if (first) { first = false;%> + result.append(" (<%=genFeature.getName()%>: ");<%=genModel.getNonNLS()%> + <%} else {%> + result.append(", <%=genFeature.getName()%>: ");<%=genModel.getNonNLS()%> + <%}%> + <%if (genFeature.isUnsettable() && !genFeature.isListType()) {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + if (eVirtualIsSet(<%=genFeature.getUpperName()%>)) result.append(eVirtualGet(<%=genFeature.getUpperName()%>)); else result.append("");<%=genModel.getNonNLS()%> + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + if (<%if (genClass.isESetFlag(genFeature)) {%>(<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0<%} else {%><%=genFeature.getUncapName()%>_set_<%}%>) result.append((<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0); else result.append("");<%=genModel.getNonNLS()%> + <%} else {%> + if (<%if (genClass.isESetFlag(genFeature)) {%>(<%=genClass.getESetFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_ESETFLAG) != 0<%} else {%><%=genFeature.getUncapName()%>_set_<%}%>) result.append(<%=genFeature.getSafeName()%>); else result.append("");<%=genModel.getNonNLS()%> + <%}%> + <%}%> + <%} else {%> + <%if (genModel.isVirtualDelegation() && !genFeature.isPrimitiveType()) {%> + result.append(eVirtualGet(<%=genFeature.getUpperName()%><%if (!genFeature.isListType() && !genFeature.isReferenceType()){%>, <%=genFeature.getUpperName()%>_DEFAULT_<%}%>)); + <%} else {%> + <%if (genClass.isFlag(genFeature)) {%> + result.append((<%=genClass.getFlagsField(genFeature)%> & <%=genFeature.getUpperName()%>_EFLAG) != 0); + <%} else {%> + result.append(<%=genFeature.getSafeName()%>); + <%}%> + <%}%> + <%}%> + <%}%> + <%}%> + result.append(')'); + return result.toString(); + } + +<%}%> +<%if (isImplementation && genClass.isMapEntry()) { GenFeature keyFeature = genClass.getMapEntryKeyFeature(); GenFeature valueFeature = genClass.getMapEntryValueFeature();%> + /** + * + * + * @generated + */ + protected int hash = -1; + + /** + * + * + * @generated + */ + public int getHash() + { + if (hash == -1) + { + Object theKey = getKey(); + hash = (theKey == null ? 0 : theKey.hashCode()); + } + return hash; + } + + /** + * + * + * @generated + */ + public void setHash(int hash) + { + this.hash = hash; + } + + /** + * + * + * @generated + */ + public Object getKey() + { + <%if (keyFeature.isPrimitiveType()) {%> + return new <%=keyFeature.getObjectType()%>(getTypedKey()); + <%} else {%> + return getTypedKey(); + <%}%> + } + + /** + * + * + * @generated + */ + public void setKey(Object key) + { + <%if (keyFeature.isListType()) {%> + getTypedKey().addAll((<%=genModel.getImportedName("java.util.Collection")%>)key); + <%} else if (keyFeature.isPrimitiveType()) {%> + setTypedKey(((<%=keyFeature.getObjectType()%>)key).<%=keyFeature.getPrimitiveValueFunction()%>()); + <%} else {%> + setTypedKey((<%=keyFeature.getImportedType()%>)key); + <%}%> + } + + /** + * + * + * @generated + */ + public Object getValue() + { + <%if (valueFeature.isPrimitiveType()) {%> + return new <%=valueFeature.getObjectType()%>(getTypedValue()); + <%} else {%> + return getTypedValue(); + <%}%> + } + + /** + * + * + * @generated + */ + public Object setValue(Object value) + { + Object oldValue = getValue(); + <%if (valueFeature.isListType()) {%> + getTypedValue().clear(); + getTypedValue().addAll((<%=genModel.getImportedName("java.util.Collection")%>)value); + <%} else if (valueFeature.isPrimitiveType()) {%> + setTypedValue(((<%=valueFeature.getObjectType()%>)value).<%=valueFeature.getPrimitiveValueFunction()%>()); + <%} else {%> + setTypedValue((<%=valueFeature.getImportedType()%>)value); + <%}%> + return oldValue; + } + + /** + * + * + * @generated + */ + public <%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%> getEMap() + { + <%=genModel.getImportedName("org.eclipse.emf.ecore.EObject")%> container = eContainer(); + return container == null ? null : (<%=genModel.getImportedName("org.eclipse.emf.common.util.EMap")%>)container.get(eContainmentFeature()); + } +<%}%> +<%@ include file="Class/insert.javajetinc" fail="silent" %> +} //<%=isInterface ? " " + genClass.getInterfaceName() : genClass.getClassName()%> +<%// TODO fix the space above%> +<%genModel.emitSortedImports();%> diff --git a/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/models/SDOFactoryClass.javajet b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/models/SDOFactoryClass.javajet new file mode 100644 index 0000000000..31794dae3f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/sdo/tools/templates/models/SDOFactoryClass.javajet @@ -0,0 +1,727 @@ +<%@ jet package="org.apache.tuscany.sdo.generate.templates.model" imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="SDOFactoryClass" version="$Id: SDOFactoryClass.javajet,v 1.23 2005/12/10 13:31:02 emerks Exp $" %> +<% +/** + * + * + * Copyright (c) 2002-2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + * + * + */ +%> +<%GenPackage genPackage = (GenPackage)((Object[])argument)[0]; GenModel genModel=genPackage.getGenModel();%> +<%boolean isInterface = Boolean.TRUE.equals(((Object[])argument)[1]); boolean isImplementation = Boolean.TRUE.equals(((Object[])argument)[2]);%> +<%String publicStaticFinalFlag = isImplementation ? "public static final " : "";%> +<%@ include file="../Header.javajetinc"%> +<%if (isInterface || genModel.isSuppressInterfaces()) {%> +package <%=genPackage.getReflectionPackageName()%>; +<%} else {%> +package <%=genPackage.getClassPackageName()%>; +<%}%> + +<%if (isImplementation) {%> +<%if (!genPackage.hasJavaLangConflict() && !genPackage.hasInterfaceImplConflict() && !genPackage.getClassPackageName().equals(genPackage.getInterfacePackageName())) genModel.addImport(genPackage.getInterfacePackageName() + ".*");%> +<%}%> +<%genModel.markImportLocation(stringBuffer);%> + +<%if (isInterface) {%> +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * +<%if (!genModel.isSuppressEMFMetaData()) {%> + * @see <%=genPackage.getQualifiedPackageInterfaceName()%> +<%}%> + * @generated + */ +<%} else {%> +/** + * + * An implementation of the model Factory. + * + * @generated + */ +<%}%> +<%if (isImplementation) {%> +public class <%=genPackage.getFactoryClassName()%> extends <%=genModel.getImportedName("org.apache.tuscany.sdo.impl.FactoryBase")%><%if (!genModel.isSuppressInterfaces()) {%> implements <%=genPackage.getImportedFactoryInterfaceName()%><%}%> +<%} else {%> +public interface <%=genPackage.getFactoryInterfaceName()%><%if (!genModel.isSuppressEMFMetaData()) {%> extends <%=genModel.getImportedName("org.eclipse.emf.ecore.EFactory")%><%}%> +<%}%> +{ +<%if (genModel.getCopyrightText() != null) {%> + /** + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> copyright = "<%=genModel.getCopyrightText()%>";<%=genModel.getNonNLS()%> + +<%}%> + +<%if (isInterface && genModel.isSuppressEMFMetaData()) {%> + /** + * The singleton instance of the factory. + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genPackage.getFactoryInterfaceName()%> INSTANCE = <%=genPackage.getQualifiedFactoryClassName()%>.init(); + +<%} else if (isInterface && !genModel.isSuppressInterfaces()) {%> + /** + * The singleton instance of the factory. + * + * + * @generated + */ + <%=publicStaticFinalFlag%><%=genPackage.getFactoryInterfaceName()%> eINSTANCE = <%=genPackage.getQualifiedFactoryClassName()%>.init(); + +<%}%> +<%if (isImplementation) {%> +/** + * The package namespace URI. + * + * + * @generated + */ +<%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> NAMESPACE_URI = "<%=genPackage.getNSURI()%>";<%=genModel.getNonNLS()%> + +/** + * The package namespace name. + * + * + * @generated + */ +<%=publicStaticFinalFlag%><%=genModel.getImportedName("java.lang.String")%> NAMESPACE_PREFIX = "<%=genPackage.getNSName()%>";<%=genModel.getNonNLS()%> + + + <%for (Iterator i=genPackage.getOrderedGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next();%> +<%if (!genClassifier.getClassifierID().equals("DOCUMENT_ROOT")) { %> +<%=publicStaticFinalFlag%>int <%=genPackage.getClassifierID(genClassifier)%> = <%=genPackage.getClassifierValue(genClassifier)%>; +<%} }%> + + + /** + * Creates the default factory implementation. + * + * + * @generated + */ +<%String factoryType = genModel.isSuppressEMFMetaData() ? genPackage.getFactoryClassName() : genPackage.getImportedFactoryInterfaceName();%> + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public <%=genPackage.getFactoryClassName()%>() + { + super(NAMESPACE_URI, NAMESPACE_PREFIX); + } + + /** + * + * + * @generated + */ + public <%=genModel.getImportedName("commonj.sdo.DataObject")%> create(int typeNumber) + { + switch (typeNumber) + { +<%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> +<%if (!genClass.isAbstract() && !genClass.getClassifierID().equals("DOCUMENT_ROOT")) {%> + // TODO make sure we're supposed to ingore DOCUMENT_ROOT + case <%=genClass.getClassifierID()%>: return (<%=genModel.getImportedName("commonj.sdo.DataObject")%>)create<%=genClass.getName()%>(); +<%}%> +<%}%> + default: + return super.create(typeNumber); + } + } + + +<%if (!genPackage.getAllGenDataTypes().isEmpty()) {%> + /** + * + * + * @generated + */ + public Object createFromString(<%=genModel.getImportedName("org.eclipse.emf.ecore.EDataType")%> eDataType, String initialValue) + { + switch (eDataType.getClassifierID()) + { +<%for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next();%> + <%if (genDataType.isSerializable()) {%> + case <%=genPackage.getImportedPackageInterfaceName()%>.<%=genDataType.getClassifierID()%>: + return create<%=genDataType.getName()%>FromString(eDataType, initialValue); + <%}%> +<%}%> + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%> + } + } + + /** + * + * + * @generated + */ + public String convertToString(<%=genModel.getImportedName("org.eclipse.emf.ecore.EDataType")%> eDataType, Object instanceValue) + { + switch (eDataType.getClassifierID()) + { +<%for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next();%> + <%if (genDataType.isSerializable()) {%> + case <%=genPackage.getImportedPackageInterfaceName()%>.<%=genDataType.getClassifierID()%>: + return convert<%=genDataType.getName()%>ToString(eDataType, instanceValue); + <%}%> +<%}%> + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%> + } + } + +<%}%> +<%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> + <%if (!genClass.isAbstract() && !genClass.getClassifierID().equals("DOCUMENT_ROOT")) {%> + /** + * + * + * @generated + */ + public <%=genClass.getImportedInterfaceName()%> create<%=genClass.getName()%>() + { + <%if (genClass.isDynamic()) {%> + <%=genClass.getImportedInterfaceName()%> <%=genClass.getSafeUncapName()%> = <%=genClass.getCastFromEObject()%>super.create(<%=genClass.getQualifiedClassifierAccessor()%>); + <%} else {%> + <%=genClass.getImportedClassName()%> <%=genClass.getSafeUncapName()%> = new <%=genClass.getImportedClassName()%>()<%if (genModel.isSuppressInterfaces() && !genPackage.getReflectionPackageName().equals(genPackage.getInterfacePackageName())) {%>{}<%}%>; + <%}%> + return <%=genClass.getSafeUncapName()%>; + } + + // Following creates and initializes SDO metadata for the supported types. + protected <%=genModel.getImportedName("commonj.sdo.Type")%> <%=genClass.getSafeUncapName()%>Type = null; + + public <%=genModel.getImportedName("commonj.sdo.Type")%> get<%=genClass.getName()%>() + { + // TODO - kdk - verify how to generate quoteType...<%=genClass.getSafeUncapName()%>Type? + return <%=genClass.getSafeUncapName()%>Type; + } + <%}%> +<%}%> + + private static boolean isInited = false; + + public static <%=factoryType%> init() + { + if (isInited) return (<%=factoryType%>)FactoryBase.getStaticFactory(<%=factoryType%>.NAMESPACE_URI); + <%=factoryType%> the<%=factoryType%> = new <%=factoryType%>(); + isInited = true; + + // Initialize simple dependencies + <%=genModel.getImportedName("org.apache.tuscany.sdo.util.SDOUtil")%>.registerStaticTypes(<%=genModel.getImportedName("org.apache.tuscany.sdo.impl.SDOFactoryImpl")%>.class); + <%=genModel.getImportedName("org.apache.tuscany.sdo.util.SDOUtil")%>.registerStaticTypes(<%=genModel.getImportedName("org.apache.tuscany.sdo.model.impl.ModelPackageImpl")%>.class); + + // Create package meta-data objects + the<%=factoryType%>.createMetaData(); + + // Initialize created meta-data + the<%=factoryType%>.initializeMetaData(); + + // Mark meta-data to indicate it can't be changed + //the<%=factoryType%>.freeze(); //FB do we need to freeze / should we freeze ???? + + return the<%=factoryType%>; + } + + private boolean isCreated = false; + + public void createMetaData() + { + if (isCreated) return; + isCreated = true; +<%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> + + <%if (!genClass.isAbstract() && !genClass.getClassifierID().equals("DOCUMENT_ROOT")) {%> + <%=genClass.getSafeUncapName()%>Type = createType(false, <%=genPackage.getClassifierID(genClass)%>); + <%for (Iterator j=genClass.getAllGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next();%> + createProperty(<%=!genFeature.isReferenceType()%>, <%=genClass.getSafeUncapName()%>Type, <%=genClass.getClassName()%>.<%=genFeature.getUpperName()%>); + <%}%> + <%}%> +<%}%> + } + private boolean isInitialized = false; + + public void initializeMetaData() + { + if (isInitialized) return; + isInitialized = true; + + // Obtain other dependent packages + <%=genModel.getImportedName("org.apache.tuscany.sdo.model.impl.ModelFactoryImpl")%> theModelPackageImpl = (<%=genModel.getImportedName("org.apache.tuscany.sdo.model.impl.ModelFactoryImpl")%>)FactoryBase.getStaticFactory(<%=genModel.getImportedName("org.apache.tuscany.sdo.model.impl.ModelFactoryImpl")%>.NAMESPACE_URI); + + // Add supertypes to classes + // Initialize classes and features; add operations and parameters +<%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> + <%if (!genClass.isAbstract() && !genClass.getClassifierID().equals("DOCUMENT_ROOT")) {%> + + initializeType(<%=genClass.getSafeUncapName()%>Type, <%=genClass.getImportedInterfaceName()%>.class, "<%=genClass.getName()%>");<%for (Iterator j=genClass.getAllGenFeatures().iterator(); j.hasNext();) {GenFeature genFeature = (GenFeature)j.next();%><%String type = genFeature.getImportedType().equals("Sequence") ? "getSequence()" : genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage()) + ".get" + genFeature.getTypeClassifierAccessorName() + "()";%><%if (genFeature.isReferenceType()) { GenFeature reverseGenFeature = genFeature.getReverse();%><%String reverse = reverseGenFeature == null ? "null" : genPackage.getPackageInstanceVariable(reverseGenFeature.getGenPackage()) + ".get" + reverseGenFeature.getFeatureAccessorName() + "()";%> + initializeProperty((<%=genModel.getImportedName("commonj.sdo.Property")%>)<%=genClass.getSafeUncapName()%>Type.getProperties().get(<%=genClass.getClassName()%>.<%=genFeature.getUpperName()%>), <%=type%>, "<%=genFeature.getSafeName()%>", <%=genFeature.getDefaultValue()%>, <%=genFeature.getLowerBound()%>, <%=genFeature.getUpperBound()%>, <%=genFeature.getContainerClass()%>, <%=genFeature.getChangeableFlag().equals("IS_CHANGEABLE") ? "false" : "true"%>, <%=genFeature.getUnsettableFlag().equals("IS_UNSETTABLE") ? "true": "false"%>, <%=genFeature.getDerivedFlag().equals("IS_DERIVED") ? "true" : "false"%>, <%=genFeature.getContainmentFlag().equals("IS_COMPOSITE")? "true": "false"%> , <%=reverse%>);<%}else{%> + initializeProperty((<%=genModel.getImportedName("commonj.sdo.Property")%>)<%=genClass.getSafeUncapName()%>Type.getProperties().get(<%=genClass.getClassName()%>.<%=genFeature.getUpperName()%>), <%=type%>, "<%=genFeature.getSafeName()%>", <%=genFeature.getDefaultValue()%>, <%=genFeature.getLowerBound()%>, <%=genFeature.getUpperBound()%>, <%=genFeature.getContainerClass()%>, <%=genFeature.getChangeableFlag().equals("IS_CHANGEABLE") ? "false" : "true"%>, <%=genFeature.getUnsettableFlag().equals("IS_UNSETTABLE") ? "true": "false"%>, <%=genFeature.getDerivedFlag().equals("IS_DERIVED") ? "true" : "false"%>);<%}%><%}%><%}%><%}%>createXSDMetaData(); + } + + protected void createXSDMetaData() + { + super.createXSDMetaData(); +<%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> + <%if (!genClass.isAbstract() && !genClass.getClassifierID().equals("DOCUMENT_ROOT")) {%> + // TODO - kdk - is the order right? should kind, elementOnly be first + addXSDMapping + (<%=genClass.getSafeUncapName()%>Type, + new String[] + { + "name", "<%=genClass.getName()%>", + "kind", "elementOnly" + }); +<%for (Iterator j=genClass.getAllGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next();%> + addXSDMapping + ((<%=genModel.getImportedName("commonj.sdo.Property")%>)<%=genClass.getSafeUncapName()%>Type.getProperties().get(<%=genClass.getClassName()%>.<%=genFeature.getUpperName()%>), + new String[] + { + "kind", "element", + "name", "<%=genFeature.getName()%>" + }); + <%}%> + <%}%> +<%}%> + +<%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> + <%if (!genClass.isAbstract() && genClass.getClassifierID().equals("DOCUMENT_ROOT")) {%> + // TODO - kdk - how do I filter out mixed, xMLNSPrefixMap, and xSISchemaLocation without hardcoding it + // TODO - kdk - can I hardcode ##targetNamespace? + <%for (Iterator j=genClass.getAllGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next();%> + <%if (!genFeature.getName().equals("mixed") && !genFeature.getName().equals("xMLNSPrefixMap") && !genFeature.getName().equals("xSISchemaLocation")){ %> + createGlobalProperty + ("<%=genFeature.getName()%>", + <%=genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage())%>.get<%=genFeature.getTypeClassifierAccessorName()%>(), + new String[] + { + "kind", "element", + "name", "<%=genFeature.getName()%>", + "namespace", "##targetNamespace" + }); + <%}%> + <%}%> +<%}%> +<%}%> + } + +<%for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next();%> + <%if (genDataType.isSerializable()) {%> +<%if (genPackage.isDataTypeConverters()) { String eDataType = genDataType.getQualifiedClassifierAccessor();%> + /** + * + * + * @generated + */ + public <%=genDataType.getImportedInstanceClassName()%> create<%=genDataType.getName()%>(String literal) + { + <%if (genDataType instanceof GenEnum) {%> + <%=genDataType.getImportedInstanceClassName()%> result = <%=genDataType.getImportedInstanceClassName()%>.get(literal); + if (result == null) throw new IllegalArgumentException("The value '" + literal + "' is not a valid enumerator of '" + <%=eDataType%>.getName() + "'");<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%><%=genModel.getNonNLS(3)%> + return result; + <%} else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); boolean isPrimitiveConversion = !genDataType.isPrimitiveType() && genBaseType.isPrimitiveType();%> + <%if (genBaseType.getGenPackage() == genPackage) {%> + <%if (isPrimitiveConversion) {%> + return new <%=genDataType.getObjectInstanceClassName()%>(create<%=genBaseType.getName()%>(literal)); + <%} else {%> + return create<%=genBaseType.getName()%>(literal); + <%}%> + <%} else if (genBaseType.getGenPackage().isDataTypeConverters()) {%> + <%if (isPrimitiveConversion) {%> + return new <%=genDataType.getObjectInstanceClassName()%>(<%=genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.create<%=genBaseType.getName()%>(literal)); + <%} else {%> + return <%=genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.create<%=genBaseType.getName()%>(literal); + <%}%> + <%} else {%> + return (<%=genDataType.getObjectInstanceClassName()%>)<%=genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.createFromString(<%=genBaseType.getQualifiedClassifierAccessor()%>, literal); + <%}%> + <%} else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); %> + if (literal == null) return null; + <%=genModel.getImportedName("java.util.List")%> result = new <%=genModel.getImportedName("java.util.ArrayList")%>(); + for (<%=genModel.getImportedName("java.util.StringTokenizer")%> stringTokenizer = new <%=genModel.getImportedName("java.util.StringTokenizer")%>(literal); stringTokenizer.hasMoreTokens(); ) + { + String item = stringTokenizer.nextToken(); + <%if (genItemType.getGenPackage() == genPackage) {%> + <%if (genPackage.isDataTypeConverters()) { genItemType = genItemType.getObjectType();%> + result.add(create<%=genItemType.getName()%>(item)); + <%} else {%> + result.add(create<%=genItemType.getName()%>FromString(<%=genItemType.getQualifiedClassifierAccessor()%>, item)); + <%}%> + <%} else {%> + <%if (genItemType.getGenPackage().isDataTypeConverters()) { genItemType = genItemType.getObjectType();%> + result.add(<%=genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.create<%=genItemType.getName()%>(item)); + <%} else {%> + result.add(<%=genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.createFromString(<%=genItemType.getQualifiedClassifierAccessor()%>, item)); + <%}%> + <%}%> + } + return result; + <%} else if (!genDataType.getMemberTypes().isEmpty()) {%> + if (literal == null) return <%=genDataType.getStaticValue(null)%>; + <%=genDataType.getImportedInstanceClassName()%> result = <%=genDataType.getStaticValue(null)%>; + RuntimeException exception = null; + <%for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next();%> + try + { + <%if (genMemberType.getGenPackage() == genPackage) {%> + <%if (genPackage.isDataTypeConverters()) { if (!genDataType.isPrimitiveType()) genMemberType = genMemberType.getObjectType();%> + result = create<%=genMemberType.getName()%>(literal); + <%} else {%> + result = (<%=genDataType.getObjectInstanceClassName()%>)create<%=genMemberType.getName()%>FromString(<%=genMemberType.getQualifiedClassifierAccessor()%>, literal); + <%}%> + <%} else {%> + <%if (genPackage.isDataTypeConverters()) { if (!genDataType.isPrimitiveType()) genMemberType = genMemberType.getObjectType();%> + result = <%=genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.create<%=genMemberType.getName()%>(literal); + <%} else {%> + result = (<%=genDataType.getObjectInstanceClassName()%>)<%=genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.createFromString(<%=genMemberType.getQualifiedClassifierAccessor()%>, literal); + <%}%> + <%}%> + if (<%if (!genDataType.isPrimitiveType()) {%>result != null && <%}%><%=genModel.getImportedName("org.eclipse.emf.ecore.util.Diagnostician")%>.INSTANCE.validate(<%=eDataType%>, <%if (genDataType.isPrimitiveType()) {%>new <%=genDataType.getObjectInstanceClassName()%>(result)<%} else {%>result<%}%>, null, null)) + { + return result; + } + } + catch (RuntimeException e) + { + exception = e; + } + <%}%> + if (<%if (!genDataType.isPrimitiveType()) {%>result != null || <%}%>exception == null) return result; + + throw exception; + <%} else if (genDataType.isArrayType()) {%> + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new <%=genModel.getImportedName("java.lang.UnsupportedOperationException")%>(); + <%} else if (genDataType.isPrimitiveType()) {%> + return ((<%=genDataType.getObjectInstanceClassName()%>)super.createFromString(<%=eDataType%>, literal)).<%=genDataType.getPrimitiveValueFunction()%>(); + <%} else {%> + return (<%=genDataType.getObjectInstanceClassName()%>)super.createFromString(<%=eDataType%>, literal); + <%}%> + } + +<%}%> + /** + * + * + * @generated + */ + public <%=genDataType.getObjectInstanceClassName()%> create<%=genDataType.getName()%>FromString(<%=genModel.getImportedName("org.eclipse.emf.ecore.EDataType")%> eDataType, String initialValue) + { + <%if (genDataType instanceof GenEnum) {%> + <%if (genPackage.isDataTypeConverters()) {%> + return create<%=genDataType.getName()%>(initialValue); + <%} else {%> + <%=((GenEnum)genDataType).getImportedInstanceClassName()%> result = <%=((GenEnum)genDataType).getImportedInstanceClassName()%>.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");<%=genModel.getNonNLS()%><%=genModel.getNonNLS(2)%><%=genModel.getNonNLS(3)%> + return result; + <%}%> + <%} else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); %> + <%if (genBaseType.getGenPackage() == genPackage) {%> + return (<%=genDataType.getObjectInstanceClassName()%>)create<%=genBaseType.getName()%>FromString(<%=genBaseType.getQualifiedClassifierAccessor()%>, initialValue); + <%} else {%> + return (<%=genDataType.getObjectInstanceClassName()%>)<%=genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.createFromString(<%=genBaseType.getQualifiedClassifierAccessor()%>, initialValue); + <%}%> + <%} else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); %> + <%if (genPackage.isDataTypeConverters()) {%> + return create<%=genDataType.getName()%>(initialValue); + <%} else {%> + if (initialValue == null) return null; + <%=genModel.getImportedName("java.util.List")%> result = new <%=genModel.getImportedName("java.util.ArrayList")%>(); + for (<%=genModel.getImportedName("java.util.StringTokenizer")%> stringTokenizer = new <%=genModel.getImportedName("java.util.StringTokenizer")%>(initialValue); stringTokenizer.hasMoreTokens(); ) + { + String item = stringTokenizer.nextToken(); + <%if (genItemType.getGenPackage() == genPackage) {%> + result.add(create<%=genItemType.getName()%>FromString(<%=genItemType.getQualifiedClassifierAccessor()%>, item)); + <%} else {%> + result.add(<%=genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.createFromString(<%=genItemType.getQualifiedClassifierAccessor()%>, item)); + <%}%> + } + return result; + <%}%> + <%} else if (!genDataType.getMemberTypes().isEmpty()) {%> + <%if (genPackage.isDataTypeConverters()) {%> + <%if (genDataType.isPrimitiveType()) {%> + return new <%=genDataType.getObjectInstanceClassName()%>(create<%=genDataType.getName()%>(initialValue)); + <%} else {%> + return create<%=genDataType.getName()%>(initialValue); + <%}%> + <%} else {%> + if (initialValue == null) return null; + <%=genDataType.getObjectInstanceClassName()%> result = null; + RuntimeException exception = null; + <%for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next();%> + try + { + <%if (genMemberType.getGenPackage() == genPackage) {%> + result = (<%=genDataType.getObjectInstanceClassName()%>)create<%=genMemberType.getName()%>FromString(<%=genMemberType.getQualifiedClassifierAccessor()%>, initialValue); + <%} else {%> + result = (<%=genDataType.getObjectInstanceClassName()%>)<%=genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.createFromString(<%=genMemberType.getQualifiedClassifierAccessor()%>, initialValue); + <%}%> + if (result != null && <%=genModel.getImportedName("org.eclipse.emf.ecore.util.Diagnostician")%>.INSTANCE.validate(eDataType, result, null, null)) + { + return result; + } + } + catch (RuntimeException e) + { + exception = e; + } + <%}%> + if (result != null || exception == null) return result; + + throw exception; + <%}%> + <%} else if (genDataType.isArrayType()) {%> + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new <%=genModel.getImportedName("java.lang.UnsupportedOperationException")%>(); + <%} else {%> + return (<%=genDataType.getObjectInstanceClassName()%>)super.createFromString(eDataType, initialValue); + <%}%> + } + +<%if (genPackage.isDataTypeConverters()) { String eDataType = genDataType.getQualifiedClassifierAccessor();%> + /** + * + * + * @generated + */ + public String convert<%=genDataType.getName()%>(<%=genDataType.getImportedInstanceClassName()%> instanceValue) + { + <%if (genDataType instanceof GenEnum) {%> + return instanceValue == null ? null : instanceValue.toString(); + <%} else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); boolean isPrimitiveConversion = !genDataType.isPrimitiveType() && genBaseType.isPrimitiveType();%> + <%if (genBaseType.getGenPackage() == genPackage) {%> + <%if (isPrimitiveConversion) {%> + return instanceValue == null ? null : convert<%=genBaseType.getName()%>(instanceValue.<%=genBaseType.getPrimitiveValueFunction()%>()); + <%} else {%> + return convert<%=genBaseType.getName()%>(instanceValue); + <%}%> + <%} else if (genBaseType.getGenPackage().isDataTypeConverters()) {%> + return <%=genBaseType.getGenPackage().getQualifiedFactoryInstanceAccessor()%>.convert<%=genBaseType.getName()%>(instanceValue); + <%} else {%> + return <%=genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.convertToString(<%=genBaseType.getQualifiedClassifierAccessor()%>, instanceValue); + <%}%> + <%} else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); %> + if (instanceValue == null) return null; + if (instanceValue.isEmpty()) return ""; + <%=genModel.getImportedName("java.lang.StringBuffer")%> result = new <%=genModel.getImportedName("java.lang.StringBuffer")%>(); + for (<%=genModel.getImportedName("java.util.Iterator")%> i = instanceValue.iterator(); i.hasNext(); ) + { + <%if (genItemType.getGenPackage() == genPackage) {%> + <%if (genPackage.isDataTypeConverters()) { genItemType = genItemType.getObjectType();%> + result.append(convert<%=genItemType.getName()%>((<%=genItemType.getObjectInstanceClassName()%>)i.next())); + <%} else {%> + result.append(convert<%=genItemType.getName()%>ToString(<%=genItemType.getQualifiedClassifierAccessor()%>, i.next())); + <%}%> + <%} else {%> + <%if (genItemType.getGenPackage().isDataTypeConverters()) { genItemType = genItemType.getObjectType();%> + result.append(<%=genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.convert<%=genItemType.getName()%>((<%=genItemType.getObjectInstanceClassName()%>)i.next())); + <%} else {%> + result.append(<%=genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.convertToString(<%=genItemType.getQualifiedClassifierAccessor()%>, i.next())); + <%}%> + <%}%> + result.append(' '); + } + return result.substring(0, result.length() - 1); + <%} else if (!genDataType.getMemberTypes().isEmpty()) {%> + <%if (!genDataType.isPrimitiveType()) {%> + if (instanceValue == null) return null; + <%for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next();%> + if (<%=genMemberType.getQualifiedClassifierAccessor()%>.isInstance(instanceValue)) + { + try + { + <%if (genMemberType.getGenPackage() == genPackage) {%> + <%if (genPackage.isDataTypeConverters()) {%> + String value = convert<%=genMemberType.getName()%>(instanceValue); + <%} else {%> + String value = convert<%=genMemberType.getName()%>ToString(<%=genMemberType.getQualifiedClassifierAccessor()%>, instanceValue); + <%}%> + <%} else {%> + <%if (genMemberType.getGenPackage().isDataTypeConverters()) { genMemberType = genMemberType.getObjectType();%> + String value = <%=genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.convert<%=genMemberType.getName()%>((<%=genMemberType.getObjectInstanceClassName()%>)instanceValue); + <%} else {%> + String value = <%=genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.convertToString(<%=genMemberType.getQualifiedClassifierAccessor()%>, instanceValue); + <%}%> + <%}%> + if (value != null) return value; + } + catch (Exception e) + { + } + } + <%}%> + <%} else {%> + <%for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next();%> + try + { + <%if (genMemberType.getGenPackage() == genPackage) {%> + <%if (genPackage.isDataTypeConverters()) {%> + String value = convert<%=genMemberType.getName()%>(instanceValue); + <%} else {%> + String value = convert<%=genMemberType.getName()%>ToString(<%=genMemberType.getQualifiedClassifierAccessor()%>, new <%=genMemberType.getObjectInstanceClassName()%>(instanceValue)); + <%}%> + <%} else {%> + <%if (genMemberType.getGenPackage().isDataTypeConverters()) {%> + String value = <%=genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.convert<%=genMemberType.getName()%>(instanceValue); + <%} else {%> + String value = <%=genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.convertToString(<%=genMemberType.getQualifiedClassifierAccessor()%>, new <%=genMemberType.getObjectInstanceClassName()%>(instanceValue)); + <%}%> + <%}%> + if (value != null) return value; + } + catch (Exception e) + { + } + <%}%> + <%}%> + throw new IllegalArgumentException("Invalid value: '"+instanceValue+"' for datatype :"+<%=eDataType%>.getName()); + <%} else if (genDataType.isArrayType()) {%> + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new <%=genModel.getImportedName("java.lang.UnsupportedOperationException")%>(); + <%} else if (genDataType.isPrimitiveType()) {%> + return super.convertToString(<%=eDataType%>, new <%=genDataType.getObjectInstanceClassName()%>(instanceValue)); + <%} else {%> + return super.convertToString(<%=eDataType%>, instanceValue); + <%}%> + } + +<%}%> + /** + * + * + * @generated + */ + public String convert<%=genDataType.getName()%>ToString(<%=genModel.getImportedName("org.eclipse.emf.ecore.EDataType")%> eDataType, Object instanceValue) + { + <%if (genDataType instanceof GenEnum) {%> + return instanceValue == null ? null : instanceValue.toString(); + <%} else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType(); %> + <%if (genBaseType.getGenPackage() == genPackage) {%> + return convert<%=genBaseType.getName()%>ToString(<%=genBaseType.getQualifiedClassifierAccessor()%>, instanceValue); + <%} else {%> + return <%=genBaseType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.convertToString(<%=genBaseType.getQualifiedClassifierAccessor()%>, instanceValue); + <%}%> + <%} else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType(); %> + <%if (genPackage.isDataTypeConverters()) {%> + return convert<%=genDataType.getName()%>((<%=genModel.getImportedName("java.util.List")%>)instanceValue); + <%} else {%> + if (instanceValue == null) return null; + <%=genModel.getImportedName("java.util.List")%> list = (<%=genModel.getImportedName("java.util.List")%>)instanceValue; + if (list.isEmpty()) return ""; + <%=genModel.getImportedName("java.lang.StringBuffer")%> result = new <%=genModel.getImportedName("java.lang.StringBuffer")%>(); + for (<%=genModel.getImportedName("java.util.Iterator")%> i = list.iterator(); i.hasNext(); ) + { + <%if (genItemType.getGenPackage() == genPackage) {%> + result.append(convert<%=genItemType.getName()%>ToString(<%=genItemType.getQualifiedClassifierAccessor()%>, i.next())); + <%} else {%> + result.append(<%=genItemType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.convertToString(<%=genItemType.getQualifiedClassifierAccessor()%>, i.next())); + <%}%> + result.append(' '); + } + return result.substring(0, result.length() - 1); + <%}%> + <%} else if (!genDataType.getMemberTypes().isEmpty()) {%> + <%if (genPackage.isDataTypeConverters()) {%> + <%if (genDataType.isPrimitiveType()) {%> + return instanceValue == null ? null : convert<%=genDataType.getName()%>(((<%=genDataType.getObjectInstanceClassName()%>)instanceValue).<%=genDataType.getPrimitiveValueFunction()%>()); + <%} else {%> + return convert<%=genDataType.getName()%>(instanceValue); + <%}%> + <%} else {%> + if (instanceValue == null) return null; + <%for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next();%> + if (<%=genMemberType.getQualifiedClassifierAccessor()%>.isInstance(instanceValue)) + { + try + { + <%if (genMemberType.getGenPackage() == genPackage) {%> + String value = convert<%=genMemberType.getName()%>ToString(<%=genMemberType.getQualifiedClassifierAccessor()%>, instanceValue); + <%} else {%> + String value = <%=genMemberType.getGenPackage().getQualifiedEFactoryInternalInstanceAccessor()%>.convertToString(<%=genMemberType.getQualifiedClassifierAccessor()%>, instanceValue); + <%}%> + if (value != null) return value; + } + catch (Exception e) + { + } + } + <%}%> + throw new IllegalArgumentException("Invalid value: '"+instanceValue+"' for datatype :"+eDataType.getName()); + <%}%> + <%} else if (genDataType.isArrayType()) {%> + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new <%=genModel.getImportedName("java.lang.UnsupportedOperationException")%>(); + <%} else {%> + return super.convertToString(eDataType, instanceValue); + <%}%> + } + + <%}%> +<%}%> +<%} else {%> + <%for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();%> + <%if (genClass.hasFactoryInterfaceCreateMethod()) {%> + /** + * Returns a new object of class '<%=genClass.getFormattedName()%>'. + * + * + * @return a new object of class '<%=genClass.getFormattedName()%>'. + * @generated + */ + <%=genClass.getImportedInterfaceName()%> create<%=genClass.getName()%>(); + + <%}%> + <%}%> + <%if (genPackage.isDataTypeConverters()) {%> + <%for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next();%> + <%if (genDataType.isSerializable()) {%> + /** + * Returns an instance of data type '<%=genDataType.getFormattedName()%>' corresponding the given literal. + * + * + * @param literal a literal of the data type. + * @return a new instance value of the data type. + * @generated + */ + <%=genDataType.getImportedInstanceClassName()%> create<%=genDataType.getName()%>(String literal); + + /** + * Returns a literal representation of an instance of data type '<%=genDataType.getFormattedName()%>'. + * + * + * @param instanceValue an instance value of the data type. + * @return a literal representation of the instance value. + * @generated + */ + String convert<%=genDataType.getName()%>(<%=genDataType.getImportedInstanceClassName()%> instanceValue); + + <%}%> + <%}%> + <%}%> +<%}%> +} //<%=isInterface ? genPackage.getFactoryInterfaceName() : genPackage.getFactoryClassName()%> +<%genModel.emitSortedImports();%> diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/spec/pom.xml new file mode 100644 index 0000000000..d1e2972a87 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/pom.xml @@ -0,0 +1,263 @@ + + + + + 4.0.0 + org.osoa + spec + pom + OSOA Specification API jars + http://incubator.apache.org/tuscany/ + incubating-M1 + + + 2.0 + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + ibiblio + ibiblio + http://www.ibiblio.org/maven2 + + + + + + + maven-test-repository + Test Repository + scp://people.apache.org/home/jsdelfino/public_html/maven2 + + + + + scm:svn:http://svn.apache.org/repos/asf/incubator/tuscany/java/spec + scm:svn:https://svn.apache.org/repos/asf/incubator/tuscany/java/spec + http://svn.apache.org/viewcvs.cgi/incubator/tuscany/java/spec + + + + sdo + sca + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + src/main/resources + + **/* + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + src/main/resources/META-INF/MANIFEST.MF + + org.apache + http://incubator.apache.org/tuscany/ + + + + + + install + + + + org.apache.maven.wagon + wagon-ssh-external + 1.0-alpha-5 + + + org.apache.maven.wagon + wagon-ftp + 1.0-alpha-6 + + + + + + + + + maven-javadoc-plugin + + + maven-jxr-plugin + + + + + + + distribution + + + + tuscany.home + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.0 + + + package + package + + javadoc + + + + + + http://java.sun.com/j2se/1.5.0/docs/api/ + + + + ../sca-api + ${tuscany.home}/spec/sca/target/site/apidocs + + + ../sdo-api + ${tuscany.home}/spec/sdo/target/site/apidocs + + + ../tuscany-common + ${tuscany.home}/sca/common/target/site/apidocs + + + ../tuscany-model + ${tuscany.home}/sca/model/target/site/apidocs + + + ../tuscany-core + ${tuscany.home}/sca/core/target/site/apidocs + + + ../tuscany-databinding-sdo + ${tuscany.home}/sca/databinding/sdo/target/site/apidocs + + + + true + true + - +
      ${project.name}
      +
      ${project.name}
      +
      +
      + + maven-antrun-plugin + + + create-dist + install + + + + + + + + + + + + + + run + + + + clean-dist + clean + + + + + + + + + + + + + + run + + + + + +
      +
      +
      +
      + +
      diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/pom.xml new file mode 100644 index 0000000000..3f1575d05d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/pom.xml @@ -0,0 +1,36 @@ + + + + + org.osoa + spec + incubating-M1 + + 4.0.0 + sca-api + SCA API + incubating-M1 + + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/CurrentModuleContext.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/CurrentModuleContext.java new file mode 100644 index 0000000000..90cc2ff79c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/CurrentModuleContext.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca; + +/** + * Class providing access to the current ModuleContext. + *

      + * The current context is set by the SCA container implementation before dispatching + * a request to any component in the module. + * + * @version $Rev$ $Date$ + */ +public final class CurrentModuleContext { + private static final ThreadLocal CURRENT_CONTEXT = new InheritableThreadLocal(); + + /** + * Return the current ModuleContext. + * + * @return the current ModuleContext + */ + public static ModuleContext getContext() { + return CURRENT_CONTEXT.get(); + } + + static void setContext(ModuleContext ctx) { + CURRENT_CONTEXT.set(ctx); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ModuleContext.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ModuleContext.java new file mode 100644 index 0000000000..77a36a2f77 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ModuleContext.java @@ -0,0 +1,102 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca; + + +/** + * Interface that can be used by SCA Components to access information about the + * Module that contains them. + * + * @version $Rev$ $Date$ + */ +public interface ModuleContext { + + /** + * Returns the name of the module. + * + * @return the name of the module + */ + String getName(); + + /** + * Returns the absolute URI of the module component. + * + * @return the absolute URI of the module component + */ + String getURI(); + +//FIXME This is not implemented yet, we need the SCA spec to define the metadata model first. +// /** +// * Returns the Module metadata object. +// * This represents the root <module> element in the SCA module definition. +// * +// * @return the module metadata object +// */ +// Module getMetaData(); + + /** + * Returns the request context that corresponds to the last remotable service invocation. + * If this is invoked from outside an SCA component then null is returned. + * + * @return the current request context + */ + RequestContext getRequestContext(); + + /** + * Returns an object implementing the interface defined for the named service. + * + * @param serviceName the name of another service in the current module + * @return an object that implements the service's interface + */ + Object locateService(String serviceName); + + /** + * Create a reference to the supplied component. + * The component must define only one service. + * + * @param self the component to be referenced + * @return a reference to the component + */ + ServiceReference createServiceReferenceForSession(Object self); + + /** + * Create a reference to the named service implemented by the supplied component. + * + * @param self the component to be referenced + * @param serviceName the service to be referenced + * @return a reference to the service + */ + ServiceReference createServiceReferenceForSession(Object self, String serviceName); + + /** + * Create a new session for stateful interaction with the named service. + * + * @param serviceName the name of the service to interact with + * @return a reference to the service + */ + ServiceReference newSession(String serviceName); + + /** + * Create a new session for stateful interaction with the named service + * using an application-supplied session identifier. + * + * @param serviceName the name of the service to interact with + * @param sessionId a token that identifies this session + * @return a reference to the service + */ + ServiceReference newSession(String serviceName, Object sessionId); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java new file mode 100644 index 0000000000..2c230c6729 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca; + +/** + * Exception thrown to indicate that no callback has been registered + * when interacting with a service. + * + * @version $Rev$ $Date$ + */ +public class NoRegisteredCallbackException extends ServiceRuntimeException { + private static final long serialVersionUID = 3734864942222558406L; + + /** + * Override constructor from ServiceRuntimeException. + * + * @see ServiceRuntimeException + */ + public NoRegisteredCallbackException() { + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param message passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public NoRegisteredCallbackException(String message) { + super(message); + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param message passed to ServiceRuntimeException + * @param cause passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public NoRegisteredCallbackException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param cause passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public NoRegisteredCallbackException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/RequestContext.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/RequestContext.java new file mode 100644 index 0000000000..e5f3ee63b1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/RequestContext.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca; + +import javax.security.auth.Subject; + +/** + * Interface that provides information on the current request. + * + * @version $Rev$ $Date$ + */ +public interface RequestContext { + /** + * Returns the JAAS Subject of the current request. + * + * @return the Subject of the current request + */ + Subject getSecuritySubject(); + + /** + * Returns the name of the service that was invoked. + * + * @return the name of the service that was invoked + */ + String getServiceName(); + + /** + * Returns a reference to the service that was invoked. + * + * @return a reference to the service that was invoked + */ + ServiceReference getServiceReference(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/SCA.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/SCA.java new file mode 100644 index 0000000000..e74a3def11 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/SCA.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca; + +/** + * Class providing access to an SCA implementation. + * SCA implementation providers may allow applications to bootstrap an SCA environment + * by providing a publically available subclass. + * + * @version $Rev$ $Date$ + */ +public abstract class SCA { + /** + * Protected method that allows an SCA implementation to set the current module context + * that will be returned by {@link org.osoa.sca.CurrentModuleContext#getContext()}. + * + * @param ctx the new current module context + */ + protected static void setModuleContext(ModuleContext ctx) { + CurrentModuleContext.setContext(ctx); + } + + /** + * Start the SCA implementation. + * If this method completes successfully then a module context will be associated with the current thread. + */ + public abstract void start(); + + /** + * Stop the SCA implementation. + * Once this method completes (successfully or abnormally) then no module context will be associated + * with the current thread. + */ + public abstract void stop(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceReference.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceReference.java new file mode 100644 index 0000000000..137d682736 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceReference.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca; + + +/** + * Interface that provides access to other services. + * Any ServiceReference can be cast to the business interface of the service to + * which it refers. + * + * @version $Rev$ $Date$ + */ +public interface ServiceReference { + /** + * Returns the session ID. + * + * @return the session ID + */ + Object getSessionID(); + + /** + * End the client's session with the referenced service. + */ + void endSession(); + + /** + * Returns the callback ID. + * + * @return the callback ID + */ + Object getCallbackID(); + + /** + * Sets the callback ID. + * + * @param callbackID the callback ID + */ + void setCallbackID(Object callbackID); + + /** + * Returns the callback object. + * + * @return the callback object + */ + Object getCallback(); + + /** + * Sets the callback object. + * + * @param callback the callback object + */ + void setCallback(Object callback); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceRuntimeException.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceRuntimeException.java new file mode 100644 index 0000000000..6b5ee9ffd3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceRuntimeException.java @@ -0,0 +1,67 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca; + + +/** + * Base for Exceptions that may be raised by an SCA runtime and which typical + * application code is not expected to be able to handle. + * + * @version $Rev$ $Date$ + */ +public class ServiceRuntimeException extends RuntimeException { + private static final long serialVersionUID = -3876058842262557092L; + + /** + * Override constructor from RuntimeException. + * + * @see RuntimeException + */ + public ServiceRuntimeException() { + } + + /** + * Override constructor from RuntimeException. + * + * @param message passed to RuntimeException + * @see RuntimeException + */ + public ServiceRuntimeException(String message) { + super(message); + } + + /** + * Override constructor from RuntimeException. + * + * @param message passed to RuntimeException + * @param cause passed to RuntimeException + * @see RuntimeException + */ + public ServiceRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Override constructor from RuntimeException. + * + * @param cause passed to RuntimeException + * @see RuntimeException + */ + public ServiceRuntimeException(Throwable cause) { + super(cause); + } +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceUnavailableException.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceUnavailableException.java new file mode 100644 index 0000000000..8f51fc966c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/ServiceUnavailableException.java @@ -0,0 +1,64 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca; + +/** + * Exception used to indicate that a runtime exception occurred during the invocation of and external service. + * + * @version $Rev$ $Date$ + */ +public class ServiceUnavailableException extends ServiceRuntimeException { + + private static final long serialVersionUID = -5869397223249401047L; + + /** + * Constructs a new ServiceUnavailableException. + */ + public ServiceUnavailableException() { + super((Throwable) null); + } + + /** + * Constructs a new ServiceUnavailableException with the specified detail message. + * + * @param message The detail message (which is saved to later retrieval by the getMessage() method). + */ + public ServiceUnavailableException(String message) { + super(message); + } + + /** + * Constructs a new ServiceUnavailableException with the specified cause. + * + * @param cause The cause (which is saved to later retrieval by the getCause() method). + */ + public ServiceUnavailableException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new ServiceUnavailableException with the specified detail message and cause. + * @param message + * The message (which is saved to later retrieval by the getMessage() method). + * @param cause + * The cause (which is saved to later retrieval by the getCause() method). + */ + public ServiceUnavailableException(String message, Throwable cause) { + super(message, cause); + } + +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/SessionEndedException.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/SessionEndedException.java new file mode 100644 index 0000000000..44d8a78fca --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/SessionEndedException.java @@ -0,0 +1,66 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca; + +/** + * Exception thrown to indicate the session being used for a stateful + * interaction has been ended. + * + * @version $Rev$ $Date$ + */ +public class SessionEndedException extends ServiceRuntimeException { + private static final long serialVersionUID = 3734864942222558406L; + + /** + * Override constructor from ServiceRuntimeException. + * + * @see ServiceRuntimeException + */ + public SessionEndedException() { + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param message passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public SessionEndedException(String message) { + super(message); + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param message passed to ServiceRuntimeException + * @param cause passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public SessionEndedException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Override constructor from ServiceRuntimeException. + * + * @param cause passed to ServiceRuntimeException + * @see ServiceRuntimeException + */ + public SessionEndedException(Throwable cause) { + super(cause); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/Version.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/Version.java new file mode 100644 index 0000000000..6f3ab8fb4e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/Version.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca; + +/** + * Class providing information on the version of the specification + * supported by these API classes. + * + * @version $Rev$ $Date$ + */ +public final class Version { + /** + * Identifier for version 0.9 + */ + public static final String VERSION_0_9 = "0.9"; + + /** + * Identifier for the XML Namespace for version 0.9 + */ + public static final String XML_NAMESPACE_0_9 = "http://www.osoa.org/xmlns/sca/0.9"; + + /** + * The specification version of these API classes. + */ + public static final String API_VERSION = VERSION_0_9; + + private Version() { + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java new file mode 100644 index 0000000000..7a3d222aae --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java @@ -0,0 +1,36 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation on a method that indicates that its parameters may safely + * be passed by reference. The annotation may also be placed on an interface + * or class to indicate that all declared methods support this optimization. + * + * @version $Rev$ $Date$ + */ +@Target({TYPE, METHOD}) +@Retention(RUNTIME) +public @interface AllowsPassByReference { +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Callback.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Callback.java new file mode 100644 index 0000000000..37e3adb9ff --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Callback.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * When placed on a service interface, this annotation specifies the interface + * to be used for callbacks. + *

      + * When placed on a method or field, this annotation denotes the injection + * site to be used for a callback reference. + * + * @version $Rev$ $Date$ + */ +@Target({TYPE, METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Callback { + /** + * The Class of the callback interface. + */ + Class value() default Void.class; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/ComponentMetaData.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/ComponentMetaData.java new file mode 100644 index 0000000000..c35b023ea4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/ComponentMetaData.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a field or method that is used to inject the component's metadata object. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface ComponentMetaData { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/ComponentName.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/ComponentName.java new file mode 100644 index 0000000000..46a117ea04 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/ComponentName.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a field or method that is used to inject the component's name. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface ComponentName { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Context.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Context.java new file mode 100644 index 0000000000..1139e97a96 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Context.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a field or method that is used to inject the component's ModuleContext. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Context { +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Destroy.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Destroy.java new file mode 100644 index 0000000000..c75e0fc165 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Destroy.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a method that will be called by the container when the + * scope defined for the local service ends. + * + * @version $Rev$ $Date$ + */ +@Target(METHOD) +@Retention(RUNTIME) +public @interface Destroy { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Init.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Init.java new file mode 100644 index 0000000000..94745a64d2 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Init.java @@ -0,0 +1,39 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a method that will be called by the container when the + * scope defined for the local service begins. + * + * @version $Rev$ $Date$ + */ +@Target(METHOD) +@Retention(RUNTIME) +public @interface Init { + /** + * Instructs the container when a component instance should be instantiated. + * If true, then the component will be instantiated when its scope begins; + * if false it will be instantiated when first referenced. + */ + public boolean eager() default false; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/OneWay.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/OneWay.java new file mode 100644 index 0000000000..15cb69cdeb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/OneWay.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Annotation on a method that indicates that the method is non-blocking and communication + * with the service provider may use buffer the requests and send them at some later time. + * + * @version $Rev: 388784 $ $Date: 2006-03-25 08:34:51 -0800 (Sat, 25 Mar 2006) $ + */ +@Target({METHOD}) +@Retention(RUNTIME) +public @interface OneWay { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Property.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Property.java new file mode 100644 index 0000000000..b9cee1765a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Property.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a field or method that is used to inject a configuration property value. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Property { + /** + * The name of the property. If not specified then the name will be derived from the annotated field. + */ + public String name() default ""; + + /** + * Indicates if a value must be specified. + */ + public boolean required() default false; +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Reference.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Reference.java new file mode 100644 index 0000000000..f7f390da0d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Reference.java @@ -0,0 +1,43 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a field or method that is used to inject a reference. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface Reference { + /** + * The name of the reference. If not specified then the name will be derived from the annotated field. + */ + public String name() default ""; + + /** + * Indicates if a reference must be specified. + */ + public boolean required() default false; +} + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Remotable.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Remotable.java new file mode 100644 index 0000000000..4048e240b6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Remotable.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a Java interface as remotable. + * Remotable interfaces use pass-by-value semantics, can be published as entry points + * and used for external services. + * + * @version $Rev$ $Date$ + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface Remotable { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Scope.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Scope.java new file mode 100644 index 0000000000..2e0f474687 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Scope.java @@ -0,0 +1,42 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a scoped service. + * + * @version $Rev$ $Date$ + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface Scope { + /** + * The name of the scope. Values currently defined by the specification are: + *

        + *
      • stateless (default)
      • + *
      • request
      • + *
      • session
      • + *
      • module
      • + *
      + */ + String value() default "stateless"; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Service.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Service.java new file mode 100644 index 0000000000..3c51316c14 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Service.java @@ -0,0 +1,41 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate the service interfaces exposed by a Java class. + * + * @version $Rev$ $Date$ + */ +@Target({TYPE}) +@Retention(RUNTIME) +public @interface Service { + /** + * Array of interfaces that should be exposed as services. + */ + Class[] interfaces() default {}; + + /** + * Shortcut allowing a single interface to be exposed. + */ + Class value() default Void.class; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Session.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Session.java new file mode 100644 index 0000000000..11a90d3159 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/Session.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.TYPE; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate the characteristics of a session. + * + * @version $Rev$ $Date$ + */ +@Target(TYPE) +@Retention(RUNTIME) +public @interface Session { + /** + * The maximum time that can pass between operations in a single conversation. + * If this time is exceeded the container may end the conversation. + */ + public String maxIdleTime() default ""; + + /** + * The maximum time that a conversation may remain active. + * If this time is exceeded the container may end the conversation. + */ + public String maxAge() default ""; + + /** + * If true, indicates that only the user that initiated the conversation + * has the authority to continue it. + */ + public boolean singlePrincipal() default false; +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/SessionID.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/SessionID.java new file mode 100644 index 0000000000..86d9605bb6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/java/org/osoa/sca/annotations/SessionID.java @@ -0,0 +1,33 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import java.lang.annotation.Retention; +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import java.lang.annotation.Target; + +/** + * Annotation used to indicate a field or method that is used to inject the session ID. + * + * @version $Rev$ $Date$ + */ +@Target({METHOD, FIELD}) +@Retention(RUNTIME) +public @interface SessionID { +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/MANIFEST.MF b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..ff2f248c25 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Extension-Name: sca-api +Specification-Title: SCA API +Specification-Vendor: Apache Software Foundation +Implementation-Vendor: Apache Software Foundation +Implementation-Vendor-Id: org.apache +Implementation-Title: sca-api +Implementation-Version: incubating-M1 +Bundle-ManifestVersion: 2 +Bundle-Name: SDO API +Bundle-SymbolicName: org.apache.tuscany.sca.spec +Bundle-Version: 1.0.0 +Bundle-Vendor: Apache Software Foundation +Export-Package: org.osoa.sca, + org.osoa.sca.annotations, + org.osoa.sca.model diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-binding-sca.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-binding-sca.xsd new file mode 100644 index 0000000000..cf2a75f5bc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-binding-sca.xsd @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-binding-webservice.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-binding-webservice.xsd new file mode 100644 index 0000000000..a22a44db0a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-binding-webservice.xsd @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-core.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-core.xsd new file mode 100644 index 0000000000..866c4a1189 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-core.xsd @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-implementation-java.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-implementation-java.xsd new file mode 100644 index 0000000000..87ead7a07d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-implementation-java.xsd @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-interface-java.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-interface-java.xsd new file mode 100644 index 0000000000..eb7ab1cd25 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-interface-java.xsd @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-interface-wsdl.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-interface-wsdl.xsd new file mode 100644 index 0000000000..fe81e6bca5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca-interface-wsdl.xsd @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca.xsd new file mode 100644 index 0000000000..1159726be0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/main/resources/schemas/sca.xsd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/test/java/org/osoa/sca/annotations/CallbackTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/test/java/org/osoa/sca/annotations/CallbackTestCase.java new file mode 100644 index 0000000000..0fa278110a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/test/java/org/osoa/sca/annotations/CallbackTestCase.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import junit.framework.TestCase; +import org.osoa.sca.annotations.usage.CallbackType; + +/** + * Test case for callback annotation. + * + * @version $Rev$ $Date$ + */ +public class CallbackTestCase extends TestCase { + private Class type; + private Field field; + private Method method; + + /** + * Test annotation of a callback interface. + */ + public void testTypeDeclaration() { + assertTrue(type.isAnnotationPresent(Callback.class)); + Callback callback = type.getAnnotation(Callback.class); + assertEquals(Object.class, callback.value()); + } + + /** + * Test annotation of a private field. + */ + public void testField() { + assertTrue(field.isAnnotationPresent(Callback.class)); + Callback callback = field.getAnnotation(Callback.class); + assertEquals(Void.class, callback.value()); + } + + /** + * Test annotation of a method. + */ + public void testMethod() { + assertTrue(method.isAnnotationPresent(Callback.class)); + Callback callback = method.getAnnotation(Callback.class); + assertEquals(Void.class, callback.value()); + } + + protected void setUp() throws Exception { + super.setUp(); + type = CallbackType.class; + field = type.getDeclaredField("cbField"); + method = type.getMethod("cbMethod"); + } +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/test/java/org/osoa/sca/annotations/usage/CallbackType.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/test/java/org/osoa/sca/annotations/usage/CallbackType.java new file mode 100644 index 0000000000..8d75c69ac5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sca/src/test/java/org/osoa/sca/annotations/usage/CallbackType.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.osoa.sca.annotations.usage; + +import org.osoa.sca.annotations.Callback; + +/** + * Mock object for callback annotation tests. + * + * @version $Rev$ $Date$ + */ +@Callback(Object.class) +public class CallbackType { + @Callback + private Object cbField; + + /** + * Site for testing annotation of a public method. + */ + @Callback + public void cbMethod() { + cbField = new Object(); + } + + /** + * Mock method to make IDEs stop complaining. + * + * @return nothing + */ + public Object getCbField() { + return cbField; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/pom.xml new file mode 100644 index 0000000000..c163cb1a89 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/pom.xml @@ -0,0 +1,51 @@ + + + + + org.osoa + spec + incubating-M1 + + 4.0.0 + commonj + sdo-api + SDO API + incubating-M1 + + + + junit + junit + 3.8.1 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.4 + 1.4 + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/ChangeSummary.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/ChangeSummary.java new file mode 100644 index 0000000000..3eeacf4c01 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/ChangeSummary.java @@ -0,0 +1,204 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo; + +import java.util.List; + +/** + * A change summary is used to record changes to DataObjects, + * allowing applications to efficiently and incrementally update back-end storage when required. + */ +public interface ChangeSummary +{ + /** + * Indicates whether change logging is on (true) or off (false). + * @return true if change logging is on. + * @see #beginLogging + * @see #endLogging + */ + boolean isLogging(); + + /** + * Returns the {@link DataGraph data graph} associated with this change summary or null. + * @return the data graph. + * @see DataGraph#getChangeSummary + */ + DataGraph getDataGraph(); + + /** + * Returns a list consisting of all the {@link DataObject data objects} that have been changed while {@link #isLogging logging}. + *

      + * The {@link #isCreated new} and {@link #isModified modified} objects in the List are references to objects + * associated with this ChangeSummary. + * The {@link #isDeleted deleted} objects in the List are references to objects + * at the time that event logging was enabled; + *

      Each changed object must have exactly one of the following methods return true: + * {@link #isCreated isCreated}, + * {@link #isDeleted isDeleted}, or + * {@link #isModified isModified}. + * @return a list of changed data objects. + * @see #isCreated(DataObject) + * @see #isDeleted(DataObject) + * @see #isModified(DataObject) + */ + List /*DataObject*/ getChangedDataObjects(); + + /** + * Returns whether or not the specified data object was created while {@link #isLogging logging}. + * Any object that was added to the scope + * but was not in the scope when logging began, + * will be considered created. + * @param dataObject the data object in question. + * @return true if the specified data object was created. + * @see #getChangedDataObjects + */ + boolean isCreated(DataObject dataObject); + + /** + * Returns whether or not the specified data object was deleted while {@link #isLogging logging}. + * Any object that is not in scope but was in scope when logging began + * will be considered deleted. + * @param dataObject the data object in question. + * @return true if the specified data object was deleted. + * @see #getChangedDataObjects + */ + boolean isDeleted(DataObject dataObject); + + /** + * A setting encapsulates a {@link Property property} and a corresponding single value of the property's {@link Property#getType type}. + */ + public interface Setting + { + /** + * Returns the property of the setting. + * @return the setting property. + */ + Property getProperty(); + + /** + * Returns the value of the setting. + * @return the setting value. + */ + Object getValue(); + + /** + * Returns whether or not the property is set. + * @return true if the property is set. + */ + boolean isSet(); + } + + /** + * Returns a list of {@link ChangeSummary.Setting settings} + * that represent the property values of the given dataObject + * at the point when logging {@link #beginLogging() began}. + *

      In the case of a {@link #isDeleted(DataObject) deleted} object, + * the List will include settings for all the Properties. + *

      An old value setting indicates the value at the + * point logging begins. A setting is only produced for + * {@link #isModified modified} objects if + * either the old value differs from the current value or + * if the isSet differs from the current value. + *

      No settings are produced for {@link #isCreated created} objects. + * @param dataObject the object in question. + * @return a list of settings. + * @see #getChangedDataObjects + */ + List /*ChangeSummary.Setting*/ getOldValues(DataObject dataObject); + + /** + * Clears the List of {@link #getChangedDataObjects changes} and turns change logging on. + * No operation occurs if logging is already on. + * @see #endLogging + * @see #isLogging + */ + void beginLogging(); + + /** + * An implementation that requires logging may throw an UnsupportedOperationException. + * Turns change logging off. No operation occurs if logging is already off. + * @see #beginLogging + * @see #isLogging + */ + void endLogging(); + + + /** + * Returns whether or not the specified data object was updated while {@link #isLogging logging}. + * An object that was contained in the scope when logging began + * and remains in the scope when logging ends will be considered potentially modified. + *

      An object considered modified must have at least one old value setting. + * @param dataObject the data object in question. + * @return true if the specified data object was modified. + * @see #getChangedDataObjects + */ + boolean isModified(DataObject dataObject); + + /** + * Returns the ChangeSummary root DataObject - the object from which + * changes are tracked. + * When a DataGraph is used, this is the same as getDataGraph().getRootObject(). + * @return the ChangeSummary root DataObject + */ + DataObject getRootObject(); + + /** + * Returns a {@link ChangeSummary.Setting setting} for the specified property + * representing the property value of the given dataObject + * at the point when logging {@link #beginLogging() began}. + *

      Returns null if the property was not modified and + * has not been {@link #isDeleted(DataObject) deleted}. + * @param dataObject the object in question. + * @param property the property of the object. + * @return the Setting for the specified property. + * @see #getChangedDataObjects + */ + Setting getOldValue(DataObject dataObject, Property property); + + /** + * Returns the value of the {@link DataObject#getContainer container} data object + * at the point when logging {@link #beginLogging() began}. + * @param dataObject the object in question. + * @return the old container data object. + */ + DataObject getOldContainer(DataObject dataObject); + + /** + * Returns the value of the {@link DataObject#getContainmentProperty containment property} data object property + * at the point when logging {@link #beginLogging() began}. + * @param dataObject the object in question. + * @return the old containment property. + */ + Property getOldContainmentProperty(DataObject dataObject); + + /** + * Returns the value of the {@link DataObject#getSequence sequence} for the data object + * at the point when logging {@link #beginLogging() began}. + * @param dataObject the object in question. + * @return the old containment property. + */ + Sequence getOldSequence(DataObject dataObject); + + /** + * This method is intended for use by service implementations only. + * Undoes all changes in the log to restore the tree of + * DataObjects to its original state when logging began. + * isLogging() is unchanged. The log is cleared. + * @see #beginLogging + * @see #endLogging + * @see #isLogging + */ + void undoChanges(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/DataGraph.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/DataGraph.java new file mode 100644 index 0000000000..78bc7227a1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/DataGraph.java @@ -0,0 +1,73 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo; + +import java.io.Serializable; + +/** + * A data graph is used to package a graph of {@link DataObject data objects} along with their + * metadata, that is, data describing the data. + * A data graph also contains a {@link #getChangeSummary change summary} + * which is used to record changes made to the objects in the graph. + */ + +public interface DataGraph extends Serializable +{ + /** + * Returns the root {@link DataObject data object} of this data graph. + * @return the root data object. + * @see DataObject#getDataGraph + */ + DataObject getRootObject(); + + /** + * Returns the {@link ChangeSummary change summary} associated with this data graph. + * @return the change summary. + * @see ChangeSummary#getDataGraph + */ + ChangeSummary getChangeSummary(); + + /** + * Returns the {@link Type type} with the given the {@link Type#getURI() URI}, + * or contained by the resource at the given URI, + * and with the given {@link Type#getName name}. + * @param uri the namespace URI of a type or the location URI of a resource containing a type. + * @param typeName name of a type. + * @return the type with the corresponding namespace and name. + */ + Type getType(String uri, String typeName); + + /** + * Creates a new root data object of the {@link #getType specified type}. + * An exception is thrown if a root object exists. + * @param namespaceURI namespace of the type. + * @param typeName name of the type. + * @return the new root. + * @throws IllegalStateException if the root object already exists. + * @see #createRootObject(Type) + * @see #getType(String, String) + */ + DataObject createRootObject(String namespaceURI, String typeName); + + /** + * Creates a new root data object of the specified type. + * An exception is thrown if a root object exists. + * @param type the type of the new root. + * @return the new root. + * @throws IllegalStateException if the root object already exists. + * @see #createRootObject(String, String) + */ + DataObject createRootObject(Type type); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/DataObject.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/DataObject.java new file mode 100644 index 0000000000..8a1819f475 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/DataObject.java @@ -0,0 +1,1105 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Date; +import java.util.List; + +/** + * A data object is a representation of some structured data. + * It is the fundamental component in the SDO (Service Data Objects) package. + * Data objects support reflection, path-based accesss, convenience creation and deletion methods, + * and the ability to be part of a {@link DataGraph data graph}. + *

      + * Each data object holds its data as a series of {@link Property Properties}. + * Properties can be accessed by name, property index, or using the property meta object itself. + * A data object can also contain references to other data objects, through reference-type Properties. + *

      + * A data object has a series of convenience accessors for its Properties. + * These methods either use a path (String), + * a property index, + * or the {@link Property property's meta object} itself, to identify the property. + * Some examples of the path-based accessors are as follows: + *

      + * DataObject company = ...;
      + * company.get("name");                   is the same as company.get(company.getType().getProperty("name"))
      + * company.set("name", "acme");
      + * company.get("department.0/name")       is the same as ((DataObject)((List)company.get("department")).get(0)).get("name")
      + *                                        .n  indexes from 0 ... implies the name property of the first department
      + * company.get("department[1]/name")      [] indexes from 1 ... implies the name property of the first department
      + * company.get("department[number=123]")  returns the first department where number=123
      + * company.get("..")                      returns the containing data object
      + * company.get("/")                       returns the root containing data object
      + *
      + *

      There are general accessors for Properties, i.e., {@link #get(Property) get} and {@link #set(Property, Object) set}, + * as well as specific accessors for the primitive types and commonly used data types like + * String, Date, List, BigInteger, and BigDecimal. + */ +public interface DataObject extends Serializable +{ + /** + * Returns the value of a property of either this object or an object reachable from it, as identified by the + * specified path. + * @param path the path to a valid object and property. + * @return the value of the specified property. + * @see #get(Property) + */ + Object get(String path); + + /** + * Sets a property of either this object or an object reachable from it, as identified by the specified path, + * to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void set(String path, Object value); + + /** + * Returns whether a property of either this object or an object reachable from it, as identified by the specified path, + * is considered to be set. + * @param path the path to a valid object and property. + * @see #isSet(Property) + */ + boolean isSet(String path); + + /** + * Unsets a property of either this object or an object reachable from it, as identified by the specified path. + * @param path the path to a valid object and property. + * @see #unset(Property) + */ + void unset(String path); + + /** + * Returns the value of a boolean property identified by the specified path. + * @param path the path to a valid object and property. + * @return the boolean value of the specified property. + * @see #get(String) + */ + boolean getBoolean(String path); + + /** + * Returns the value of a byte property identified by the specified path. + * @param path the path to a valid object and property. + * @return the byte value of the specified property. + * @see #get(String) + */ + byte getByte(String path); + + /** + * Returns the value of a char property identified by the specified path. + * @param path the path to a valid object and property. + * @return the char value of the specified property. + * @see #get(String) + */ + char getChar(String path); + + /** + * Returns the value of a double property identified by the specified path. + * @param path the path to a valid object and property. + * @return the double value of the specified property. + * @see #get(String) + */ + double getDouble(String path); + + /** + * Returns the value of a float property identified by the specified path. + * @param path the path to a valid object and property. + * @return the float value of the specified property. + * @see #get(String) + */ + float getFloat(String path); + + /** + * Returns the value of a int property identified by the specified path. + * @param path the path to a valid object and property. + * @return the int value of the specified property. + * @see #get(String) + */ + int getInt(String path); + + /** + * Returns the value of a long property identified by the specified path. + * @param path the path to a valid object and property. + * @return the long value of the specified property. + * @see #get(String) + */ + long getLong(String path); + + /** + * Returns the value of a short property identified by the specified path. + * @param path the path to a valid object and property. + * @return the short value of the specified property. + * @see #get(String) + */ + short getShort(String path); + + /** + * Returns the value of a byte[] property identified by the specified path. + * @param path the path to a valid object and property. + * @return the byte[] value of the specified property. + * @see #get(String) + */ + byte[] getBytes(String path); + + /** + * Returns the value of a BigDecimal property identified by the specified path. + * @param path the path to a valid object and property. + * @return the BigDecimal value of the specified property. + * @see #get(String) + */ + BigDecimal getBigDecimal(String path); + + /** + * Returns the value of a BigInteger property identified by the specified path. + * @param path the path to a valid object and property. + * @return the BigInteger value of the specified property. + * @see #get(String) + */ + BigInteger getBigInteger(String path); + + /** + * Returns the value of a DataObject property identified by the specified path. + * @param path the path to a valid object and property. + * @return the DataObject value of the specified property. + * @see #get(String) + */ + DataObject getDataObject(String path); + + /** + * Returns the value of a Date property identified by the specified path. + * @param path the path to a valid object and property. + * @return the Date value of the specified property. + * @see #get(String) + */ + Date getDate(String path); + + /** + * Returns the value of a String property identified by the specified path. + * @param path the path to a valid object and property. + * @return the String value of the specified property. + * @see #get(String) + */ + String getString(String path); + + /** + * Returns the value of a List property identified by the specified path. + * @param path the path to a valid object and property. + * @return the List value of the specified property. + * @see #get(String) + */ + List getList(String path); + + /** + * Returns the value of a Sequence property identified by the specified path. + * @param path the path to a valid object and property. + * @return the Sequence value of the specified property. + * @see #get(String) + */ + Sequence getSequence(String path); + + /** + * Sets the value of a boolean property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setBoolean(String path, boolean value); + + /** + * Sets the value of a byte property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setByte(String path, byte value); + + /** + * Sets the value of a char property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setChar(String path, char value); + + /** + * Sets the value of a double property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setDouble(String path, double value); + + /** + * Sets the value of a float property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setFloat(String path, float value); + + /** + * Sets the value of a int property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setInt(String path, int value); + + /** + * Sets the value of a long property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setLong(String path, long value); + + /** + * Sets the value of a short property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setShort(String path, short value); + + /** + * Sets the value of a byte[] property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setBytes(String path, byte[] value); + + /** + * Sets the value of a BigDecimal property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setBigDecimal(String path, BigDecimal value); + + /** + * Sets the value of a BigInteger property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setBigInteger(String path, BigInteger value); + + /** + * Sets the value of a DataObject property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setDataObject(String path, DataObject value); + + /** + * Sets the value of a Date property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setDate(String path, Date value); + + /** + * Sets the value of a String property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + */ + void setString(String path, String value); + + /** + * Sets the value of a List property identified by the specified path, to the specified value. + * @param path the path to a valid object and property. + * @param value the new value for the property. + * @see #set(String, Object) + * @see #setList(Property, List) + */ + void setList(String path, List value); + + /** + * Returns the value of the property at the specified index in {@link Type#getProperties property list} + * of this object's {@link Type type}. + * @param propertyIndex the index of the property. + * @return the value of the specified property. + * @see #get(Property) + */ + Object get(int propertyIndex); + + /** + * Sets the property at the specified index in {@link Type#getProperties property list} of this object's + * {@link Type type}, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void set(int propertyIndex, Object value); + + /** + * Returns whether the the property at the specified index in {@link Type#getProperties property list} of this object's + * {@link Type type}, is considered to be set. + * @param propertyIndex the index of the property. + * @return whether the specified property is set. + * @see #isSet(Property) + */ + boolean isSet(int propertyIndex); + + /** + * Unsets the property at the specified index in {@link Type#getProperties property list} of this object's {@link Type type}. + * @param propertyIndex the index of the property. + * @see #unset(Property) + */ + void unset(int propertyIndex); + + /** + * Returns the value of a boolean property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the boolean value of the specified property. + * @see #get(int) + */ + boolean getBoolean(int propertyIndex); + + /** + * Returns the value of a byte property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the byte value of the specified property. + * @see #get(int) + */ + byte getByte(int propertyIndex); + + /** + * Returns the value of a char property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the char value of the specified property. + * @see #get(int) + */ + char getChar(int propertyIndex); + + /** + * Returns the value of a double property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the double value of the specified property. + * @see #get(int) + */ + double getDouble(int propertyIndex); + + /** + * Returns the value of a float property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the float value of the specified property. + * @see #get(int) + */ + float getFloat(int propertyIndex); + + /** + * Returns the value of a int property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the int value of the specified property. + * @see #get(int) + */ + int getInt(int propertyIndex); + + /** + * Returns the value of a long property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the long value of the specified property. + * @see #get(int) + */ + long getLong(int propertyIndex); + + /** + * Returns the value of a short property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the short value of the specified property. + * @see #get(int) + */ + short getShort(int propertyIndex); + + /** + * Returns the value of a byte[] property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the byte[] value of the specified property. + * @see #get(int) + */ + byte[] getBytes(int propertyIndex); + + /** + * Returns the value of a BigDecimal property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the BigDecimal value of the specified property. + * @see #get(int) + */ + BigDecimal getBigDecimal(int propertyIndex); + + /** + * Returns the value of a BigInteger property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the BigInteger value of the specified property. + * @see #get(int) + */ + BigInteger getBigInteger(int propertyIndex); + + /** + * Returns the value of a DataObject property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the DataObject value of the specified property. + * @see #get(int) + */ + DataObject getDataObject(int propertyIndex); + + /** + * Returns the value of a Date property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the Date value of the specified property. + * @see #get(int) + */ + Date getDate(int propertyIndex); + + /** + * Returns the value of a String property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the String value of the specified property. + * @see #get(int) + */ + String getString(int propertyIndex); + + /** + * Returns the value of a List property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the List value of the specified property. + * @see #get(int) + */ + List getList(int propertyIndex); + + /** + * Returns the value of a Sequence property identified by the specified property index. + * @param propertyIndex the index of the property. + * @return the Sequence value of the specified property. + * @see #get(int) + */ + Sequence getSequence(int propertyIndex); + + /** + * Sets the value of a boolean property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setBoolean(int propertyIndex, boolean value); + + /** + * Sets the value of a byte property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setByte(int propertyIndex, byte value); + + /** + * Sets the value of a char property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setChar(int propertyIndex, char value); + + /** + * Sets the value of a double property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setDouble(int propertyIndex, double value); + + /** + * Sets the value of a float property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setFloat(int propertyIndex, float value); + + /** + * Sets the value of a int property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setInt(int propertyIndex, int value); + + /** + * Sets the value of a long property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setLong(int propertyIndex, long value); + + /** + * Sets the value of a short property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setShort(int propertyIndex, short value); + + /** + * Sets the value of a byte[] property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setBytes(int propertyIndex, byte[] value); + + /** + * Sets the value of a BigDecimal property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setBigDecimal(int propertyIndex, BigDecimal value); + + /** + * Sets the value of a BigInteger property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setBigInteger(int propertyIndex, BigInteger value); + + /** + * Sets the value of a DataObject property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setDataObject(int propertyIndex, DataObject value); + + /** + * Sets the value of a Date property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setDate(int propertyIndex, Date value); + + /** + * Sets the value of a String property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + */ + void setString(int propertyIndex, String value); + + /** + * Sets the value of a List property identified by the specified property index, to the specified value. + * @param propertyIndex the index of the property. + * @param value the new value for the property. + * @see #set(int, Object) + * @see #setList(Property, List) + */ + void setList(int propertyIndex, List value); + + /** + * Returns the value of the given property of this object. + *

      + * If the property is {@link Property#isMany many-valued}, + * the result will be a {@link java.util.List} + * and each object in the List will be {@link Type#isInstance an instance of} + * the property's {@link Property#getType type}. + * Otherwise the result will directly be an instance of the property's type. + * @param property the property of the value to fetch. + * @return the value of the given property of the object. + * @see #set(Property, Object) + * @see #unset(Property) + * @see #isSet(Property) + */ + Object get(Property property); + + /** + * Sets the value of the given property of the object to the new value. + *

      + * If the property is {@link Property#isMany many-valued}, + * the new value must be a {@link java.util.List} + * and each object in that list must be {@link Type#isInstance an instance of} + * the property's {@link Property#getType type}; + * the existing contents are cleared and the contents of the new value are added. + * Otherwise the new value directly must be an instance of the property's type + * and it becomes the new value of the property of the object. + * @param property the property of the value to set. + * @param value the new value for the property. + * @see #unset(Property) + * @see #isSet(Property) + * @see #get(Property) + */ + void set(Property property, Object value); + + /** + * Returns whether the property of the object is considered to be set. + *

      + * isSet() for many-valued Properties returns true if the List is not empty and + * false if the List is empty. For single-valued Properties: + *

      • If the Property has not been set() or has been unset() then isSet() returns false.
      • + *
      • If the current value is not the Property's default or null, isSet() returns true.
      • + *
      • For the remaining cases the implementation may decide between two policies:
      • + *
        1. any call to set() without a call to unset() will cause isSet() to return true, or
        2. + *
        3. the current value is compared to the default value and isSet() returns true when they differ.
        4. + *

      + * @param property the property in question. + * @return whether the property of the object is set. + * @see #set(Property, Object) + * @see #unset(Property) + * @see #get(Property) + */ + boolean isSet(Property property); + + /** + * Unsets the property of the object. + *

      + * If the property is {@link Property#isMany many-valued}, + * the value must be an {@link java.util.List} + * and that list is cleared. + * Otherwise, + * the value of the property of the object + * is set to the property's {@link Property#getDefault default value}. + * The property will no longer be considered {@link #isSet set}. + * @param property the property in question. + * @see #isSet(Property) + * @see #set(Property, Object) + * @see #get(Property) + */ + void unset(Property property); + + /** + * Returns the value of the specified boolean property. + * @param property the property to get. + * @return the boolean value of the specified property. + * @see #get(Property) + */ + boolean getBoolean(Property property); + + /** + * Returns the value of the specified byte property. + * @param property the property to get. + * @return the byte value of the specified property. + * @see #get(Property) + */ + byte getByte(Property property); + + /** + * Returns the value of the specified char property. + * @param property the property to get. + * @return the char value of the specified property. + * @see #get(Property) + */ + char getChar(Property property); + + /** + * Returns the value of the specified double property. + * @param property the property to get. + * @return the double value of the specified property. + * @see #get(Property) + */ + double getDouble(Property property); + + /** + * Returns the value of the specified float property. + * @param property the property to get. + * @return the float value of the specified property. + * @see #get(Property) + */ + float getFloat(Property property); + + /** + * Returns the value of the specified int property. + * @param property the property to get. + * @return the int value of the specified property. + * @see #get(Property) + */ + int getInt(Property property); + + /** + * Returns the value of the specified long property. + * @param property the property to get. + * @return the long value of the specified property. + * @see #get(Property) + */ + long getLong(Property property); + + /** + * Returns the value of the specified short property. + * @param property the property to get. + * @return the short value of the specified property. + * @see #get(Property) + */ + short getShort(Property property); + + /** + * Returns the value of the specified byte[] property. + * @param property the property to get. + * @return the byte[] value of the specified property. + * @see #get(Property) + */ + byte[] getBytes(Property property); + + /** + * Returns the value of the specified BigDecimal property. + * @param property the property to get. + * @return the BigDecimal value of the specified property. + * @see #get(Property) + */ + BigDecimal getBigDecimal(Property property); + + /** + * Returns the value of the specified BigInteger property. + * @param property the property to get. + * @return the BigInteger value of the specified property. + * @see #get(Property) + */ + BigInteger getBigInteger(Property property); + + /** + * Returns the value of the specified DataObject property. + * @param property the property to get. + * @return the DataObject value of the specified property. + * @see #get(Property) + */ + DataObject getDataObject(Property property); + + /** + * Returns the value of the specified Date property. + * @param property the property to get. + * @return the Date value of the specified property. + * @see #get(Property) + */ + Date getDate(Property property); + + /** + * Returns the value of the specified String property. + * @param property the property to get. + * @return the String value of the specified property. + * @see #get(Property) + */ + String getString(Property property); + + /** + * Returns the value of the specified List property. + * The List returned contains the current values. + * Updates through the List interface operate on the current values of the DataObject. + * Each access returns the same List object. + * @param property the property to get. + * @return the List value of the specified property. + * @see #get(Property) + */ + List getList(Property property); + + /** + * Returns the value of the specified Sequence property. + * @param property the property to get. + * @return the Sequence value of the specified property. + * @see #get(Property) + */ + Sequence getSequence(Property property); + + /** + * Sets the value of the specified boolean property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setBoolean(Property property, boolean value); + + /** + * Sets the value of the specified byte property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setByte(Property property, byte value); + + /** + * Sets the value of the specified char property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setChar(Property property, char value); + + /** + * Sets the value of the specified double property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setDouble(Property property, double value); + + /** + * Sets the value of the specified float property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setFloat(Property property, float value); + + /** + * Sets the value of the specified int property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setInt(Property property, int value); + + /** + * Sets the value of the specified long property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setLong(Property property, long value); + + /** + * Sets the value of the specified short property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setShort(Property property, short value); + + /** + * Sets the value of the specified byte[] property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setBytes(Property property, byte[] value); + + /** + * Sets the value of the specified BigDecimal property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setBigDecimal(Property property, BigDecimal value); + + /** + * Sets the value of the specified BigInteger property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setBigInteger(Property property, BigInteger value); + + /** + * Sets the value of the specified DataObject property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setDataObject(Property property, DataObject value); + + /** + * Sets the value of the specified Date property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setDate(Property property, Date value); + + /** + * Sets the value of the specified String property, to the specified value. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setString(Property property, String value); + + /** + * Sets the value of the specified List property, to the specified value. + *

      The new value must be a {@link java.util.List} + * and each object in that list must be {@link Type#isInstance an instance of} + * the property's {@link Property#getType type}; + * the existing contents are cleared and the contents of the new value are added. + * @param property the property to set. + * @param value the new value for the property. + * @see #set(Property, Object) + */ + void setList(Property property, List value); + + /** + * Returns a new {@link DataObject data object} contained by this object using the specified property, + * which must be a {@link Property#isContainment containment property}. + * The type of the created object is the {@link Property#getType declared type} of the specified property. + * @param propertyName the name of the specified containment property. + * @return the created data object. + * @see #createDataObject(String, String, String) + */ + DataObject createDataObject(String propertyName); + + /** + * Returns a new {@link DataObject data object} contained by this object using the specified property, + * which must be a {@link Property#isContainment containment property}. + * The type of the created object is the {@link Property#getType declared type} of the specified property. + * @param propertyIndex the index of the specified containment property. + * @return the created data object. + * @see #createDataObject(int, String, String) + */ + DataObject createDataObject(int propertyIndex); + + /** + * Returns a new {@link DataObject data object} contained by this object using the specified property, + * which must be a {@link Property#isContainment containment property}. + * The type of the created object is the {@link Property#getType declared type} of the specified property. + * @param property the specified containment property. + * @return the created data object. + * @see #createDataObject(Property, Type) + */ + DataObject createDataObject(Property property); + + /** + * Returns a new {@link DataObject data object} contained by this object using the specified property, + * which must be a {@link Property#isContainment containment property}. + * The type of the created object is specified by the packageURI and typeName arguments. + * The specified type must be a compatible target for the property identified by propertyName. + * @param propertyName the name of the specified containment property. + * @param namespaceURI the namespace URI of the package containing the type of object to be created. + * @param typeName the name of a type in the specified package. + * @return the created data object. + * @see #createDataObject(String) + * @see DataGraph#getType + */ + DataObject createDataObject(String propertyName, String namespaceURI, String typeName); + + /** + * Returns a new {@link DataObject data object} contained by this object using the specified property, + * which must be a {@link Property#isContainment containment property}. + * The type of the created object is specified by the packageURI and typeName arguments. + * The specified type must be a compatible target for the property identified by propertyIndex. + * @param propertyIndex the index of the specified containment property. + * @param namespaceURI the namespace URI of the package containing the type of object to be created. + * @param typeName the name of a type in the specified package. + * @return the created data object. + * @see #createDataObject(int) + * @see DataGraph#getType + */ + DataObject createDataObject(int propertyIndex, String namespaceURI, String typeName); + + /** + * Returns a new {@link DataObject data object} contained by this object using the specified property, + * which must be of {@link Property#isContainment containment type}. + * The type of the created object is specified by the type argument, + * which must be a compatible target for the speicifed property. + * @param property a containment property of this object. + * @param type the type of object to be created. + * @return the created data object. + * @see #createDataObject(int) + */ + DataObject createDataObject(Property property, Type type); + + /** + * Remove this object from its container and then unset all its non-{@link Property#isReadOnly readOnly} Properties. + * If this object is contained by a {@link Property#isReadOnly readOnly} {@link Property#isContainment containment property}, its non-{@link Property#isReadOnly readOnly} Properties will be unset but the object will not be removed from its container. + * All DataObjects recursively contained by {@link Property#isContainment containment Properties} will also be deleted. + */ + void delete(); + + /** + * Returns the containing {@link DataObject data object} + * or null if there is no container. + * @return the containing data object or null. + */ + DataObject getContainer(); + + /** + * Return the Property of the {@link DataObject data object} containing this data object + * or null if there is no container. + * @return the property containing this data object. + */ + Property getContainmentProperty(); + + /** + * Returns the {@link DataGraph data graph} for this object or null if there isn't one. + * @return the containing data graph or null. + */ + DataGraph getDataGraph(); + + /** + * Returns the data object's type. + *

      + * The type defines the Properties available for reflective access. + * @return the type. + */ + Type getType(); + + /** + * Returns the Sequence for this DataObject. + * When getType().isSequencedType() == true, + * the Sequence of a DataObject corresponds to the + * XML elements representing the values of its Properties. + * Updates through DataObject and the Lists or Sequences returned + * from DataObject operate on the same data. + * When getType().isSequencedType() == false, null is returned. + * @return the Sequence or null. + */ + Sequence getSequence(); + + /** + * Returns a read-only List of the Properties currently used in this DataObject. + * This list will contain all of the Properties in getType().getProperties() + * and any Properties where isSet(property) is true. + * For example, Properties resulting from the use of + * open or mixed XML content are present if allowed by the Type. + * the List does not contain duplicates. + * The order of the Properties in the List begins with getType().getProperties() + * and the order of the remaining Properties is determined by the implementation. + * The same list will be returned unless the DataObject is updated so that + * the contents of the List change. + * @return the List of Properties currently used in this DataObject. + */ + List /* Property */ getInstanceProperties(); + + /** + * Returns the named Property from the current instance properties, + * or null if not found. The instance properties are getInstanceProperties(). + * @param propertyName the name of the Property + * @return the named Property from the DataObject's current instance properties, or null. + */ + Property getProperty(String propertyName); + + /** + * Returns the root {@link DataObject data object}. + * @return the root data object. + */ + DataObject getRootObject(); + + /** + * Returns the ChangeSummary with scope covering this dataObject, or null + * if there is no ChangeSummary. + * @return the ChangeSummary with scope covering this dataObject, or null. + */ + ChangeSummary getChangeSummary(); + + /** + * Removes this DataObject from its container, if any. + * Same as + * getContainer().getList(getContainmentProperty()).remove(this) or + * getContainer().unset(getContainmentProperty()) + * depending on getContainmentProperty().isMany() respectively. + */ + void detach(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Property.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Property.java new file mode 100644 index 0000000000..cc96e90b44 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Property.java @@ -0,0 +1,79 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo; + +import java.util.List; + +/** + * A representation of a Property in the {@link Type type} of a {@link DataObject data object}. + */ +public interface Property +{ + /** + * Returns the name of the Property. + * @return the Property name. + */ + String getName(); + + /** + * Returns the type of the Property. + * @return the Property type. + */ + Type getType(); + + /** + * Returns whether the Property is many-valued. + * @return true if the Property is many-valued. + */ + boolean isMany(); + + /** + * Returns whether the Property is containment, i.e., whether it represents by-value composition. + * @return true if the Property is containment. + */ + boolean isContainment(); + + /** + * Returns the containing type of this Property. + * @return the Property's containing type. + * @see Type#getProperties() + */ + Type getContainingType(); + + /** + * Returns the default value this Property will have in a {@link DataObject data object} where the Property hasn't been set. + * @return the default value. + */ + Object getDefault(); + + /** + * Returns true if values for this Property cannot be modified using the SDO APIs. + * When true, DataObject.set(Property property, Object value) throws an exception. + * Values may change due to other factors, such as services operating on DataObjects. + * @return true if values for this Property cannot be modified. + */ + boolean isReadOnly(); + + /** + * Returns the opposite Property if the Property is bi-directional or null otherwise. + * @return the opposite Property if the Property is bi-directional or null + */ + Property getOpposite(); + + /** + * Return a list of alias names for this Property. + * @return a list of alias names for this Property. + */ + List /*String*/ getAliasNames(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Sequence.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Sequence.java new file mode 100644 index 0000000000..b46a5be7e0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Sequence.java @@ -0,0 +1,131 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo; + +/** + * A sequence is a heterogeneous list of {@link Property properties} and corresponding values. + * It represents an ordered arbitrary mixture of data values from more than one property of a {@link DataObject data object}. + */ +public interface Sequence +{ + /** + * Returns the number of entries in the sequence. + * @return the number of entries. + */ + int size(); + + /** + * Returns the property for the given entry index. + * Returns null for mixed text entries. + * @param index the index of the entry. + * @return the property or null for the given entry index. + */ + Property getProperty(int index); + + /** + * Returns the property value for the given entry index. + * @param index the index of the entry. + * @return the value for the given entry index. + */ + Object getValue(int index); + + /** + * Sets the entry at a specified index to the new value. + * @param index the index of the entry. + * @param value the new value for the entry. + */ + Object setValue(int index, Object value); + + /** + * Adds a new entry with the specified property name and value + * to the end of the entries. + * @param propertyName the name of the entry's property. + * @param value the value for the entry. + */ + boolean add(String propertyName, Object value); + + /** + * Adds a new entry with the specified property index and value + * to the end of the entries. + * @param propertyIndex the index of the entry's property. + * @param value the value for the entry. + */ + boolean add(int propertyIndex, Object value); + + /** + * Adds a new entry with the specified property and value + * to the end of the entries. + * @param property the property of the entry. + * @param value the value for the entry. + */ + boolean add(Property property, Object value); + + /** + * Adds a new entry with the specified property name and value + * at the specified entry index. + * @param index the index at which to add the entry. + * @param propertyName the name of the entry's property. + * @param value the value for the entry. + */ + void add(int index, String propertyName, Object value); + + /** + * Adds a new entry with the specified property index and value + * at the specified entry index. + * @param index the index at which to add the entry. + * @param propertyIndex the index of the entry's property. + * @param value the value for the entry. + */ + void add(int index, int propertyIndex, Object value); + + /** + * Adds a new entry with the specified property and value + * at the specified entry index. + * @param index the index at which to add the entry. + * @param property the property of the entry. + * @param value the value for the entry. + */ + void add(int index, Property property, Object value); + + /** + * Removes the entry at the given entry index. + * @param index the index of the entry. + */ + void remove(int index); + + /** + * Moves the entry at fromIndex to toIndex. + * @param toIndex the index of the entry destination. + * @param fromIndex the index of the entry to move. + */ + void move(int toIndex, int fromIndex); + + /** + * Adds a new entry with the SDO text Property + * to the end of the Sequence. + * Same as add(property, text) where property is the SDO text Property. + * @param text value of the entry. + */ + void add(String text); + + /** + * Adds a new entry with the SDO text Property + * at the given index. + * Same as add(index, property, text) where property is the SDO text Property. + * @param index the index at which to add the entry. + * @param text value of the entry. + */ + void add(int index, String text); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Type.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Type.java new file mode 100644 index 0000000000..85d43aad60 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/Type.java @@ -0,0 +1,143 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo; + +import java.util.List; + +/** + * A representation of the type of a {@link Property property} of a {@link DataObject data object}. + */ +public interface Type +{ + /** + * Returns the name of the type. + * @return the type name. + */ + String getName(); + + /** + * Returns the namespace URI of the type. + * @return the namespace URI. + */ + String getURI(); + + /** + * Returns the Java class that this type represents. + * @return the Java class. + */ + Class getInstanceClass(); + + /** + * Returns whether the specified object is an instance of this type. + * @param object the object in question. + * @return true if the object is an instance. + * @see Class#isInstance + */ + boolean isInstance(Object object); + + /** + * Returns the List of the {@link Property Properties} of this type. + *

      + * The expression + *

      +   *   type.getProperties().indexOf(property)
      +   *
      + * yields the property's index relative to this type. + * As such, these expressions are equivalent: + *
      +   *    dataObject.{@link DataObject#get(int) get}(i)
      +   *    dataObject.{@link DataObject#get(Property) get}((Property)dataObject.getType().getProperties().get(i));
      +   *
      + *

      + * @return the Properties of the type. + * @see Property#getContainingType + */ + List /*Property*/ getProperties(); + + /** + * Returns from {@link #getProperties all the Properties} of this type, the one with the specified name. + * As such, these expressions are equivalent: + *
      +   *    dataObject.{@link DataObject#get(String) get}("name")
      +   *    dataObject.{@link DataObject#get(Property) get}(dataObject.getType().getProperty("name"))
      +   *
      + *

      + * @return the Property with the specified name. + * @see #getProperties + */ + Property getProperty(String propertyName); + + /** + * Indicates if this Type specifies DataTypes (true) or DataObjects (false). + * When false, any object that is an instance of this type + * also implements the DataObject interface. + * True for simple types such as Strings and numbers. + * For any object: + *
      +   *   isInstance(object) && !isDataType() implies
      +   *   DataObject.class.isInstance(object) returns true. 
      +   * 
      + * @return true if Type specifies DataTypes, false for DataObjects. + */ + boolean isDataType(); + + /** + * Indicates if this Type allows any form of open content. If false, + * dataObject.getInstanceProperties() must be the same as + * dataObject.getType().getProperties() for any DataObject dataObject of this Type. + * @return true if this Type allows open content. + */ + boolean isOpen(); + + /** + * Indicates if this Type specifies Sequenced DataObjects. + * Sequenced DataObjects are used when the order of values + * between Properties must be preserved. + * When true, a DataObject will return a Sequence. For example, + *
      +   *  Sequence elements = dataObject.{@link DataObject#getSequence() getSequence}();
      +   * 
      + * @return true if this Type specifies Sequenced DataObjects. + */ + boolean isSequenced(); + + /** + * Indicates if this Type is abstract. If true, this Type cannot be + * instantiated. Abstract types cannot be used in DataObject or + * DataFactory create methods. + * @return true if this Type is abstract. + */ + boolean isAbstract(); + + /** + * Returns the List of base Types for this Type. The List is empty + * if there are no base Types. XSD , , and + * Java extends keyword are mapped to this list. + * @return the List of base Types for this Type. + */ + List /*Type*/ getBaseTypes(); + + /** + * Returns the Properties declared in this Type as opposed to + * those declared in base Types. + * @return the Properties declared in this Type. + */ + List /*Property*/ getDeclaredProperties(); + + /** + * Return a list of alias names for this Type. + * @return a list of alias names for this Type. + */ + List /*String*/ getAliasNames(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/CopyHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/CopyHelper.java new file mode 100644 index 0000000000..f0bf98aada --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/CopyHelper.java @@ -0,0 +1,82 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo.helper; + +import commonj.sdo.DataObject; +import commonj.sdo.impl.HelperProvider; + +/** + * A helper for copying DataObjects. + */ +public interface CopyHelper +{ + /** + * Create a shallow copy of the DataObject dataObject: + * Creates a new DataObject copiedDataObject with the same values + * as the source dataObject for each property where + * property.getType().isDataType() is true. + * The value of such a Property property in copiedDataObject is: + * dataObject.get(property) for single-valued Properties + * (copiedDataObject.get(property) equals() dataObject.get(property)), or + * a List where each member is equal to the member at the + * same index in dataObject for multi-valued Properties + * copiedDataObject.getList(property).get(i) equals() dataObject.getList(property).get(i) + * The copied Object is unset for each Property where + * property.getType().isDataType() is false + * since they are not copied. + * Read-only properties are copied. + * A copied object shares metadata with the source object + * sourceDO.getType() == copiedDO.getType() + * If a ChangeSummary is part of the source DataObject + * the copy has a new, empty ChangeSummary. + * Logging state is the same as the source ChangeSummary. + * + * @param dataObject to be copied + * @return copy of dataObject + */ + DataObject copyShallow(DataObject dataObject); + + /** + * Create a deep copy of the DataObject tree: + * Copies the dataObject and all its {@link commonj.sdo.Property#isContainment() contained} + * DataObjects recursively. + * Values of Properties are copied as in shallow copy, + * and values of Properties where + * property.getType().isDataType() is false + * are copied where each value copied must be a + * DataObject contained by the source dataObject. + * If a DataObject is outside the DataObject tree and the + * property is bidirectional, then the DataObject is skipped. + * If a DataObject is outside the DataObject tree and the + * property is unidirectional, then the same DataObject is referenced. + * Read-only properties are copied. + * If any DataObject referenced is not in the containment + * tree an IllegalArgumentException is thrown. + * If a ChangeSummary is part of the copy tree the new + * ChangeSummary refers to objects in the new DataObject tree. + * Logging state is the same as the source ChangeSummary. + * + * @param dataObject to be copied. + * @return copy of dataObject + * @throws IllegalArgumentException if any referenced DataObject + * is not part of the containment tree. + */ + DataObject copy(DataObject dataObject); + + /** + * The default CopyHelper. + */ + CopyHelper INSTANCE = HelperProvider.getCopyHelper(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/DataFactory.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/DataFactory.java new file mode 100644 index 0000000000..fc9bf96ba4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/DataFactory.java @@ -0,0 +1,61 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo.helper; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.impl.HelperProvider; + +/** + * A Factory for creating DataObjects. + * The created DataObjects are not connected to any other DataObjects. + */ +public interface DataFactory +{ + /** + * Create a DataObject of the Type specified by typeName with the given package uri. + * @param uri The uri of the Type. + * @param typeName The name of the Type. + * @return the created DataObject. + * @throws IllegalArgumentException if the uri and typeName does + * not correspond to a Type this factory can instantiate. + */ + DataObject create(String uri, String typeName); + + /** + * Create a DataObject supporting the given interface. + * InterfaceClass is the interface for the DataObject's Type. + * The DataObject created is an instance of the interfaceClass. + * @param interfaceClass is the interface for the DataObject's Type. + * @return the created DataObject. + * @throws IllegalArgumentException if the instanceClass does + * not correspond to a Type this factory can instantiate. + */ + DataObject create(Class interfaceClass); + + /** + * Create a DataObject of the Type specified. + * @param type The Type. + * @return the created DataObject. + * @throws IllegalArgumentException if the Type + * cannot be instantiaed by this factory. + */ + DataObject create(Type type); + + /** + * The default DataFactory. + */ + DataFactory INSTANCE = HelperProvider.getDataFactory(); + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/DataHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/DataHelper.java new file mode 100644 index 0000000000..1a630e4118 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/DataHelper.java @@ -0,0 +1,184 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo.helper; + +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; + +import commonj.sdo.impl.HelperProvider; + +/** + * Data helper methods. + */ +public interface DataHelper +{ + /** + * Convert from a String representation of an SDO date type to a Date. + * @param dateString the String representation of an SDO date type + * @return a Date representation of an SDO date type. + * @throws IllegalArgumentException for invalid formats. + */ + Date toDate(String dateString); + + /** + * Convert from a String representation of an SDO date type to a Calendar using the + * default locale. Same as toCalendar(dateString, null). + * @param dateString the String representation of an SDO date type + * @return a Calendar representation of an SDO date type. + * @throws IllegalArgumentException for invalid formats. + */ + Calendar toCalendar(String dateString); + + /** + * Convert from a String representation of an SDO date type to a Calendar using the + * specified locale, or the default locale if the locale is null. + * @param dateString the String representation of an SDO date type + * @param locale the locale or null for default locale. + * @return a Calendar representation of an SDO date type. + * @throws IllegalArgumentException for invalid formats. + */ + Calendar toCalendar(String dateString, Locale locale); + + /** + * Convert from a Date to a String representation of the DateTime type. + * @param date the date + * @return a Date to a String representation of the DateTime type. + */ + String toDateTime(Date date); + + /** + * Convert from a Date to a String representation of the Duration type. + * @param date the date + * @return a Date to a String representation of the Duration type. + */ + String toDuration(Date date); + + /** + * Convert from a Date to a String representation of the Time type. + * @param date the date + * @return a Date to a String representation of the Time type. + */ + String toTime(Date date); + + /** + * Convert from a Date to a String representation of the Day type. + * @param date the date + * @return a Date to a String representation of the Day type. + */ + String toDay(Date date); + + /** + * Convert from a Date to a String representation of the Month type. + * @param date the date + * @return a Date to a String representation of the Month type. + */ + String toMonth(Date date); + + /** + * Convert from a Date to a String representation of the MonthDay type. + * @param date the date + * @return a Date to a String representation of the MonthDay type. + */ + String toMonthDay(Date date); + + /** + * Convert from a Date to a String representation of the Year type. + * @param date the date + * @return a Date to a String representation of the Year type. + */ + String toYear(Date date); + + /** + * Convert from a Date to a String representation of the YearMonth type. + * @param date the date + * @return a Date to a String representation of the YearMonth type. + */ + String toYearMonth(Date date); + + /** + * Convert from a Date to a String representation of the YearMonthDay type. + * @param date the date + * @return a Date to a String representation of the YearMonthDay type. + */ + String toYearMonthDay(Date date); + + /** + * Convert from a Calendar to a String representation of the DateTime type. + * @param calendar the calendar to convert + * @return a Calendar to a String representation of the DateTime type. + */ + String toDateTime(Calendar calendar); + + /** + * Convert from a Calendar to a String representation of the Duration type. + * @param calendar the calendar to convert + * @return a Calendar to a String representation of the Duration type. + */ + String toDuration(Calendar calendar); + + /** + * Convert from a Calendar to a String representation of the Time type. + * @param calendar the calendar to convert + * @return a Calendar to a String representation of the Time type. + */ + String toTime(Calendar calendar); + + /** + * Convert from a Calendar to a String representation of the Day type. + * @param calendar the calendar to convert + * @return a Calendar to a String representation of the Day type. + */ + String toDay(Calendar calendar); + + /** + * Convert from a Calendar to a String representation of the Month type. + * @param calendar the calendar to convert + * @return a Calendar to a String representation of the Month type. + */ + String toMonth(Calendar calendar); + + /** + * Convert from a Calendar to a String representation of the MonthDay type. + * @param calendar the calendar to convert + * @return a Calendar to a String representation of the MonthDay type. + */ + String toMonthDay(Calendar calendar); + + /** + * Convert from a Calendar to a String representation of the Year type. + * @param calendar the calendar to convert + * @return a Calendar to a String representation of the Year type. + */ + String toYear(Calendar calendar); + + /** + * Convert from a Calendar to a String representation of the YearMonth type. + * @param calendar the calendar to convert + * @return a Calendar to a String representation of the YearMonth type. + */ + String toYearMonth(Calendar calendar); + + /** + * Convert from a Calendar to a String representation of the YearMonthDay type. + * @param calendar the calendar to convert + * @return a Calendar to a String representation of the YearMonthDay type. + */ + String toYearMonthDay(Calendar calendar); + + /** + * The default TypeHelper. + */ + DataHelper INSTANCE = HelperProvider.getDataHelper(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/EqualityHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/EqualityHelper.java new file mode 100644 index 0000000000..6214020701 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/EqualityHelper.java @@ -0,0 +1,89 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo.helper; + +import commonj.sdo.DataObject; +import commonj.sdo.impl.HelperProvider; + +/** + * A helper for comparing DataObjects. + */ +public interface EqualityHelper +{ + /** + *

      Two DataObjects are equalShallow if + * they have the same {@link DataObject#getType Type} + * and all their compared Properties are equal. + * The set of Properties compared are the + * {@link DataObject#getInstanceProperties() instance properties} + * where property.getType().isDataType() is true + * and property.getType() is not ChangeSummaryType. + *
      Two of these Property values are equal if they are both not + * {@link DataObject#isSet(Property) set}, or set to an equal value + * dataObject1.get(property).equals(dataObject2.get(property)) + *
      If the type is a sequenced type, the sequence entries must be the same. + * For each entry x in the sequence where the property is used in the comparison, + * dataObject1.getSequence().getValue(x).equals( + * dataObject2.getSequence().getValue(x)) and + * dataObject1.getSequence().getProperty(x) == + * dataObject2.getSequence().getProperty(x) + * must be true. + *

      + * Returns true the objects have the same Type and all values of all compared Properties are equal. + * @param dataObject1 DataObject to be compared + * @param dataObject2 DataObject to be compared + * @return true the objects have the same Type and all values of all compared Properties are equal. + */ + boolean equalShallow(DataObject dataObject1, DataObject dataObject2); + + /** + *

      Two DataObjects are equal(Deep) if they are equalShallow, + * all their compared Properties are equal, and all reachable DataObjects in their + * graphs excluding containers are equal. + * The set of Properties compared are the + * {@link DataObject#getInstanceProperties() instance properties} + * where property.getType().isDataType() is false, + * and is not a container property, ie !property.getOpposite().isContainment() + *
      Two of these Property values are equal if they are both not + * {@link DataObject#isSet(Property) set}, or all the DataObjects + * they refer to are {@link #equal(DataObject, DataObject) equal} in the + * context of dataObject1 and dataObject2. + *
      Note that properties to a containing DataObject are not compared + * which means two DataObject trees can be equal even if their containers are not equal. + *
      If the type is a sequenced type, the sequence entries must be the same. + * For each entry x in the sequence where the property is used in the comparison, + * equal(dataObject1.getSequence().getValue(x), + * dataObject2.getSequence().getValue(x)) and + * dataObject1.getSequence().getProperty(x) == + * dataObject2.getSequence().getProperty(x) + * must be true. + *

      + * A DataObject directly or indirectly referenced by dataObject1 or dataObject2 + * can only be equal to exactly one DataObject directly or indirectly referenced + * by dataObject1 or dataObject2, respectively. + * This ensures that dataObject1 and dataObject2 are equal if the graph formed by + * all their referenced DataObjects have the same shape. + *

      + * Returns true if the trees of DataObjects are equal(Deep). + * @param dataObject1 DataObject to be compared + * @param dataObject2 DataObject to be compared + * @return true if the trees of DataObjects are equal(Deep). + */ + boolean equal(DataObject dataObject1, DataObject dataObject2); + + /** + * The default EqualityHelper. + */ + EqualityHelper INSTANCE = HelperProvider.getEqualityHelper(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/TypeHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/TypeHelper.java new file mode 100644 index 0000000000..13f013ed50 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/TypeHelper.java @@ -0,0 +1,70 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo.helper; + +import java.util.List; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.impl.HelperProvider; + +/** + * Look up a Type given the uri and typeName or interfaceClass. + * SDO Types are available through the + * getType("commonj.sdo", typeName) method. + * Defines Types from DataObjects. + */ +public interface TypeHelper +{ + /** + * Return the Type specified by typeName with the given uri, + * or null if not found. + * @param uri The uri of the Type - type.getURI(); + * @param typeName The name of the Type - type.getName(); + * @return the Type specified by typeName with the given uri, + * or null if not found. + */ + Type getType(String uri, String typeName); + + /** + * Return the Type for this interfaceClass or null if not found. + * @param interfaceClass is the interface for the DataObject's Type - + * type.getInstanceClass(); + * @return the Type for this interfaceClass or null if not found. + */ + Type getType(Class interfaceClass); + + /** + * Define the DataObject as a Type. + * The Type is available through TypeHelper and DataGraph getType() methods. + * @param type the DataObject representing the Type. + * @return the defined Type. + * @throws IllegalArgumentException if the Type could not be defined. + */ + Type define(DataObject type); + + /** + * Define the list of DataObjects as Types. + * The Types are available through TypeHelper and DataGraph getType() methods. + * @param types a List of DataObjects representing the Types. + * @return the defined Types. + * @throws IllegalArgumentException if the Types could not be defined. + */ + List /*Type*/ define(List /*DataObject*/ types); + + /** + * The default TypeHelper. + */ + TypeHelper INSTANCE = HelperProvider.getTypeHelper(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XMLDocument.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XMLDocument.java new file mode 100644 index 0000000000..3ef7fd70c8 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XMLDocument.java @@ -0,0 +1,152 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo.helper; + +import commonj.sdo.DataObject; + +/** + * Represents an XML Document containing a tree of DataObjects. + * + * An example XMLDocument fragment is: + * + * + * + * created from this XML Schema fragment: + * + * + * + * + * Upon loading this XMLDocument: + * DataObject is an instance of Type PurchaseOrderType. + * RootElementURI is null because the XSD has no targetNamespace URI. + * RootElementName is purchaseOrder. + * Encoding is null because the document did not specify an encoding. + * XMLDeclaration is true because the document contained an XML declaration. + * XMLVersion is 1.0 + * SchemaLocation and noNamespaceSchemaLocation are null because they are + * not specified in the document. + * + * When saving the root element, if the type of the root dataObject is not the + * type of global element specified by rootElementURI and rootElementName, + * or if a global element does not exist for rootElementURI and rootElementName, + * then an xsi:type declaration is written to record the root DataObject's Type. + * + * When loading the root element and an xsi:type declaration is found + * it is used as the type of the root DataObject. In this case, + * if validation is not being performed, it is not an error if the + * rootElementName is not a global element. + */ +public interface XMLDocument +{ + /** + * Return the root DataObject for the XMLDocument. + * @return root DataObject for the XMLDocument. + */ + DataObject getRootObject(); + + /** + * Return the targetNamespace URI for the root element. + * If there is no targetNamespace URI, the value is null. + * The root element is a global element of the XML Schema + * with a type compatible to the DataObject. + * @return the targetNamespace URI for the root element. + */ + String getRootElementURI(); + + /** + * Return the name of the root element. + * The root element is a global element of the XML Schema + * with a type compatible to the DataObject. + * @return the name of the root element. + */ + String getRootElementName(); + + /** + * Return the XML encoding of the document, or null if not specified. + * The default value is "UTF-8". + * Specification of other values is implementation-dependent. + * @return the XML encoding of the document, or null if not specified. + */ + String getEncoding(); + + /** + * Set the XML encoding of the document, or null if not specified. + * @param encoding + */ + void setEncoding(String encoding); + + /** + * Return the XML declaration of the document. If true, + * XMLHelper save() will produce a declaration of the form: + * + * Encoding will be suppressed if getEncoding() is null. + * The default value is true. + * @return the XML declaration of the document. + */ + boolean isXMLDeclaration(); + + /** + * Set the XML declaration version of the document. + * @param xmlDeclaration the XML declaration version of the document. + */ + void setXMLDeclaration(boolean xmlDeclaration); + + /** + * Return the XML version of the document, or null if not specified. + * The default value is "1.0". + * Specification of other values is implementation-dependent. + * @return the XML version of the document, or null if not specified. + */ + String getXMLVersion(); + + /** + * Set the XML version of the document, or null if not specified. + * @param xmlVersion the XML version of the document, or null if not specified. + */ + void setXMLVersion(String xmlVersion); + + /** + * Return the value of the schemaLocation declaration + * for the http://www.w3.org/2001/XMLSchema-instance namespace in the + * root element, or null if not present. + * @return the value of the schemaLocation declaration, + * or null if not present. + */ + String getSchemaLocation(); + + /** + * Sets the value of the schemaLocation declaration + * for the http://www.w3.org/2001/XMLSchema-instance namespace in the + * root element, or null if it should not be present. + * @param schemaLocation the value of the schemaLocation declaration, or null. + */ + void setSchemaLocation(String schemaLocation); + + /** + * Return the value of the noNamespaceSchemaLocation declaration + * for the http://www.w3.org/2001/XMLSchema-instance namespace in the + * root element, or null if not present. + * @return the value of the noNamespaceSchemaLocation declaration, + * or null if not present. + */ + String getNoNamespaceSchemaLocation(); + + /** + * Sets the value of the noNamespaceSchemaLocation declaration + * for the http://www.w3.org/2001/XMLSchema-instance namespace in the + * root element, or null if it should not be present. + * @param schemaLocation the value of the noNamespaceSchemaLocation declaration, or null. + */ + void setNoNamespaceSchemaLocation(String schemaLocation); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XMLHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XMLHelper.java new file mode 100644 index 0000000000..1d0c6ca127 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XMLHelper.java @@ -0,0 +1,167 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo.helper; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; + +import commonj.sdo.DataObject; +import commonj.sdo.impl.HelperProvider; + +/** + * A helper to convert XML documents into DataObects and + * DataObjects into XML documnets. + */ +public interface XMLHelper +{ + /** + * Creates and returns an XMLDocument from the input String. + * By default does not perform XSD validation. + * Same as + * load(new StringReader(inputString), null, null); + * + * @param inputString specifies the String to read from + * @return the new XMLDocument loaded + * @throws RuntimeException for errors in XML parsing or + * implementation-specific validation. + */ + XMLDocument load(String inputString); + + /** + * Creates and returns an XMLDocument from the inputStream. + * The InputStream will be closed after reading. + * By default does not perform XSD validation. + * Same as + * load(inputStream, null, null); + * + * @param inputStream specifies the InputStream to read from + * @return the new XMLDocument loaded + * @throws IOException for stream exceptions. + * @throws RuntimeException for errors in XML parsing or + * implementation-specific validation. + */ + XMLDocument load(InputStream inputStream) throws IOException; + + /** + * Creates and returns an XMLDocument from the inputStream. + * The InputStream will be closed after reading. + * By default does not perform XSD validation. + * @param inputStream specifies the InputStream to read from + * @param locationURI specifies the URI of the document for relative schema locations + * @param options implementation-specific options. + * @return the new XMLDocument loaded + * @throws IOException for stream exceptions. + * @throws RuntimeException for errors in XML parsing or + * implementation-specific validation. + */ + XMLDocument load(InputStream inputStream, String locationURI, Object options) throws IOException; + + /** + * Creates and returns an XMLDocument from the inputReader. + * The InputStream will be closed after reading. + * By default does not perform XSD validation. + * @param inputReader specifies the Reader to read from + * @param locationURI specifies the URI of the document for relative schema locations + * @param options implementation-specific options. + * @return the new XMLDocument loaded + * @throws IOException for stream exceptions. + * @throws RuntimeException for errors in XML parsing or + * implementation-specific validation. + */ + XMLDocument load(Reader inputReader, String locationURI, Object options) throws IOException; + + /** + * Returns the DataObject saved as an XML document with the specified root element. + * Same as + * StringWriter stringWriter = new StringWriter(); + * save(createDocument(dataObject, rootElementURI, rootElementName), + * stringWriter, null); + * stringWriter.toString(); + * + * @param dataObject specifies DataObject to be saved + * @param rootElementURI the Target Namespace URI of the root XML element + * @param rootElementName the Name of the root XML element + * @return the saved XML document as a string + * @throws IllegalArgumentException if the dataObject tree + * is not closed or has no container. + */ + String save(DataObject dataObject, String rootElementURI, String rootElementName); + + /** + * Saves the DataObject as an XML document with the specified root element. + * Same as + * save(createDocument(dataObject, rootElementURI, rootElementName), + * outputStream, null); + * + * @param dataObject specifies DataObject to be saved + * @param rootElementURI the Target Namespace URI of the root XML element + * @param rootElementName the Name of the root XML element + * @param outputStream specifies the OutputStream to write to. + * @throws IOException for stream exceptions. + * @throws IllegalArgumentException if the dataObject tree + * is not closed or has no container. + */ + void save(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream) throws IOException; + + /** + * Serializes an XMLDocument as an XML document into the outputStream. + * If the DataObject's Type was defined by an XSD, the serialization + * will follow the XSD. + * Otherwise the serialization will follow the format as if an XSD + * were generated as defined by the SDO specification. + * The OutputStream will be flushed after writing. + * Does not perform validation to ensure compliance with an XSD. + * @param xmlDocument specifies XMLDocument to be saved + * @param outputStream specifies the OutputStream to write to. + * @param options implementation-specific options. + * @throws IOException for stream exceptions. + * @throws IllegalArgumentException if the dataObject tree + * is not closed or has no container. + */ + void save(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException; + + /** + * Serializes an XMLDocument as an XML document into the outputWriter. + * If the DataObject's Type was defined by an XSD, the serialization + * will follow the XSD. + * Otherwise the serialization will follow the format as if an XSD + * were generated as defined by the SDO specification. + * The OutputStream will be flushed after writing. + * Does not perform validation to ensure compliance with an XSD. + * @param xmlDocument specifies XMLDocument to be saved + * @param outputWriter specifies the Writer to write to. + * @param options implementation-specific options. + * @throws IOException for stream exceptions. + * @throws IllegalArgumentException if the dataObject tree + * is not closed or has no container. + */ + void save(XMLDocument xmlDocument, Writer outputWriter, Object options) throws IOException; + + /** + * Creates an XMLDocument with the specified XML rootElement for the DataObject. + * @param dataObject specifies DataObject to be saved + * @param rootElementURI the Target Namespace URI of the root XML element + * @param rootElementName the Name of the root XML element + * @return XMLDocument a new XMLDocument set with the specified parameters. + */ + XMLDocument createDocument(DataObject dataObject, String rootElementURI, String rootElementName); + + /** + * The default XMLHelper. + */ + XMLHelper INSTANCE = HelperProvider.getXMLHelper(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XSDHelper.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XSDHelper.java new file mode 100644 index 0000000000..7b4a99493c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/helper/XSDHelper.java @@ -0,0 +1,193 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo.helper; + +import java.io.InputStream; +import java.io.Reader; +import java.util.List; +import java.util.Map; + +import commonj.sdo.Property; +import commonj.sdo.Type; +import commonj.sdo.impl.HelperProvider; + +/** + * Provides access to additional information when the + * Type or Property is defined by an XML Schema (XSD). + * Methods return null/false otherwise or if the information is unavailable. + * Defines Types from an XSD. +*/ +public interface XSDHelper +{ + /** + * Returns the local name as declared in the XSD. + * @param type to return local name for. + * @return the local name as declared in the XSD. + */ + String getLocalName(Type type); + + /** + * Returns the local name as declared in the XSD. + * @param property to return local name for. + * @return the local name as declared in the XSD. + */ + String getLocalName(Property property); + + /** + * Returns the namespace URI as declared in the XSD. + * @param property to return namespace URI for. + * @return the namespace URI as declared in the XSD. + */ + String getNamespaceURI(Property property); + + /** + * Returns true if the property is declared as an attribute in the XSD. + * Returns false if not known or for advanced cases. + * It is possible for both isAttribute and isElement to return false + * but they will not both return true. + * @param property to identify if an attribute. + * @return true if the property is declared as an attribute in the XSD. + */ + boolean isAttribute(Property property); + + /** + * Returns true if the property is declared as an element in the XSD. + * Returns false if not known or for advanced cases. + * It is possible for both isAttribute and isElement to return false + * but they will not both return true. + * @param property to identify if an element. + * @return true if the property is declared as an element in the XSD. + */ + boolean isElement(Property property); + + /** + * Returns true if the Type is declared to contain mixed content. + * A DataObject's mixed content values are typically accessed via a Sequence. + * @param type to identify if mixed content. + * @return true if the Type is declared to contain mixed content. + */ + boolean isMixed(Type type); + + /** + * Indicates if this helper contains XSD information for the specified type. + * @param type the type. + * @return true if this helper contains XSD information for the specified type. + */ + boolean isXSD(Type type); + + /** + * Returns the Property defined by the named global element or attribute + * in the targetNamespace uri, or null if not found. + * @param uri The uri of the targetNamespace. + * @param propertyName The name of the global property. + * @param isElement is true for global elements, false for global attributes. + * @return the Property defined by the named global element or attribute + * in the targetNamespace uri, or null if not found. + */ + Property getGlobalProperty(String uri, String propertyName, boolean isElement); + + /** + * Return the appinfo declared for this Type and source. + * The appinfo start and end tags and content are returned. + * The xml namespace context is preserved in the appinfo element. + * If more than one appinfo with the same source is declared on the same + * Type their contents are concatenated. + * @param type the type with the appinfo declaration + * @param source the source of the appinfo declaration. + * @return the appinfo declared for this Type and source. + */ + String getAppinfo(Type type, String source); + + /** + * Return the content of the appinfo declared for this Property and source. + * If the property is defined by ref= the appinfo of the referenced + * element or attribute is included. + * The appinfo start and end tags and content are returned. + * The xml namespace context is preserved in the appinfo element. + * If more than one appinfo with the same source is declared on the same + * Type their contents are concatenated. + * @param property the Property with the appinfo declaration + * @param source the source of the appinfo declaration. + * @return the appinfo declared for this Property and source. + */ + String getAppinfo(Property property, String source); + + /** + * Define the XML Schema as Types. + * The Types are available through TypeHelper and DataGraph getType() methods. + * Same as define(new StringReader(xsd), null) + * @param xsd the XML Schema. + * @return the defined Types. + * @throws IllegalArgumentException if the Types could not be defined. + */ + List /*Type*/ define(String xsd); + + /** + * Define XML Schema as Types. + * The Types are available through TypeHelper and DataGraph getType() methods. + * @param xsdReader reader to an XML Schema. + * @param schemaLocation the URI of the location of the schema, used + * for processing relative imports and includes. May be null if not used. + * @return the defined Types. + * @throws IllegalArgumentException if the Types could not be defined. + */ + List /*Type*/ define(Reader xsdReader, String schemaLocation); + + /** + * Define XML Schema as Types. + * The Types are available through TypeHelper and DataGraph getType() methods. + * @param xsdInputStream input stream to an XML Schema. + * @param schemaLocation the URI of the location of the schema, used + * for processing relative imports and includes. May be null if not used. + * @return the defined Types. + * @throws IllegalArgumentException if the Types could not be defined. + */ + List /*Type*/ define(InputStream xsdInputStream, String schemaLocation); + + /** + * Generate an XML Schema Declaration (XSD) from Types. + * Same as generate(types, null); + * @param types a List containing the Types + * @return a String containing the generated XSD. + * @throws IllegalArgumentException if the XSD could not be generated. + */ + String generate(List /*Type*/ types); + + /** + * Generate an XML Schema Declaration (XSD) from Types. + * Round trip from SDO to XSD to SDO is supported. + * Round trip from XSD to SDO to XSD is not supported. + * Use the original schema if one exists instead of generating a new one, as + * the generated XSD validates a different set of documents than the original XSD. + * Generating an XSD does not affect the XSDHelper or the Types. + * The Types must all have the same URI. + * The result is a String containing the generated XSD. + * All Types referenced with the same URI will be generated in the XSD + * and the list will be expanded to include all types generated. + * Any Types referenced with other URIs will cause + * imports to be produced as appropriate. + * Imports will include a schemaLocation if a Map is provided with an entry + * of the form key=import target namespace, value=schemaLocation + * @param types a List containing the Types + * @param namespaceToSchemaLocation map of target namespace to schema locations or null + * @return a String containing the generated XSD. + * @throws IllegalArgumentException if the XSD could not be generated. + */ + String generate(List /*Type*/ types, Map /*String, String*/ namespaceToSchemaLocation); + + /** + * The default XSDHelper. + */ + XSDHelper INSTANCE = HelperProvider.getXSDHelper(); +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/ExternalizableDelegator.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/ExternalizableDelegator.java new file mode 100644 index 0000000000..886138d3a5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/ExternalizableDelegator.java @@ -0,0 +1,87 @@ +/** + * + * + * Service Data Objects + * Version 2.0 + * Licensed Materials - Property of BEA and IBM + * + * (c) Copyright BEA Systems, Inc. and International Business Machines Corp 2005. All rights reserved. + * + * + * + */ + +package commonj.sdo.impl; + +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.io.ObjectStreamException; + +/** + * Delegates DataObject serialization while ensuring implementation independent + * java.io.Serialization. An implementation of DataObject + * returns an ExternalizableDelegator from its writeReplace() method. + * + * The root DataObject is the object returned from do.getRootObject() where + * do is the DataObject being serialized in a java.io.ObjectOutputStream. + * When do.getContainer() == null then do is a root object. + * + * The byte format for each DataObject in the stream is: + * [0] [path] [root] // when do is not a root object + * [1] [rootXML] // when do is a root object + * + * where: + * [0] is the byte 0, serialized using writeByte(0). + * [1] is the byte 1, serialized using writeByte(1). + * + * [path] is an SDO path expression from the root DataObject to the serialized + * DataObject such that root.getDataObject(path) == do. + * Serialized using writeUTF(path). + * + * [root] is the root object serialized using writeObject(root). + * + * [rootXML] is the GZip of the XML serialization of the root DataObject. + * The XML serialization is the same as + * XMLHelper.INSTANCE.save(root, "commonj.sdo", "dataObject", stream); + * where stream is a GZIPOutputStream, length is the number of bytes + * in the stream, and bytes are the contents of the stream. + * Serialized using writeInt(length), write(bytes). + * + */ +public class ExternalizableDelegator implements Externalizable +{ + public interface Resolvable extends Externalizable + { + Object readResolve() throws ObjectStreamException; + } + + static final long serialVersionUID = 1; + transient Resolvable delegate; + + public ExternalizableDelegator() + { + delegate = HelperProvider.createResolvable(); + } + + public ExternalizableDelegator(Object target) + { + delegate = HelperProvider.createResolvable(target); + } + + public void writeExternal(ObjectOutput out) throws IOException + { + delegate.writeExternal(out); + } + + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException + { + delegate.readExternal(in); + } + + public Object readResolve() throws ObjectStreamException + { + return delegate.readResolve(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/HelperProvider.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/HelperProvider.java new file mode 100644 index 0000000000..f250a1dc8a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/HelperProvider.java @@ -0,0 +1,364 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package commonj.sdo.impl; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.security.AccessController; +import java.security.PrivilegedAction; + +import commonj.sdo.helper.CopyHelper; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.DataHelper; +import commonj.sdo.helper.EqualityHelper; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; + +/** + * A HelperProvider obtains specific default helpers and other + * implementation-specific objects used by a Java implementation of SDO. + * + * @version $Rev$ $Date$ + */ +public abstract class HelperProvider { + /** + * The default HelperProvider INSTANCE. This is located using the ClassLoader used + * to load the HelperProvider class itself and if no default implementation is available + * this field will be set to null. + */ + public static final HelperProvider INSTANCE; + + /** + * The name of the resource that is used for service location. + */ + public static final String SERVICE_RESOURCE_NAME = "META-INF/services/commonj.sdo.impl.HelperProvider"; + + /** + * The name of the system property that will be checked for an implementation name. + */ + public static final String PROPERTY_NAME = "commonj.sdo.impl.HelperProvider"; + + static { + // initialize the default instance using this class's classloader + // set to null if none could be located (implies no default implementation) + HelperProvider provider; + try { + provider = getInstance(HelperProvider.class.getClassLoader()); + } catch (NoHelperProviderException e) { + provider = null; + } + INSTANCE = provider; + } + + /** + * Locate and instantiate a HelperProvider. + *

      + * Attempt to locate a HelperProvider using first the Thread's current context classloader and then, + * if that is not set, not readable, or does not provide an implementation, using the classloader + * used to load the HelperProvider class itself. + *

      + * A new instance is returned for each sucessful invocation. + * + * @return an implementation of HelperProvider + * @throws NoHelperProviderException if no provider implementation was defined or it could not be instantiated + */ + public static HelperProvider getInstance() throws NoHelperProviderException { + String implName = getImplementationName(); + + ClassLoader cl = getContextClassLoader(); + if (cl != null) { + HelperProvider provider = loadImplementation(cl, implName); + if (provider != null) { + return provider; + } + } + + cl = HelperProvider.class.getClassLoader(); + HelperProvider provider = loadImplementation(cl, implName); + if (provider != null) { + return provider; + } + + throw new NoHelperProviderException(implName); + } + + + /** + * Locate and instantiate a HelperProvider using the supplied ClassLoader. + *

      + * The name of the implementation to use is determined by the value of the "commonj.sdo.impl.HelperProvider" + * system property. If this is not set or this code does not have permission to read it then the name + * will be retrieved from the META-INF/services/commonj.sdo.impl.HelperProvider resource as returned + * by the supplied classloader as described in the + * JAR file specification. + *

      + * A new instance is returned for each sucessful invocation. + * + * @param cl the classloader to use to locate and instantiate the implementation + * @return the specified implementation of HelperProvider + * @throws NoHelperProviderException if no provider implementation was defined or it could not be instantiated + */ + public static HelperProvider getInstance(ClassLoader cl) throws NoHelperProviderException { + String implName = getImplementationName(); + HelperProvider provider = loadImplementation(cl, implName); + if (provider == null) { + throw new NoHelperProviderException(implName); + } + return provider; + } + + private static ClassLoader getContextClassLoader() { + try { + return (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return Thread.currentThread().getContextClassLoader(); + } + }); + } catch (SecurityException e) { + return null; + } + } + + private static HelperProvider loadImplementation(ClassLoader cl, String implName) throws NoHelperProviderException { + // if no name is requested, locate using the supplied classloader + if (implName == null) { + implName = getImplementationName(cl); + } + // no implementation to try, return null + if (implName == null) { + return null; + } + + // try an instantiate the implementation + try { + return (HelperProvider) cl.loadClass(implName).newInstance(); + } catch (InstantiationException e) { + throw new NoHelperProviderException(implName, e); + } catch (IllegalAccessException e) { + throw new NoHelperProviderException(implName, e); + } catch (ClassNotFoundException e) { + throw new NoHelperProviderException(implName, e); + } + } + + private static String getImplementationName() { + try { + return (String)AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + return System.getProperty(PROPERTY_NAME); + } + }); + } catch (SecurityException e) { + return null; + } + } + + private static String getImplementationName(ClassLoader cl) { + InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME); + if (is == null) { + return null; + } + + InputStreamReader in; + try { + in = new InputStreamReader(is, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new AssertionError("UTF-8 encoding not available"); + } + + try { + BufferedReader reader = new BufferedReader(in, 128); + try { + String line; + while ((line = reader.readLine()) != null) { + int i = line.indexOf('#'); + if (i != -1) { + line = line.substring(0, i); + } + line = line.trim(); + if (line.length() > 0) { + return line; + } + } + return null; + } finally { + reader.close(); + } + } catch (IOException e) { + throw new NoHelperProviderException(e); + } + } + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // implementation specific methods for users that don't want to use the default implementation + + /** + * Returns a CopyHelper obtained from this implementation. + * + * @return a CopyHelper obtained from this implementation + */ + public abstract CopyHelper copyHelper(); + + /** + * Returns a DataFactory obtained from this implementation. + * + * @return a DataFactory obtained from this implementation + */ + public abstract DataFactory dataFactory(); + + /** + * Returns a DataHelper obtained from this implementation. + * + * @return a DataHelper obtained from this implementation + */ + public abstract DataHelper dataHelper(); + + /** + * Returns a EqualityHelper obtained from this implementation. + * + * @return a EqualityHelper obtained from this implementation + */ + public abstract EqualityHelper equalityHelper(); + + /** + * Returns a TypeHelper obtained from this implementation. + * + * @return a TypeHelper obtained from this implementation + */ + public abstract TypeHelper typeHelper(); + + /** + * Returns a XMLHelper obtained from this implementation. + * + * @return a XMLHelper obtained from this implementation + */ + public abstract XMLHelper xmlHelper(); + + /** + * Returns a XSDHelper obtained from this implementation. + * + * @return a XSDHelper obtained from this implementation + */ + public abstract XSDHelper xsdHelper(); + + /** + * Create a Resolvable using this implementation + * + * @return a Resolvable created using this implementation + */ + public abstract ExternalizableDelegator.Resolvable resolvable(); + + /** + * Create a Resolvable using this implementation + * + * @param target the object to be resolved + * @return a Resolvable created using this implementation + */ + public abstract ExternalizableDelegator.Resolvable resolvable(Object target); + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // static helper methods required by the specification + + /** + * Returns a CopyHelper obtained from the default HelperProvider. + * + * @return a CopyHelper obtained from the default HelperProvider + */ + public static CopyHelper getCopyHelper() { + return INSTANCE.copyHelper(); + } + + /** + * Returns a DataFactory obtained from the default HelperProvider. + * + * @return a DataFactory obtained from the default HelperProvider + */ + public static DataFactory getDataFactory() { + return INSTANCE.dataFactory(); + } + + /** + * Returns a DataHelper obtained from the default HelperProvider. + * + * @return a DataHelper obtained from the default HelperProvider + */ + public static DataHelper getDataHelper() { + return INSTANCE.dataHelper(); + } + + /** + * Returns a EqualityHelper obtained from the default HelperProvider. + * + * @return a EqualityHelper obtained from the default HelperProvider + */ + public static EqualityHelper getEqualityHelper() { + return INSTANCE.equalityHelper(); + } + + /** + * Returns a TypeHelper obtained from the default HelperProvider. + * + * @return a TypeHelper obtained from the default HelperProvider + */ + public static TypeHelper getTypeHelper() { + return INSTANCE.typeHelper(); + } + + /** + * Returns a XMLHelper obtained from the default HelperProvider. + * + * @return a XMLHelper obtained from the default HelperProvider + */ + public static XMLHelper getXMLHelper() { + return INSTANCE.xmlHelper(); + } + + /** + * Returns a XSDHelper obtained from the default HelperProvider. + * + * @return a XSDHelper obtained from the default HelperProvider + */ + public static XSDHelper getXSDHelper() { + return INSTANCE.xsdHelper(); + } + + /** + * Create a Resolvable using the default HelperProvider + * + * @return a Resolvable created using the default HelperProvider + */ + public static ExternalizableDelegator.Resolvable createResolvable() { + return INSTANCE.resolvable(); + } + + /** + * Create a Resolvable using the default HelperProvider + * + * @param target the object to be resolved + * @return a Resolvable created using the default HelperProvider + */ + public static ExternalizableDelegator.Resolvable createResolvable(Object target) { + return INSTANCE.resolvable(target); + } +} \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/NoHelperProviderException.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/NoHelperProviderException.java new file mode 100644 index 0000000000..47e6059f49 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/java/commonj/sdo/impl/NoHelperProviderException.java @@ -0,0 +1,55 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package commonj.sdo.impl; + +/** + * Exception indicating that a HelperProvider could not be located or instantiated. + * The message will be set to the name of the implementation class; a null value + * indicates that the name of the implementation could not be determined. + * The cause will be set to the Throwable that prevented the provider from being + * located or created. + * + * @version $Revision$ $Date$ + */ +public class NoHelperProviderException extends RuntimeException { + private static final long serialVersionUID = 727646133930924084L; + + public NoHelperProviderException() { + } + + public NoHelperProviderException(String message) { + super(message); + } + + public NoHelperProviderException(String message, Throwable cause) { + super(message, cause); + } + + public NoHelperProviderException(Throwable cause) { + super(cause); + } + + /** + * Return the name of the implementation class that could not be provided. + * + * @return the name of the implementation class; may be null if not known + */ + public String getImplementationName() { + return getMessage(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/MANIFEST.MF b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..4a1be53389 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Extension-Name: sdo-api +Specification-Title: SDO API +Specification-Vendor: Apache Software Foundation +Implementation-Vendor: Apache Software Foundation +Implementation-Vendor-Id: org.apache +Implementation-Title: sdo-api +Implementation-Version: incubating-M1 +Bundle-ManifestVersion: 2 +Bundle-Name: SDO API +Bundle-SymbolicName: org.apache.tuscany.sdo.spec +Bundle-Version: 1.0.0 +Bundle-Vendor: Apache Software Foundation +Export-Package: commonj.sdo, + commonj.sdo.helper, + commonj.sdo.impl diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/datagraph.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/datagraph.xsd new file mode 100644 index 0000000000..30727473a0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/datagraph.xsd @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Expected type is emof:Package. + + + + + + + + + + + Expected type is xsd:schema. + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoJava.xml b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoJava.xml new file mode 100644 index 0000000000..08c3b9734c --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoJava.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoJava.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoJava.xsd new file mode 100644 index 0000000000..094a705aa5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoJava.xsd @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoModel.xml b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoModel.xml new file mode 100644 index 0000000000..fcd1a4e283 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoModel.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoModel.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoModel.xsd new file mode 100644 index 0000000000..a041c9e02b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoModel.xsd @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoXML.xml b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoXML.xml new file mode 100644 index 0000000000..ac831576fb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoXML.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoXML.xsd b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoXML.xsd new file mode 100644 index 0000000000..88fc7daaf6 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/main/resources/xml/sdoXML.xsd @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/commonj/sdo/impl/HelperProviderTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/commonj/sdo/impl/HelperProviderTestCase.java new file mode 100644 index 0000000000..8854e936b7 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/commonj/sdo/impl/HelperProviderTestCase.java @@ -0,0 +1,90 @@ +/** + * + * Copyright 2005 International Business Machines Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package commonj.sdo.impl; + +import java.net.URL; +import java.net.URLClassLoader; + +import junit.framework.TestCase; +import test.DefaultHelperProvider; +import test.TCCL1HelperProvider; + +/** + * @version $Revision$ $Date$ + */ +public class HelperProviderTestCase extends TestCase { + private URL classes; + private URL testClasses; + private URL def; + private URL tccl1; + + public void testInstanceIsNullWithNoImplementation() throws Exception { + assertNull(HelperProvider.INSTANCE); + } + + public void testDefaultInstance() throws Exception { + ClassLoader cl = new URLClassLoader(new URL[]{classes, def, testClasses}, null); + Class providerClass = cl.loadClass(HelperProvider.class.getName()); + Class implClass = cl.loadClass(DefaultHelperProvider.class.getName()); + Object instance = providerClass.getField("INSTANCE").get(null); + assertNotNull(instance); + assertEquals(implClass, instance.getClass()); + } + + public void testLocateFromClassLoader() throws Exception { + ClassLoader cl = new URLClassLoader(new URL[]{classes, tccl1, testClasses}, null); + Class providerClass = cl.loadClass(HelperProvider.class.getName()); + Object provider = providerClass.getMethod("getInstance", new Class[] {ClassLoader.class}) + .invoke(null, new Object[] {cl}); + assertNotNull(provider); + assertEquals(TCCL1HelperProvider.class.getName(), provider.getClass().getName()); + } + + public void testThreadContextInstance() throws Exception { + ClassLoader cl = new URLClassLoader(new URL[]{classes, tccl1, testClasses}, null); + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(cl); + Class providerClass = cl.loadClass(HelperProvider.class.getName()); + Object provider = providerClass.getMethod("getInstance", new Class[0]).invoke(null, new Object[0]); + assertNotNull(provider); + assertEquals(TCCL1HelperProvider.class.getName(), provider.getClass().getName()); + } finally { + Thread.currentThread().setContextClassLoader(tccl); + } + + } + + public void testSystemProperty() { + System.setProperty("commonj.sdo.impl.HelperProvider", "test.TCCL1HelperProvider"); + try { + HelperProvider provider = HelperProvider.getInstance(); + assertNotNull(provider); + assertEquals(TCCL1HelperProvider.class, provider.getClass()); + } finally { + System.getProperties().remove("commonj.sdo.impl.HelperProvider"); + } + } + + protected void setUp() throws Exception { + super.setUp(); + classes = new URL(HelperProvider.class.getResource("HelperProvider.class"), "../../.."); + testClasses = new URL(HelperProviderTestCase.class.getResource("HelperProviderTestCase.class"), "../../.."); + tccl1 = new URL(testClasses, "tccl1/"); + def = new URL(testClasses, "default/"); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/test/DefaultHelperProvider.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/test/DefaultHelperProvider.java new file mode 100644 index 0000000000..96e8754a34 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/test/DefaultHelperProvider.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package test; + +import commonj.sdo.impl.HelperProvider; +import commonj.sdo.impl.ExternalizableDelegator; +import commonj.sdo.helper.CopyHelper; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.DataHelper; +import commonj.sdo.helper.EqualityHelper; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; + +/** + * @version $Revision$ $Date$ + */ +public class DefaultHelperProvider extends HelperProvider { + public CopyHelper copyHelper() { + throw new UnsupportedOperationException(); + } + + public DataFactory dataFactory() { + throw new UnsupportedOperationException(); + } + + public DataHelper dataHelper() { + throw new UnsupportedOperationException(); + } + + public EqualityHelper equalityHelper() { + throw new UnsupportedOperationException(); + } + + public TypeHelper typeHelper() { + throw new UnsupportedOperationException(); + } + + public XMLHelper xmlHelper() { + throw new UnsupportedOperationException(); + } + + public XSDHelper xsdHelper() { + throw new UnsupportedOperationException(); + } + + public ExternalizableDelegator.Resolvable resolvable() { + throw new UnsupportedOperationException(); + } + + public ExternalizableDelegator.Resolvable resolvable(Object target) { + throw new UnsupportedOperationException(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/test/TCCL1HelperProvider.java b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/test/TCCL1HelperProvider.java new file mode 100644 index 0000000000..0055e00002 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/java/test/TCCL1HelperProvider.java @@ -0,0 +1,68 @@ +/** + * + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package test; + +import commonj.sdo.impl.HelperProvider; +import commonj.sdo.impl.ExternalizableDelegator; +import commonj.sdo.helper.CopyHelper; +import commonj.sdo.helper.DataFactory; +import commonj.sdo.helper.DataHelper; +import commonj.sdo.helper.EqualityHelper; +import commonj.sdo.helper.TypeHelper; +import commonj.sdo.helper.XMLHelper; +import commonj.sdo.helper.XSDHelper; + +/** + * @version $Revision$ $Date$ + */ +public class TCCL1HelperProvider extends HelperProvider { + public CopyHelper copyHelper() { + throw new UnsupportedOperationException(); + } + + public DataFactory dataFactory() { + throw new UnsupportedOperationException(); + } + + public DataHelper dataHelper() { + throw new UnsupportedOperationException(); + } + + public EqualityHelper equalityHelper() { + throw new UnsupportedOperationException(); + } + + public TypeHelper typeHelper() { + throw new UnsupportedOperationException(); + } + + public XMLHelper xmlHelper() { + throw new UnsupportedOperationException(); + } + + public XSDHelper xsdHelper() { + throw new UnsupportedOperationException(); + } + + public ExternalizableDelegator.Resolvable resolvable() { + throw new UnsupportedOperationException(); + } + + public ExternalizableDelegator.Resolvable resolvable(Object target) { + throw new UnsupportedOperationException(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/resources/default/META-INF/services/commonj.sdo.impl.HelperProvider b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/resources/default/META-INF/services/commonj.sdo.impl.HelperProvider new file mode 100644 index 0000000000..5175e5abea --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/resources/default/META-INF/services/commonj.sdo.impl.HelperProvider @@ -0,0 +1,3 @@ +# test comment and blank line + + test.DefaultHelperProvider # comment diff --git a/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/resources/tccl1/META-INF/services/commonj.sdo.impl.HelperProvider b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/resources/tccl1/META-INF/services/commonj.sdo.impl.HelperProvider new file mode 100644 index 0000000000..c7f46ba91e --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/spec/sdo/src/test/resources/tccl1/META-INF/services/commonj.sdo.impl.HelperProvider @@ -0,0 +1 @@ +test.TCCL1HelperProvider \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/pom.xml new file mode 100644 index 0000000000..704ad5825d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/pom.xml @@ -0,0 +1,52 @@ + + + + + org.apache.tuscany + tuscany-testing-interop + incubating-M1 + + + 4.0.0 + tuscany-interop-clients + pom + Tuscany Interop Testing - Clients + incubating-M1 + + + webserviceInteropDoc + webserviceSOAPRound2 + webserviceXSQ + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*TestCase.java + + brief + false + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/pom.xml new file mode 100644 index 0000000000..ccac1fc2a5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/pom.xml @@ -0,0 +1,99 @@ + + + + + org.apache.tuscany + tuscany-interop-clients + incubating-M1 + + + 4.0.0 + interop-client-webserviceInteropDoc + jar + Tuscany Interop Testing - Clients - InteropDoc + incubating-M1 + + + axis2 + + + + + junit + junit + 3.8.1 + test + + + org.apache.tuscany + tuscany-core + ${pom.version} + compile + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + compile + + + org.apache.tuscany.sca.bindings + tuscany-binding-${ws.type} + ${pom.version} + compile + + + + + + + org.apache.tuscany + tuscany-sdo-plugin + + + + ${basedir}/src/main/resources/wsdl/interopdoc.wsdl + true + true + true + true + + + generate + + + + + + org.apache.tuscany.sca.plugins + tuscany-plugin-wsdl2java + + + + ${basedir}/src/main/resources/wsdl/interopdoc.wsdl + org.soapinterop + + + generate + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java new file mode 100644 index 0000000000..b26344372f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/client/LoopbackInteropDocServiceComponentImpl.java @@ -0,0 +1,47 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.test.interop.client; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; +import org.soapinterop.ComplexDocument; +import org.soapinterop.DocTestPortType; +import org.soapinterop.SimpleDocument1; +import org.soapinterop.SingleTag; + +/** + * This class implements the DocTest service component. + */ +@Service(DocTestPortType.class) +//FIXME workaround for JIRA TUSCANY-41 +@Scope("MODULE") +public class LoopbackInteropDocServiceComponentImpl implements DocTestPortType { + + public ComplexDocument ComplexDocument(ComplexDocument param0) throws RemoteException { + return param0; + } + + public SimpleDocument1 SimpleDocument(SimpleDocument1 param4) throws RemoteException { + return param4; + } + + public SingleTag SingleTag(SingleTag param2) throws RemoteException { + return param2; + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/sca.module new file mode 100644 index 0000000000..f55c50f43f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/sca.module @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl new file mode 100644 index 0000000000..2477be396b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java new file mode 100644 index 0000000000..a23979f39d --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceInteropDoc/src/test/java/org/apache/tuscany/test/interop/client/InteropDocClientTestCase.java @@ -0,0 +1,149 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.test.interop.client; + +import java.rmi.RemoteException; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.soapinterop.ArrayOfSimpleDocument; +import org.soapinterop.ChildDocument; +import org.soapinterop.ComplexDocument; +import org.soapinterop.DocTestPortType; +import org.soapinterop.SimpleDocument; +import org.soapinterop.SimpleDocument1; +import org.soapinterop.SingleTag; + +import commonj.sdo.helper.DataFactory; + +public class InteropDocClientTestCase extends TestCase { + + private TuscanyRuntime tuscany; + private DataFactory dataFactory; + private DocTestPortType interopDoc; + private ClassLoader oldCL; + + public void testSingleTag() throws RemoteException { + + // Create the input + SingleTag input=(SingleTag)dataFactory.create(SingleTag.class); + + // Invoke the service + SingleTag output=interopDoc.SingleTag(input); + + // Test the results + assertNotNull(output); + + } + + public void testSimpleDocument() throws RemoteException { + + // Create the input + SimpleDocument1 input=(SimpleDocument1)dataFactory.create(SimpleDocument1.class); + input.setValue("123"); + + // Invoke the service + SimpleDocument1 output=interopDoc.SimpleDocument(input); + + // Test the results + assertNotNull(output); + assertEquals("123", output.getValue()); + + } + + public void testComplexDocument() throws RemoteException { + + // Create the input + ComplexDocument input = (ComplexDocument)dataFactory.create(ComplexDocument.class); + input.setAnAttribute("789"); + ChildDocument childDocument = (ChildDocument)dataFactory.create(ChildDocument.class); + SimpleDocument simpleDocument = (SimpleDocument)dataFactory.create(SimpleDocument.class);; + SimpleDocument1 simpleDocument1 = (SimpleDocument1)dataFactory.create(SimpleDocument1.class);; + simpleDocument.setSimpleDocument(simpleDocument1); + simpleDocument1.setValue("456"); + ArrayOfSimpleDocument arrayOfSimpleDocument = (ArrayOfSimpleDocument)dataFactory.create(ArrayOfSimpleDocument.class);; + arrayOfSimpleDocument.getSimpleDocument().add(simpleDocument1); + childDocument.setChildSimpleDoc(arrayOfSimpleDocument); + input.setChild(childDocument); + + // Invoke the service + ComplexDocument output=interopDoc.ComplexDocument(input); + + // Test the results + assertNotNull(output); + assertEquals("789", output.getAnAttribute()); + assertNotNull(output.getChild()); + assertNotNull(output.getChild().getChildSimpleDoc()); + + //FIXME Add more tests of the output document + + } + + protected void setUp() throws Exception { + super.setUp(); + + // Required to allow the SDO runtime to use the correct classloader + oldCL=Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); + + // Obtain Tuscany runtime + tuscany = new TuscanyRuntime("interopclient", null); + + // Start the runtime + tuscany.start(); + + // Get the SDO DataFactory + dataFactory=DataFactory.INSTANCE; + + // Locate the service to test + interopDoc=locateInteropDocService(); + + } + + /** + * Locate the interop service to test + * @return + */ + protected DocTestPortType locateInteropDocService() { + String interopLocation = System.getProperty("interopLocation"); + + // Valid service names are: + // RemoteInteropDocService: the live interop Web Service + // LocalHostInteropDocService: the interop Web Service hosted by Tuscany on localhost + // LoopbackInteropDocServiceComponent: a dummy loopback service component + + // To specify the service name run mvn -DinteropDocServiceName="RemoteInteropDocService" + + if (interopLocation == null) + interopLocation = "Remote"; + + return (DocTestPortType)CurrentModuleContext.getContext().locateService(interopLocation + "InteropDocService"); + } + + protected void tearDown() throws Exception { + + // Stop the runtime + tuscany.stop(); + + Thread.currentThread().setContextClassLoader(oldCL); + + super.tearDown(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/pom.xml new file mode 100644 index 0000000000..aac6696960 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/pom.xml @@ -0,0 +1,100 @@ + + + + + org.apache.tuscany + tuscany-interop-clients + incubating-M1 + + + 4.0.0 + interop-client-webserviceSOAPRound2 + jar + Tuscany Interop Testing - Clients - SOAP Builders Round 2 Interop Test + incubating-M1 + + + axis2 + + + + + junit + junit + 3.8.1 + test + + + + org.apache.tuscany + tuscany-core + ${pom.version} + compile + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + compile + + + org.apache.tuscany.sca.bindings + tuscany-binding-${ws.type} + ${pom.version} + compile + + + + + + + org.apache.tuscany + tuscany-sdo-plugin + + + + ${basedir}/src/main/resources/wsdl/interoptestdoclit.wsdl + true + true + true + true + + + generate + + + + + + org.apache.tuscany.sca.plugins + tuscany-plugin-wsdl2java + + + + ${basedir}/src/main/resources/wsdl/interoptestdoclit.wsdl + org.soapinterop.wsdl.interop.test.doc.lit + + + generate + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/sca.module new file mode 100644 index 0000000000..0ba5645834 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/sca.module @@ -0,0 +1,28 @@ + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/wsdl/interoptestdoclit.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/wsdl/interoptestdoclit.wsdl new file mode 100644 index 0000000000..c12b966911 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/main/resources/wsdl/interoptestdoclit.wsdl @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java new file mode 100644 index 0000000000..a2f1b9f972 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceSOAPRound2/src/test/java/org/apache/tuscany/test/interop/client/InteropTestDocLitTestCase.java @@ -0,0 +1,144 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.test.interop.client; + +import java.rmi.RemoteException; +import java.util.Arrays; +import java.util.List; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.osoa.sca.CurrentModuleContext; +import org.soapinterop.wsdl.interop.test.doc.lit.WSDLInteropTestDocLitPortType; +import org.soapinterop.xsd.ArrayOfstring_literal; +import org.soapinterop.xsd.SOAPStruct; +import org.soapinterop.xsd.XsdPackage; + +import commonj.sdo.helper.DataFactory; + +/** + * This test case is part of the tuscany interop tests. This is a reduced version + * of the SOAPBuilders InteropTest test, document/literal mode. This version has + * operations such as echoString, echoArrayOfString and echoStruct. + * + *

      The WSDL for the external service used in this test case can be + * downloaded from http://www.mssoapinterop.org/stkV3/wsdl/InteropTestDocLit.wsdl. + * This is part of the WSDL interop test from Microsoft and more details aobout this + * test case are found at http://www.mssoapinterop.org/stkV3/wsdl/WSDLInterop-0118.htm + */ +public class InteropTestDocLitTestCase extends TestCase { + + private TuscanyRuntime tuscany = null; + private WSDLInteropTestDocLitPortType doc = null; + private DataFactory dataFactory; + private ClassLoader oldCL; + + protected void setUp() throws Exception { + super.setUp(); + + // Required to allow the SDO runtime to use the correct classloader + oldCL=Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); + + // Obtain Tuscany runtime + tuscany = new TuscanyRuntime("interopclient", null); + + // Start the runtime + tuscany.start(); + + // Get the SDO DataFactory + dataFactory=DataFactory.INSTANCE; + + // Locate the service to test + doc = locateInteropDocService(); + } + + /** + * Locate the interop service to test + * @return + */ + protected WSDLInteropTestDocLitPortType locateInteropDocService() { + Object o = CurrentModuleContext.getContext().locateService("RemoteInteropDocService"); + Class[] ifaces = o.getClass().getInterfaces(); + return (WSDLInteropTestDocLitPortType) o; + } + + /** + * test echo void + * @throws RemoteException + */ + public void testEchoVoid() throws RemoteException { + doc.echoVoid(); + assertTrue(true); + } + + /** + * test echo string + * @throws RemoteException + */ + public void testEchoString() throws RemoteException { + String input = "a test string"; + String output = doc.echoString(input); + assertEquals(input, output); + } + + /** + * test echo string + * @throws RemoteException + */ + public void testEchoStringArray() throws RemoteException { + + ArrayOfstring_literal input=(ArrayOfstring_literal)dataFactory.create(ArrayOfstring_literal.class); + List inStrings = Arrays.asList(new String[] {"petra", "sue"}); + input.set(XsdPackage.ARRAY_OFSTRING_LITERAL__STRING, inStrings); + + ArrayOfstring_literal output = doc.echoStringArray(input); + + List outStrings = output.getString(); + assertNotNull(outStrings); + assertEquals(2, outStrings.size()); + assertEquals("petra", outStrings.get(0)); + assertEquals("sue", outStrings.get(1)); + } + + /** + * test echo struct + * @throws RemoteException + */ + public void testEchoStruct() throws RemoteException { + SOAPStruct input=(SOAPStruct)dataFactory.create(SOAPStruct.class); + input.setVarInt(200); + input.setVarFloat(.002f); + input.setVarString("Hello"); + SOAPStruct output = doc.echoStruct(input); + assertEquals(input.getVarInt(), output.getVarInt()); + assertEquals(input.getVarFloat(), output.getVarFloat()); + assertEquals(input.getVarString(), output.getVarString()); + } + + + protected void tearDown() throws Exception { + // Stop the runtime + tuscany.stop(); + + Thread.currentThread().setContextClassLoader(oldCL); + + super.tearDown(); + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/pom.xml new file mode 100644 index 0000000000..deb6d98fd1 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/pom.xml @@ -0,0 +1,60 @@ + + + + + org.apache.tuscany + tuscany-interop-clients + incubating-M1 + + + 4.0.0 + interop-client-webserviceXSQ + jar + Tuscany Interop Testing - Clients - webserviceXSQ + incubating-M1 + + + axis2 + + + + + org.apache.tuscany + tuscany-core + ${pom.version} + compile + + + org.apache.tuscany.sca.bindings + tuscany-binding-${ws.type} + ${pom.version} + test + + + org.apache.tuscany.databinding + tuscany-databinding-sdo + ${pom.version} + test + + + junit + junit + 3.8.1 + test + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/java/interop/ClientTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/java/interop/ClientTestCase.java new file mode 100644 index 0000000000..3f163672f3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/java/interop/ClientTestCase.java @@ -0,0 +1,50 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package interop; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.core.config.ConfigurationException; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + +/** + * This client program shows how to create an SCA runtime, start it, locate a simple HelloWorld service component and invoke it. + */ +public class ClientTestCase extends TestCase { + + public void testGetQuote() throws ConfigurationException, SecurityException, NoSuchMethodException, IllegalArgumentException, + IllegalAccessException, InvocationTargetException { + + TuscanyRuntime tuscany = new TuscanyRuntime("getQuote", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + Object serviceProxy = moduleContext.locateService("webserviceXSQ"); + Method m = serviceProxy.getClass().getMethod("GetQuote", new Class[] { String.class }); + + String sqResponse = (String) m.invoke(serviceProxy, "IBM"); + + assertTrue(sqResponse.startsWith("IBM")); + + tuscany.stop(); + } +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/resources/sca.module new file mode 100644 index 0000000000..7c050b55a4 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/resources/sca.module @@ -0,0 +1,29 @@ + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/resources/wsdl/sq.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/resources/wsdl/sq.wsdl new file mode 100644 index 0000000000..17e24f7c1a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/clients/webserviceXSQ/src/test/resources/wsdl/sq.wsdl @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get Stock quote for a company Symbol + + + + + + + + Get Stock quote for a company Symbol + + + + + + + + Get Stock quote for a company Symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/pom.xml new file mode 100644 index 0000000000..9ef71ff299 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/pom.xml @@ -0,0 +1,35 @@ + + + + + org.apache.tuscany + tuscany-project + incubating-M1 + + + 4.0.0 + tuscany-testing-interop + pom + Tuscany Interop Testing + incubating-M1 + + + clients + services + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/pom.xml new file mode 100644 index 0000000000..c10b40f3a0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/pom.xml @@ -0,0 +1,34 @@ + + + + + org.apache.tuscany + tuscany-testing-interop + incubating-M1 + + + 4.0.0 + tuscany-testing-interop-services + pom + Tuscany Interop Testing - Services + incubating-M1 + + + webserviceInteropDoc + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/pom.xml new file mode 100644 index 0000000000..234832653f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/pom.xml @@ -0,0 +1,96 @@ + + + + + org.apache.tuscany + tuscany-testing-interop-services + incubating-M1 + + + 4.0.0 + interop-service-webserviceInteropDoc + war + Tuscany Interop Testing - Services - InteropDoc + incubating-M1 + + + + org.osoa + sca-api + ${pom.version} + provided + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + org.apache.tuscany.sca.bindings + tuscany-binding-axis2 + ${pom.version} + provided + + + + + + + org.apache.tuscany + tuscany-sdo-plugin + + + + ${basedir}/src/main/resources/wsdl/interopdoc.wsdl + true + true + true + true + + + generate + + + + + + org.apache.tuscany.sca.plugins + tuscany-plugin-wsdl2java + + + + ${basedir}/src/main/resources/wsdl/interopdoc.wsdl + org.soapinterop + + + generate + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java new file mode 100644 index 0000000000..a2c6cb29dc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/java/org/apache/tuscany/test/interop/server/InteropDocServiceComponentImpl.java @@ -0,0 +1,45 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.test.interop.server; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Service; +import org.soapinterop.ComplexDocument; +import org.soapinterop.DocTestPortType; +import org.soapinterop.SimpleDocument1; +import org.soapinterop.SingleTag; + +/** + * This class implements the HelloWorld service component. + */ +@Service(DocTestPortType.class) +public class InteropDocServiceComponentImpl implements DocTestPortType { + + public ComplexDocument ComplexDocument(ComplexDocument param2) throws RemoteException { + return param2; + } + + public SimpleDocument1 SimpleDocument(SimpleDocument1 param0) throws RemoteException { + return param0; + } + + public SingleTag SingleTag(SingleTag param4) throws RemoteException { + return param4; + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/resources/sca.module b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/resources/sca.module new file mode 100644 index 0000000000..99013b89a0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/resources/sca.module @@ -0,0 +1,33 @@ + + + + + + + + + + + InteropDocServiceComponent/DocTestPortType + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl new file mode 100644 index 0000000000..59352ec4f0 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/resources/wsdl/interopdoc.wsdl @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..2cee1c6b32 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/interop/services/webserviceInteropDoc/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,23 @@ + + + + + + Tuscany Interop Test Server + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/pom.xml new file mode 100644 index 0000000000..b29a555f2f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/pom.xml @@ -0,0 +1,77 @@ + + + + + org.apache.tuscany + tuscany-testing-tomcat + incubating-M1 + + 4.0.0 + tomcat-bigbank + jar + Tuscany Testing Tomcat Big Bank + Testing Tomcat Big Bank end user test + incubating-M1 + + + + + junit + junit + 3.8.1 + test + + + htmlunit + htmlunit + 1.8 + 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/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/test/java/org/apache/tuscany/test/bigbank/BigBankTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/test/java/org/apache/tuscany/test/bigbank/BigBankTestCase.java new file mode 100644 index 0000000000..4212fd1918 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/bigbank/src/test/java/org/apache/tuscany/test/bigbank/BigBankTestCase.java @@ -0,0 +1,234 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.test.bigbank; + +import java.net.URL; +import java.util.Iterator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import junit.framework.TestCase; + +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.WebResponse; +import com.gargoylesoftware.htmlunit.html.HtmlForm; +import com.gargoylesoftware.htmlunit.html.HtmlInput; +import com.gargoylesoftware.htmlunit.html.HtmlPage; + +public class BigBankTestCase extends TestCase { + // public static final String testUrl = "http://localhost:8080/tuscany-samples-bigbank-webclient"; + public static final String testUrl = "http://localhost:8080/sample-bigbank-webclient/"; + + public void testBigBankDefault() throws Exception { + System.err.println("Running: testcase:"); + // New HTMLunit web client + WebClient client = new WebClient(); + client.setRedirectEnabled(true); + + // Going to have the WebClient connect to this URL + URL url = new URL(testUrl); + HtmlPage page = (HtmlPage) client.getPage(url); + // System.out.println(page.getTitleText()); + + // Check response code + WebResponse resp = page.getWebResponse(); + assertTrue(resp.getStatusCode() <= 200); + List forms = page.getForms(); + + + HtmlPage resultPage = null; + WebResponse resultResponse= null; + boolean formfound = false; + for (Iterator iter = forms.iterator(); formfound != true && iter.hasNext();) { + HtmlForm form = (HtmlForm) iter.next(); + + if ("loginAction".equals(form.getActionAttribute())) { + formfound = true; + HtmlInput login = form.getInputByName("login"); + HtmlInput password = form.getInputByName("password"); + login.setValueAttribute("test"); + password.setValueAttribute("password"); + + resultPage = (HtmlPage) form.submit(); + // Check response from servlet + resultResponse = resultPage.getWebResponse(); + assertTrue(resultResponse.getStatusCode() <= 200); + + + String response = resultResponse.getContentAsString(); + assertTrue(-1 != response.indexOf("Account Information for")); + assertTrue(-1 != response.indexOf("Test")); + assertTrue(-1 != response.indexOf("134-42-6231")); + assertTrue(-1 != response.indexOf("123.43")); + assertTrue(-1 != response.indexOf("134-43-3941")); + assertTrue(-1 != response.indexOf("23.12")); + + Pattern pat = Pattern.compile("LU.*7", Pattern.DOTALL); + Matcher test = pat.matcher(response); + assertTrue(test.find()); + } + + } + forms = resultPage.getForms(); + + formfound = false; + for(Iterator iter = forms.iterator(); formfound != true && iter.hasNext();) { + HtmlForm form = (HtmlForm) iter.next(); + + if ("purchaseStock.jsp".equals(form.getActionAttribute())) { + formfound = true; + resultPage = (HtmlPage) form.submit(); + } + + } + assertTrue(formfound); + forms = resultPage.getForms(); + formfound = false; + for (Iterator iter = forms.iterator(); formfound != true && iter.hasNext();) { + HtmlForm form = (HtmlForm) iter.next(); + + if ("FormServlet".equals(form.getActionAttribute())) { + formfound = true; + + HtmlInput login = form.getInputByName("symbol"); + HtmlInput password = form.getInputByName("quantity"); + login.setValueAttribute("EDS"); + password.setValueAttribute("131"); + + resultPage = (HtmlPage) form.submit(); + // Check response from servlet + resultResponse = resultPage.getWebResponse(); + assertTrue(resultResponse.getStatusCode() <= 200); + + + String response = resultResponse.getContentAsString(); + assertTrue(-1 != response.indexOf("Account Information for")); + assertTrue(-1 != response.indexOf("Test")); + assertTrue(-1 != response.indexOf("134-42-6231")); + assertTrue(-1 != response.indexOf("123.43")); + assertTrue(-1 != response.indexOf("134-43-3941")); + assertTrue(-1 != response.indexOf("23.12")); + + Pattern pat = Pattern.compile("LU.*7", Pattern.DOTALL); + Matcher test = pat.matcher(response); + assertTrue(test.find()); + pat = Pattern.compile("EDS.*131", Pattern.DOTALL); + test = pat.matcher(response); + assertTrue(test.find()); + + } + + } + assertTrue(formfound); + forms = resultPage.getForms(); + formfound = false; + for (Iterator iter = forms.iterator(); formfound != true && iter.hasNext();) { + HtmlForm form = (HtmlForm) iter.next(); + + if ("stockSale.jsp".equals(form.getActionAttribute())) { +// System.err.println(form.asText()); + + + + Pattern pat = Pattern.compile("EDS.*131", Pattern.DOTALL); + + Matcher test = pat.matcher(form.asText()); + if(!test.find()) continue; + + + + + formfound = true; + resultPage = (HtmlPage) form.submit(); + // Check response from servlet + resultResponse = resultPage.getWebResponse(); + assertTrue(resultResponse.getStatusCode() <= 200); + + + } + + } + forms = resultPage.getForms(); + + + + formfound = false; + for(Iterator iter = forms.iterator(); formfound != true && iter.hasNext();) { + HtmlForm form = (HtmlForm) iter.next(); + + if ("FormServlet".equals(form.getActionAttribute())) { + formfound = true; + + + HtmlInput password = form.getInputByName("quantity"); + + password.setValueAttribute("131"); + + resultPage = (HtmlPage) form.submit(); + // Check response from servlet + resultResponse = resultPage.getWebResponse(); + assertTrue(resultResponse.getStatusCode() <= 200); + + + String response = resultResponse.getContentAsString(); + assertTrue(-1 != response.indexOf("Account Information for")); + assertTrue(-1 != response.indexOf("Test")); + assertTrue(-1 != response.indexOf("134-42-6231")); + assertTrue(-1 != response.indexOf("123.43")); + assertTrue(-1 != response.indexOf("134-43-3941")); + assertTrue(-1 != response.indexOf("23.12")); + + Pattern pat = Pattern.compile("LU.*7", Pattern.DOTALL); + Matcher test = pat.matcher(response); + assertTrue(test.find()); + // pat = Pattern.compile("EDS.*131", Pattern.DOTALL); + // test = pat.matcher(response); + // assertFalse(test.find()); + + + } + + } + assertTrue(formfound); + + forms = resultPage.getForms(); + formfound = false; + for (Iterator iter = forms.iterator(); formfound != true && iter.hasNext();) { + HtmlForm form = (HtmlForm) iter.next(); + + if ("loginAction".equals(form.getActionAttribute())) { + formfound = true; + + // FIXME this seems to performs a log-in again instead of logout... + resultPage = (HtmlPage) form.submit(); + + } + + } + assertTrue(formfound); + + } + + /** + * @param args + */ + public static void main(String[] args) { + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/build.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/build.xml new file mode 100644 index 0000000000..3d26afcfbc --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/build.xml @@ -0,0 +1,430 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/context.xsl b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/context.xsl new file mode 100644 index 0000000000..82db3ef81b --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/context.xsl @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/datasource.xsl b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/datasource.xsl new file mode 100644 index 0000000000..2e358123c3 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/datasource.xsl @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + Global Datasource for Derby dastest database + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/pom.xml new file mode 100644 index 0000000000..fed01506f5 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/pom.xml @@ -0,0 +1,77 @@ + + + + + org.apache.tuscany + tuscany-testing-tomcat + incubating-M1 + + 4.0.0 + tomcat-helloworldweb + jar + Tuscany Testing Tomcat HelloWorld WEB + Testing Tomcat Helloworld Web end user test + incubating-M1 + + + + + junit + junit + 3.8.1 + test + + + + htmlunit + htmlunit + 1.8 + 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/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/test/java/org/apache/tuscany/test/helloworldweb/HelloWorldWebTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/test/java/org/apache/tuscany/test/helloworldweb/HelloWorldWebTestCase.java new file mode 100644 index 0000000000..f09d187979 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldweb/src/test/java/org/apache/tuscany/test/helloworldweb/HelloWorldWebTestCase.java @@ -0,0 +1,100 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.test.helloworldweb; + +import java.net.URL; +import java.util.Iterator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import junit.framework.TestCase; + +import com.gargoylesoftware.htmlunit.Page; +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.WebResponse; +import com.gargoylesoftware.htmlunit.html.HtmlForm; +import com.gargoylesoftware.htmlunit.html.HtmlInput; +import com.gargoylesoftware.htmlunit.html.HtmlPage; + + +public class HelloWorldWebTestCase extends TestCase { + public static final String testUrl = "http://localhost:8080/sample-helloworldweb/"; + + public void testHelloWorldDefault() throws Exception + { + System.err.println("Running: testcase:"); + // New HTMLunit web client + WebClient client = new WebClient(); + // Going to have the WebClient connect to this URL + URL url = new URL(testUrl); + HtmlPage page = (HtmlPage)client.getPage(url); + //System.out.println(page.getTitleText()); + + // Check response code + WebResponse resp = page.getWebResponse(); + assertTrue(resp.getStatusCode() <= 200); + List forms = page.getForms(); + Iterator iter = forms.iterator(); + + // Iterate over all forms on page, should only be one. + while(iter.hasNext()) + { + HtmlForm form = (HtmlForm)iter.next(); + // Get the "name" form input field + HtmlInput login = form.getInputByName("name"); + System.err.println(login.getValueAttribute()); + Page resultPage = form.submit(); + // Check response from servlet + WebResponse resultResponse = resultPage.getWebResponse(); + assertTrue(resultResponse.getStatusCode() <= 200); + + // TODO Check response content.. + String response = resultResponse.getContentAsString(); + + Pattern pattern = Pattern.compile("Hello World"); + Matcher matcher = pattern.matcher(response.subSequence(0,response.length())); + assertTrue(matcher.find()); + + /** + * or.. + * + * HtmlPage htmlResponse = (HtmlPage)resultPage; + * HtmlElement element = htmlResponse.getHtmlElementById("ELEMENT-ID"); + * assertEquals(element.getNodeValue(), ... ); + * + * or.. + * + * String resultString = resultResponse.getContentAsString(); + * assertEquals(resultString, ... ); + * + * etc. + * + **/ + } + + } + + /** + * @param args + */ + public static void main(String[] args) { + + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/pom.xml new file mode 100644 index 0000000000..63ddfb798f --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/pom.xml @@ -0,0 +1,96 @@ + + + + + org.apache.tuscany + tuscany-testing-tomcat + incubating-M1 + + 4.0.0 + tomcat-helloworldws + jar + Tuscany Testing Tomcat HelloWorld WS + Testing Tomcat HelloWorld WS end user test + incubating-M1 + + + + + org.apache.tuscany + tuscany-core + ${pom.version} + provided + + + org.apache.tuscany.sca.containers + tuscany-container-java + ${pom.version} + provided + + + org.apache.tuscany.sca.bindings + tuscany-binding-axis2 + ${pom.version} + provided + + + org.apache.tuscany.samples.sca + sample-helloworldwsclient + ${pom.version} + provided + + + + junit + junit + 3.8.1 + 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/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/LICENSE.txt new file mode 100644 index 0000000000..25d78feeac --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/LICENSE.txt @@ -0,0 +1,1277 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +APACHE TUSCANY SUBCOMPONENTS: + +The Apache Tuscany distribution includes a number of subcomponents with +separate copyright notices and license terms. Your use of the source +code for the these subcomponents is subject to the terms and +conditions of the following licenses. + +=============================================================================== + +For the Eclipse Modeling Framework component and the Celtix binding: + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF +THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and +are distributed by that particular Contributor. A Contribution +'originates' from a Contributor if it was added to the Program by such +Contributor itself or anyone acting on such Contributor's behalf. +Contributions do not include additions to the Program which: (i) are +separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative +works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor +which are necessarily infringed by the use or sale of its Contribution +alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this +Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free copyright +license to reproduce, prepare derivative works of, publicly display, +publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and +object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby +grants Recipient a non-exclusive, worldwide, royalty-free patent +license under Licensed Patents to make, use, sell, offer to sell, +import and otherwise transfer the Contribution of such Contributor, if +any, in source code and object code form. This patent license shall +apply to the combination of the Contribution and the Program if, at +the time the Contribution is added by the Contributor, such addition +of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder. + +c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow +Recipient to distribute the Program, it is Recipient's responsibility +to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright +license set forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form +under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties +and conditions, express and implied, including warranties or +conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability +for damages, including direct, indirect, special, incidental and +consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable +manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained +within the Program. + +Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a +commercial product offering should do so in a manner which does not +create potential liability for other Contributors. Therefore, if a +Contributor includes the Program in a commercial product offering, +such Contributor ("Commercial Contributor") hereby agrees to defend +and indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") arising +from claims, lawsuits and other legal actions brought by a third party +against the Indemnified Contributor to the extent caused by the acts +or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. +In order to qualify, an Indemnified Contributor must: a) promptly +notify the Commercial Contributor in writing of such claim, and b) +allow the Commercial Contributor to control, and cooperate with the +Commercial Contributor in, the defense and any related settlement +negotiations. The Indemnified Contributor may participate in any such +claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY +WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and +unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR +ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that +the Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of +the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign +the responsibility to serve as the Agreement Steward to a suitable +separate entity. Each new version of the Agreement will be given a +distinguishing version number. The Program (including Contributions) +may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the +Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives +no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No +party to this Agreement will bring a legal action under this Agreement +more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation. + +=============================================================================== + +For the Rhino JavaScript container component: + +Mozilla Public License 1.1 (MPL 1.1) + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the +Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to +the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original Code, +prior Modifications used by a Contributor, and the Modifications made by that +particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the +combination of the Original Code and Modifications, in each case including +portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally +accepted in the software development community for the electronic transfer of +data. + + 1.5. "Executable" means Covered Code in any form other than Source +Code. + + 1.6. "Initial Developer" means the individual or entity identified as +the Initial Developer in the Source Code notice required by Exhibit A. + + 1.7. "Larger Work" means a work which combines Covered Code or +portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum +extent possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the +substance or structure of either the Original Code or any previous +Modifications. When Covered Code is released as a series of files, a +Modification is: + A. Any addition to or deletion from the contents of a file +containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or +previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code +which is described in the Source Code notice required by Exhibit A as Original +Code, and which, at the time of its release under this License is not already +Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or +hereafter acquired, including without limitation, method, process, and +apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for +making modifications to it, including all modules it contains, plus any +associated interface definition files, scripts used to control compilation and +installation of an Executable, or source code differential comparisons against +either the Original Code or another well known, available Covered Code of the +Contributor's choice. The Source Code can be in a compressed or archival form, +provided the appropriate decompression or de-archiving software is widely +available for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity +exercising rights under, and complying with all of the terms of, this License +or a future version of this License issued under Section 6.1. For legal +entities, "You" includes any entity which controls, is controlled by, or is +under common control with You. For purposes of this definition, "control" +means (a) the power, direct or indirect, to cause the direction or management +of such entity, whether by contract or otherwise, or (b) ownership of more +than fifty percent (50%) of the outstanding shares or beneficial ownership of +such entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, +non-exclusive license, subject to third party intellectual property claims: + (a) under intellectual property rights (other than patent or +trademark) Licensable by Initial Developer to use, reproduce, modify, display, +perform, sublicense and distribute the Original Code (or portions thereof) +with or without Modifications, and/or as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or selling +of Original Code, to make, have made, use, practice, sell, and offer for sale, +and/or otherwise dispose of the Original Code (or portions thereof). + (c) the licenses granted in this Section 2.1(a) and +(b) are effective on the date Initial Developer first distributes Original +Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is +granted: 1) for code that You delete from the Original Code; 2) separate from +the Original Code; or 3) for infringements caused by: i) the modification of +the Original Code or ii) the combination of the Original Code with other +software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor +hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or +trademark) Licensable by Contributor, to use, reproduce, modify, display, +perform, sublicense and distribute the Modifications created by such +Contributor (or portions thereof) either on an unmodified basis, with other +Modifications, as Covered Code and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or selling +of Modifications made by that Contributor either alone and/or in combination +with its Contributor Version (or portions of such combination), to make, use, +sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications +made by that Contributor (or portions thereof); and 2) the combination of +Modifications made by that Contributor with its Contributor Version (or +portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are +effective on the date Contributor first makes Commercial Use of the Covered +Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is +granted: 1) for any code that Contributor has deleted from the Contributor +Version; 2) separate from the Contributor Version; 3) for infringements +caused by: i) third party modifications of Contributor Version or ii) the +combination of Modifications made by that Contributor with other software +(except as part of the Contributor Version) or other devices; or 4) under +Patent Claims infringed by Covered Code in the absence of Modifications made +by that Contributor. + + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are +governed by the terms of this License, including without limitation Section +2.2. The Source Code version of Covered Code may be distributed only under the +terms of this License or a future version of this License released under +Section 6.1, and You must include a copy of this License with every copy of +the Source Code You distribute. You may not offer or impose any terms on any +Source Code version that alters or restricts the applicable version of this +License or the recipients' rights hereunder. However, You may include an +additional document offering the additional rights described in Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be +made available in Source Code form under the terms of this License either on +the same media as an Executable version or via an accepted Electronic +Distribution Mechanism to anyone to whom you made an Executable version +available; and if made available via Electronic Distribution Mechanism, must +remain available for at least twelve (12) months after the date it initially +became available, or at least six (6) months after a subsequent version of +that particular Modification has been made available to such recipients. You +are responsible for ensuring that the Source Code version remains available +even if the Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a +file documenting the changes You made to create that Covered Code and the date +of any change. You must include a prominent statement that the Modification is +derived, directly or indirectly, from Original Code provided by the Initial +Developer and including the name of the Initial Developer in (a) the Source +Code, and (b) in any notice in an Executable version or related documentation +in which You describe the origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's +intellectual property rights is required to exercise the rights granted by +such Contributor under Sections 2.1 or 2.2, Contributor must include a text +file with the Source Code distribution titled "LEGAL" which describes the +claim and the party making the claim in sufficient detail that a recipient +will know whom to contact. If Contributor obtains such knowledge after the +Modification is made available as described in Section 3.2, Contributor shall +promptly modify the LEGAL file in all copies Contributor makes available +thereafter and shall take other steps (such as notifying appropriate mailing +lists or newsgroups) reasonably calculated to inform those who received the +Covered Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming +interface and Contributor has knowledge of patent licenses which are +reasonably necessary to implement that API, Contributor must also include this +information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to +Section 3.4(a) above, Contributor believes that Contributor's Modifications +are Contributor's original creation(s) and/or Contributor has sufficient +rights to grant the rights conveyed by this License. + + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source +Code. If it is not possible to put such notice in a particular Source Code +file due to its structure, then You must include such notice in a location +(such as a relevant directory) where a user would be likely to look for such a +notice. If You created one or more Modification(s) You may add your name as a +Contributor to the notice described in Exhibit A. You must also duplicate +this License in any documentation for the Source Code where You describe +recipients' rights or ownership rights relating to Covered Code. You may +choose to offer, and to charge a fee for, warranty, support, indemnity or +liability obligations to one or more recipients of Covered Code. However, You +may do so only on Your own behalf, and not on behalf of the Initial Developer +or any Contributor. You must make it absolutely clear than any such warranty, +support, indemnity or liability obligation is offered by You alone, and You +hereby agree to indemnify the Initial Developer and every Contributor for any +liability incurred by the Initial Developer or such Contributor as a result of +warranty, support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the +requirements of Section 3.1-3.5 have been met for that Covered Code, and if +You include a notice stating that the Source Code version of the Covered Code +is available under the terms of this License, including a description of how +and where You have fulfilled the obligations of Section 3.2. The notice must +be conspicuously included in any notice in an Executable version, related +documentation or collateral in which You describe recipients' rights relating +to the Covered Code. You may distribute the Executable version of Covered Code +or ownership rights under a license of Your choice, which may contain terms +different from this License, provided that You are in compliance with the +terms of this License and that the license for the Executable version does not +attempt to limit or alter the recipient's rights in the Source Code version +from the rights set forth in this License. If You distribute the Executable +version under a different license You must make it absolutely clear that any +terms which differ from this License are offered by You alone, not by the +Initial Developer or any Contributor. You hereby agree to indemnify the +Initial Developer and every Contributor for any liability incurred by the +Initial Developer or such Contributor as a result of any such terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code +not governed by the terms of this License and distribute the Larger Work as a +single product. In such a case, You must make sure the requirements of this +License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Code due to statute, +judicial order, or regulation then You must: (a) comply with the terms of this +License to the maximum extent possible; and (b) describe the limitations and +the code they affect. Such description must be included in the LEGAL file +described in Section 3.4 and must be included with all distributions of the +Source Code. Except to the extent prohibited by statute or regulation, such +description must be sufficiently detailed for a recipient of ordinary skill to +be able to understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has attached +the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised +and/or new versions of the License from time to time. Each version will be +given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the +License, You may always continue to use it under the terms of that version. +You may also choose to use such Covered Code under the terms of any subsequent +version of the License published by Netscape. No one other than Netscape has +the right to modify the terms applicable to Covered Code created under this +License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may +only do in order to apply it to code which is not already Covered Code +governed by this License), You must (a) rename Your license so that the +phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or +any confusingly similar phrase do not appear in your license (except to note +that your license differs from this License) and (b) otherwise make it clear +that Your version of the license contains terms which differ from the Mozilla +Public License and Netscape Public License. (Filling in the name of the +Initial Developer, Original Code or Contributor in the notice described in +Exhibit A shall not of themselves be deemed to be modifications of this +License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, +FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED +CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY +OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR +CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS +LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS +DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate +automatically if You fail to comply with terms herein and fail to cure such +breach within 30 days of becoming aware of the breach. All sublicenses to the +Covered Code which are properly granted shall survive any termination of this +License. Provisions which, by their nature, must remain in effect beyond the +termination of this License shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement +claim (excluding declatory judgment actions) against Initial Developer or a +Contributor (the Initial Developer or Contributor against whom You file such +action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly +infringes any patent, then any and all rights granted by such Participant to +You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice +from Participant terminate prospectively, unless if within 60 days after +receipt of notice You either: (i) agree in writing to pay Participant a +mutually agreeable reasonable royalty for Your past and future use of +Modifications made by such Participant, or (ii) withdraw Your litigation claim +with respect to the Contributor Version against such Participant. If within +60 days of notice, a reasonable royalty and payment arrangement are not +mutually agreed upon in writing by the parties or the litigation claim is not +withdrawn, the rights granted by Participant to You under Sections 2.1 and/or +2.2 automatically terminate at the expiration of the 60 day notice period +specified above. + + (b) any software, hardware, or device, other than such Participant's +Contributor Version, directly or indirectly infringes any patent, then any +rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are +revoked effective as of the date You first made, used, sold, distributed, or +had made, Modifications made by that Participant. + + 8.3. If You assert a patent infringement claim against Participant +alleging that such Participant's Contributor Version directly or indirectly +infringes any patent where such claim is resolved (such as by license or +settlement) prior to the initiation of patent infringement litigation, then +the reasonable value of the licenses granted by such Participant under +Sections 2.1 or 2.2 shall be taken into account in determining the amount or +value of any payment or license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, all +end user license agreements (excluding distributors and resellers) which have +been validly granted by You or any distributor hereunder prior to termination +shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT +(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL +DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY +SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, +WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER +FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, +EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH +DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH +OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT +APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE +EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS +EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in 48 +C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and +"commercial computer software documentation," as such terms are used in 48 +C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. +227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users +acquire Covered Code with only those rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it +enforceable. This License shall be governed by California law provisions +(except to the extent applicable law, if any, provides otherwise), excluding +its conflict-of-law provisions. With respect to disputes in which at least one +party is a citizen of, or an entity chartered or registered to do business in +the United States of America, any litigation relating to this License shall be +subject to the jurisdiction of the Federal Courts of the Northern District of +California, with venue lying in Santa Clara County, California, with the +losing party responsible for costs, including without limitation, court costs +and reasonable attorneys' fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation which provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is +responsible for claims and damages arising, directly or indirectly, out of its +utilization of rights under this License and You agree to work with Initial +Developer and Contributors to distribute such responsibility on an equitable +basis. Nothing herein is intended or shall be deemed to constitute any +admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as +Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits +you to utilize portions of the Covered Code under Your choice of the MPL or +the alternative licenses, if any, specified by the Initial Developer in the +file described in Exhibit A. + + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF + ANY KIND, either express or implied. See the License for the specific +language governing rights and + limitations under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. +Portions created by + ______________________ are Copyright (C) ______ +_______________________. All Rights + Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms of +the _____ license (the [___] License), in which case the provisions of +[______] License are applicable instead of those above. If you wish to allow +use of your version of this file only under the terms of the [____] License +and not to allow others to use your version of this file under the MPL, +indicate your decision by deleting the provisions above and replace them +with the notice and other provisions required by the [___] License. If you do +not delete the provisions above, a recipient may use your version of this file +under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of +the notices in the Source Code files of the Original Code. You should use the +text of this Exhibit A rather than the text found in the Original Code Source +Code for Your Modifications.] + + +=============================================================================== + +For the JAX-WS Reference Implementation component: + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 + + + 1. Definitions. + + 1.1. "Contributor" means each individual or entity that + creates or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the + Original Software, prior Modifications used by a + Contributor (if any), and the Modifications made by that + particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or + (b) Modifications, or (c) the combination of files + containing Original Software with files containing + Modifications, in each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form + other than Source Code. + + 1.5. "Initial Developer" means the individual or entity + that first makes Original Software available under this + License. + + 1.6. "Larger Work" means a work which combines Covered + Software or portions thereof with code not governed by the + terms of this License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the + maximum extent possible, whether at the time of the initial + grant or subsequently acquired, any and all of the rights + conveyed herein. + + 1.9. "Modifications" means the Source Code and Executable + form of any of the following: + + A. Any file that results from an addition to, + deletion from or modification of the contents of a + file containing Original Software or previous + Modifications; + + B. Any new file that contains any part of the + Original Software or previous Modification; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and + Executable form of computer software code that is + originally released under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned + or hereafter acquired, including without limitation, + method, process, and apparatus claims, in any patent + Licensable by grantor. + + 1.12. "Source Code" means (a) the common form of computer + software code in which modifications are made and (b) + associated documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal + entity exercising rights under, and complying with all of + the terms of, this License. For legal entities, "You" + includes any entity which controls, is controlled by, or is + under common control with You. For purposes of this + definition, "control" means (a) the power, direct or + indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (b) ownership + of more than fifty percent (50%) of the outstanding shares + or beneficial ownership of such entity. + + 2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the + Initial Developer hereby grants You a world-wide, + royalty-free, non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Initial Developer, + to use, reproduce, modify, display, perform, + sublicense and distribute the Original Software (or + portions thereof), with or without Modifications, + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, + using or selling of Original Software, to make, have + made, use, practice, sell, and offer for sale, and/or + otherwise dispose of the Original Software (or + portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) + are effective on the date Initial Developer first + distributes or otherwise makes the Original Software + available to a third party under the terms of this + License. + + (d) Notwithstanding Section 2.1(b) above, no patent + license is granted: (1) for code that You delete from + the Original Software, or (2) for infringements + caused by: (i) the modification of the Original + Software, or (ii) the combination of the Original + Software with other software or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than + patent or trademark) Licensable by Contributor to + use, reproduce, modify, display, perform, sublicense + and distribute the Modifications created by such + Contributor (or portions thereof), either on an + unmodified basis, with other Modifications, as + Covered Software and/or as part of a Larger Work; and + + + (b) under Patent Claims infringed by the making, + using, or selling of Modifications made by that + Contributor either alone and/or in combination with + its Contributor Version (or portions of such + combination), to make, use, sell, offer for sale, + have made, and/or otherwise dispose of: (1) + Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications + made by that Contributor with its Contributor Version + (or portions of such combination). + + (c) The licenses granted in Sections 2.2(a) and + 2.2(b) are effective on the date Contributor first + distributes or otherwise makes the Modifications + available to a third party. + + (d) Notwithstanding Section 2.2(b) above, no patent + license is granted: (1) for any code that Contributor + has deleted from the Contributor Version; (2) for + infringements caused by: (i) third party + modifications of Contributor Version, or (ii) the + combination of Modifications made by that Contributor + with other software (except as part of the + Contributor Version) or other devices; or (3) under + Patent Claims infringed by Covered Software in the + absence of Modifications made by that Contributor. + + 3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in + Source Code form and that Source Code form must be + distributed only under the terms of this License. You must + include a copy of this License with every copy of the + Source Code form of the Covered Software You distribute or + otherwise make available. You must inform recipients of any + such Covered Software in Executable form as to how they can + obtain such Covered Software in Source Code form in a + reasonable manner on or through a medium customarily used + for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You + contribute are governed by the terms of this License. You + represent that You believe Your Modifications are Your + original creation(s) and/or You have sufficient rights to + grant the rights conveyed by this License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications + that identifies You as the Contributor of the Modification. + You may not remove or alter any copyright, patent or + trademark notices contained within the Covered Software, or + any notices of licensing or any descriptive text giving + attribution to any Contributor or the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered + Software in Source Code form that alters or restricts the + applicable version of this License or the recipients' + rights hereunder. You may choose to offer, and to charge a + fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Software. + However, you may do so only on Your own behalf, and not on + behalf of the Initial Developer or any Contributor. You + must make it absolutely clear that any such warranty, + support, indemnity or liability obligation is offered by + You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of + warranty, support, indemnity or liability terms You offer. + + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered + Software under the terms of this License or under the terms + of a license of Your choice, which may contain terms + different from this License, provided that You are in + compliance with the terms of this License and that the + license for the Executable form does not attempt to limit + or alter the recipient's rights in the Source Code form + from the rights set forth in this License. If You + distribute the Covered Software in Executable form under a + different license, You must make it absolutely clear that + any terms which differ from this License are offered by You + alone, not by the Initial Developer or Contributor. You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial + Developer or such Contributor as a result of any such terms + You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software + with other code not governed by the terms of this License + and distribute the Larger Work as a single product. In such + a case, You must make sure the requirements of this License + are fulfilled for the Covered Software. + + 4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and + may publish revised and/or new versions of this License + from time to time. Each version will be given a + distinguishing version number. Except as provided in + Section 4.3, no one other than the license steward has the + right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. If the Initial Developer includes a + notice in the Original Software prohibiting it from being + distributed or otherwise made available under any + subsequent version of the License, You must distribute and + make the Covered Software available under the terms of the + version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to + use, distribute or otherwise make the Covered Software + available under the terms of any subsequent version of the + License published by the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a + new license for Your Original Software, You may create and + use a modified version of this License if You: (a) rename + the license and remove any references to the name of the + license steward (except to note that the license differs + from this License); and (b) otherwise make it clear that + the license contains terms which differ from this License. + + + 5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF + ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + + 6. TERMINATION. + + 6.1. This License and the rights granted hereunder will + terminate automatically if You fail to comply with terms + herein and fail to cure such breach within 30 days of + becoming aware of the breach. Provisions which, by their + nature, must remain in effect beyond the termination of + this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or + a Contributor (the Initial Developer or Contributor against + whom You assert such claim is referred to as "Participant") + alleging that the Participant Software (meaning the + Contributor Version where the Participant is a Contributor + or the Original Software where the Participant is the + Initial Developer) directly or indirectly infringes any + patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial + Developer (if the Initial Developer is not the Participant) + and all Contributors under Sections 2.1 and/or 2.2 of this + License shall, upon 60 days notice from Participant + terminate prospectively and automatically at the expiration + of such 60 day notice period, unless if within such 60 day + period You withdraw Your claim with respect to the + Participant Software against such Participant either + unilaterally or pursuant to a written agreement with + Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 + above, all end user licenses that have been validly granted + by You or any distributor hereunder prior to termination + (excluding licenses granted to You by any distributor) + shall survive termination. + + 7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + + 8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 C.F.R. + 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. + 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 + through 227.7202-4 (June 1995), all U.S. Government End Users + acquire Covered Software with only those rights set forth herein. + This U.S. Government Rights clause is in lieu of, and supersedes, + any other FAR, DFAR, or other clause or provision that addresses + Government rights in computer software under this License. + + 9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the + extent necessary to make it enforceable. This License shall be + governed by the law of the jurisdiction specified in a notice + contained within the Original Software (except to the extent + applicable law, if any, provides otherwise), excluding such + jurisdiction's conflict-of-law provisions. Any litigation + relating to this License shall be subject to the jurisdiction of + the courts located in the jurisdiction and venue specified in a + notice contained within the Original Software, with the losing + party responsible for costs, including, without limitation, court + costs and reasonable attorneys' fees and expenses. The + application of the United Nations Convention on Contracts for the + International Sale of Goods is expressly excluded. Any law or + regulation which provides that the language of a contract shall + be construed against the drafter shall not apply to this License. + You agree that You alone are responsible for compliance with the + United States export administration regulations (and the export + control laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + + 10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/NOTICE b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000000..d48810c0ec --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/NOTICE @@ -0,0 +1,18 @@ +========================================================================= +== NOTICE file corresponding to the section 4 d of == +== the Apache License, Version 2.0, == +== in this case for the Apache Tuscany distribution. == +========================================================================= + +This product includes software developed by the Apache Software Foundation +(http://www.apache.org/). + +This product also includes software developed by: +- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/) +- the Celtix project (http://celtix.objectweb.org/) +- the Mozilla Rhino project (http://www.mozilla.org/rhino/) +- the GlassFish JAX-WS project (https://jax-ws.dev.java.net/) + +Please read the LICENSE.txt file present in the root directory of this +distribution. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/README.txt b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/README.txt new file mode 100644 index 0000000000..9b26d1690a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/main/resources/META-INF/README.txt @@ -0,0 +1,35 @@ +Apache Tuscany M1 build (May, 2006) +=================================== + +http://incubator.apache.org/tuscany/ + +Tuscany is an effort undergoing incubation at the Apache Software Foundation +(ASF), sponsored by the Web Services PMC. + +Incubation is required of all newly accepted projects until a further review +indicates that the infrastructure, communications, and decision making process +have stabilized in a manner consistent with other successful ASF projects. + +While incubation status is not necessarily a reflection of the completeness or +stability of the code, it does indicate that the project has yet to be fully +endorsed by the ASF. + + +Support +------- + +Any problem with this release can be reported to the Tuscany mailing list +or in the JIRA issue tracker. + +Mailing list subscription: + tuscany-dev-subscribe@ws.apache.org + +Jira: + http://issues.apache.org/jira/browse/Tuscany + + +Thank you for using Tuscany! + + +The Tuscany Team. + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/test/java/org/apache/tuscany/test/helloworldws/HelloWorldWebServiceTestCase.java b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/test/java/org/apache/tuscany/test/helloworldws/HelloWorldWebServiceTestCase.java new file mode 100644 index 0000000000..347b6f5b9a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/helloworldws/src/test/java/org/apache/tuscany/test/helloworldws/HelloWorldWebServiceTestCase.java @@ -0,0 +1,62 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tuscany.test.helloworldws; + +import helloworld.HelloWorldService; +import junit.framework.TestCase; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.core.config.ConfigurationException; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; + + +public class HelloWorldWebServiceTestCase extends TestCase { + + String getGreetings(String name) throws ConfigurationException { + // Obtain Tuscany runtime + TuscanyRuntime tuscany = new TuscanyRuntime("hello", null); + + // Start the runtime + tuscany.start(); + + // Obtain SCA module context. + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + // Locate the HelloWorld service component and invoke it + HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldService"); + + String value = helloworldService.getGreetings(name); + + // Stop the runtime + tuscany.stop(); + + return value; + } + + public void testHelloWorldDefault() throws Exception { + final String name= "World"; + String greeting= getGreetings(name); + assertEquals(greeting, "Hello " + name); + + final String name2= "SCA World!"; + greeting= getGreetings(name2); + assertEquals(greeting, "Hello " + name2); + + } + +} diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/pom.xml b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/pom.xml new file mode 100644 index 0000000000..fb2f50510a --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/pom.xml @@ -0,0 +1,106 @@ + + + + + org.apache.tuscany + tuscany-project + incubating-M1 + + 4.0.0 + tuscany-testing-tomcat + pom + Tuscany Testing in Tomcat + incubating-M1 + + + + helloworldws + helloworldweb + bigbank + + + + + + 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/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/readme.htm b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/readme.htm new file mode 100644 index 0000000000..9f7c2db2eb --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/readme.htm @@ -0,0 +1,63 @@ + + + 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.
        +
      • Follow the steps to build +Tuscany core from either the samples +readme or the more +comprehensive instructions in the Getting Involved with Apache Tuscany +page. This step +needs to be done when ever you have new source to test.
      • +
      • Change directory +to java/testing/tomcat +directory.
      • +
      • Download +Tomcat Core 5.5.xx zip +for Windows or  tar.gz for Linux  from Apache +Tomcat.
      • 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.
      • During +the build Maven +references the dependency jsr173 jar which is not in any maven 2.0 +repository to resolve this you need to add it to your local Maven +repository by : 

       Running

      In +the java/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 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.340s]
      [INFO] Tuscany Testing Tomcat HelloWorld WS ................... SUCCESS [10.956s]
      [INFO] Tuscany Testing Tomcat HelloWorld Axis2 ................ SUCCESS [4.847s]
      [INFO] ----------------------------------------------------------------------------
      [INFO] ----------------------------------------------------------------------------
      [INFO] BUILD SUCCESSFUL
      [INFO] ----------------------------------------------------------------------------
      [INFO] Total time: 16 seconds
      [INFO] Finished at: Tue Apr 11 13:19:42 EDT 2006
      [INFO] Final Memory: 8M/15M
      [INFO] ----------------------------------------------------------------------------

      Cleanup

      Close +the Tomcat window and issue mvn clean. \ No newline at end of file diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/server.xsl b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/server.xsl new file mode 100644 index 0000000000..dd8af28e57 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/server.xsl @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + org.apache.tuscany.tomcat.TuscanyHost + + + + + + + + diff --git a/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/sourceBuild.htm b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/sourceBuild.htm new file mode 100644 index 0000000000..d764faf799 --- /dev/null +++ b/sca-java-1.x/tags/java-M1-20060522/java/testing/tomcat/sourceBuild.htm @@ -0,0 +1,116 @@ + + +Tuscany Sample Setup + + +

      Tuscany Sample Setup

      Getting +Tuscany +Obtain Subversion Subversion
      +
      • md +tuscany
      • +
      • cd tuscany
      • +
      • svn co +http://svn.apache.org/repos/asf/incubator/tuscany/java
      • +

       Build +Tuscany 

      +Obtain Maven +2.0.2
      +
      • cd +java
      • +
      • mvn
      • +

      Setup

      +

      J2SE +setup

      +Tuscany applications can be run in a J2SE 5.0 +environment. Before you +can run Tuscany applications in that environment, the Tuscany runtime +JAR files and the JAR files they depend on must be added to your J2SE +classpath.
      +Samples not requiring invoking web +services +need at least the following jars in their classpath
      +
      + + +
      asm-2.2.jar
      common-2.2.0-RC4.jar
      commons-logging-1.0.4.jar
      concurrent-1.3.4.jar
      ecore-2.2.0-RC4.jar
      ecore-change-2.2.0-RC4.jar
      ecore-xmi-2.2.0-RC4.jar
      geronimo-connector-1.0.jar
      geronimo-j2ee-connector_1.5_spec-1.0.jar
      geronimo-jta_1.0.1B_spec-1.0.jar
      geronimo-transaction-1.0.jar
      js-1.6R2.jar
      sca-api-incubating-M1.jar
      sdo-api-incubating-M1.jar
      stax-api-1.0.jar
      tuscany-binding-jsonrpc-incubating-M1.jar
      tuscany-common-incubating-M1.jar
      tuscany-container-java-incubating-M1.jar
      tuscany-container-rhino-incubating-M1.jar
      tuscany-core-incubating-M1.jar
      tuscany-databinding-sdo-incubating-M1.jar
      tuscany-model-incubating-M1.jar
      tuscany-sdo-impl-incubating-M1.jar
      wsdl4j-1.5.2.jar
      wstx-asl-2.9.3.jar
      xbean-2.1.0.jar
      xsd-2.2.0-RC4.jar
      +
      +There is an ant +script in java\testing\tomcat\build.xml that will produce in +tuscany\java\testing\tomcat\target\j2se all the jars above once you +have completed the full maven build at the root. Run "ant j2se" + Use in java -Djava.ext.dirs to point to this directory to +include all these jars.
      +
      If +you're planning to use SCA Web Service bindings from your Tuscany +application, add the following JAR files to your classpath:
      + + + +
      +
      axiom-api-1.0.jar
      axiom-impl-1.0.jar
      axis2-kernel-1.0.jar
      commons-codec-1.3.jar
      commons-httpclient-3.0.jar
      commons-logging-1.0.3.jar
      junit-3.8.1.jar
      neethi-1.0.1.jar
      tuscany-binding-axis2-incubating-M1.jar
      XmlSchema-1.0.2.jar
      here is an +ant +script in java\testing\tomcat\build.xml that will produce in +tuscany\java\testing\tomcat\target\j2sews all the jars above once you +have completed the full maven build at the root. Run "ant j2sews + Use in java -Djava.ext.dirs to point to this directory to +include all these jars. +

      Tomcat +Setup

      +

      The setup and configuration of  the +Tomcat web server is a little more complex.  If you are not +interested in the details the easiest means of  configuring +this environment is by running "ant" in  java\testing\tomcat that +will configure a server that is +ready to run the samples and deploy your own SCA applications..

      +

      For +any other SCA application that is run in a Tomcat environment, +package it as a standard J2EE war file and deploy it as +usual. For +Tomcat this is simply done by copying them to its webapps +directory. 

      +

      The +details:

      +
      • Unzip +Tomcat to acceptance\target\apache-tomcat-5.5.15
      • +
      • Add +org.apache.Tuscany.tomcat.lifecycle.listener.TomcatServerLifecycleListener +to conf\server.xml
        + + + +
        Change +the Host element to add className="org.apache.tuscany.tomcat.TuscanyHost" +attribute like this:
        +      +<Host className="org.apache.tuscany.tomcat.TuscanyHost" +name="localhost" appBase="webapps" +unpackWARs="true" +autoDeploy="true" xmlValidation="false" +xmlNamespaceAware="false">
        +

        The following jars need to be placed in tomcats +common/lib directory

        + + + +
        +
        	common-2.2.0-snapshot.jar
        ecore-2.2.0-snapshot.jar
        ecore-change-2.2.0-snapshot.jar
        ecore-xmi-2.2.0-snapshot.jar
        js-1.6r2.jar
        sca-api-incubating-m1.jar
        sdo-api-incubating-m1.jar
        stax-api-1.0.jar
        tuscany-das-rdb-incubating-m1.jar
        tuscany-sdo-impl-incubating-m1.jar
        wstx-asl-2.9.3.jar
        xbean-2.1.0.jar
        xsd-2.2.0-snapshot.jar
        jsonrpc-1.0.jar Optional if you want javascript components
        derby-10.1.2.1.jar Optional if you want database support
      • +
      • The +following jars need to go into the server/lib

        + + + +
        +
        	asm-2.2.jar
        axiom-api-1.0.jar
        axiom-impl-1.0.jar
        axis2-kernel-1.0.jar
        commons-codec-1.3.jar
        commons-httpclient-3.0.jar
        commons-logging-1.0.4.jar
        concurrent-1.3.4.jar
        geronimo-connector-1.0.jar
        geronimo-j2ee-connector_1.5_spec-1.0.jar
        geronimo-jta_1.0.1b_spec-1.0.jar
        geronimo-transaction-1.0.jar
        neethi-1.0.1.jar
        tuscany-binding-axis2-incubating-m1.jar
        tuscany-binding-jsonrpc-incubating-m1.jar
        tuscany-common-incubating-m1.jar
        tuscany-container-java-incubating-m1.jar
        tuscany-container-rhino-incubating-m1.jar
        tuscany-core-incubating-m1.jar
        tuscany-databinding-sdo-incubating-m1.jar
        tuscany-model-incubating-m1.jar
        tuscany-tomcat-incubating-m1.jar
        wsdl4j-1.5.2.jar
        xmlschema-1.0.2.jar
      • +
      • or +the samples copy their war files to Tomcat's webapps +directory.
      • +
      + \ No newline at end of file -- cgit v1.2.3